Texts on microprocessors use lines like the following ones :

"The instructions in an instruction set of a microprocessors have their own address "

"In the first clock cycle the instruction is fetched from its address and then the operands (variables)

"It was a breakthrough to realize that both the instructions and variables can be stored in the memory "

In all these lines what is meant by "storing an instruction at a particular address " ?

I tried thinking about it and deconstruct it and it was alog the following lines : In case of an instruction like say ,ADD, when the address bus of the microprocessor assumes the values as in the bits of the address of an instructor , an adder circuit is activated and the values in the next two registers,following the one pointed by program counter ,are transferred to the adder circuit for computation .

I realize that Thinking along these lines result in complicated structures to facilitate a larger set of instructions but that is all I can come up with at present .

Please help me understand what exactly does it mean to store an instruction at an address . (I hope it's a bit confusing because an instruction by definition is not a number but a process or some action to be followed)


There are many theoretical ways to express an (arbitrarily complex) function in numbers, historically starting with the abstract model known as the Turing Machine. Those aren't always efficient for real problems, and in engineering we've settled on a pretty straightforward model.

Microprocessors (CPU's) have an associated memory which holds instructions. (1) Instructions are discrete operations, which change the CPU is a well-defined way. There is a finite and numbered set of instructions. Instructions may have operands, such as registers to operate on, or constants to use, and these operands are also encoded as number.

The instruction pointer (or program counter) indicates where exactly in memory the next instruction is stored. It normally increments if an instruction finishes, but a jump or branch instruction can change it in different ways.

As instructions are stored as numbers, they must be decoded when the numbers are retrieved from memory. As you correctly assume, this is non-trivial. The instruction decoder will map an instruction number to a particular bit of hardware to implement the actual instruction.

Let's assume a new CPU design, not compatible with an existing CPU, to keep this simple. As a designer, we know have the freedom to choose which numbers are associated with which instructions. We're still talking CPU's, so a number is a bitstring. We can therefore decide that an instruction is a 32 bit number. We can say that the first bit decides whether the instruction is some type of jump instruction. If so, we send off the number bits to the hardware that changes the instruction pointer. Here we look at the 2nd bit to decide whether it's an unconditional jump. For simplicity, let's assume it is. The third bit may decide whether it's a branch (push IP on stack) or not. Decoding this bit is simple: if set, push. The 4th bit may indicate whether it's an absolute or relative jump. A relative jump would require us to use the arithmetic hardware of the CPU, so for simplicity assume we have an absolute jump. The 5th bit can decide whether to take the destination address from a register, or from an operand. Assuming we use an operand, we see that another number is needed from the instruction stream. This means we issue another read, using the incremented instruction pointer (operand follows instruction). The fetched operand value becomes the new instruction pointer.

1) It's irrelevant here whether this memory is shared with data, or if it's augmented with caches.


an instruction by definition is not a number but a process or some action to be followed)

Yes you are right, it is some kind of action to be followed but definitely every action has some code associated with it that tells CPU what to do.

what exactly does it mean to store an instruction at an address .

You can think it like , for example,a register has some opcode which tells CPU to add 5 to accumulator, that would be ,say like, ADD A,#5

This ADD A,#5 is actually a instruction that instructs Algorithmic unit to do addition and no doubt this instruction would be stored in some register, before it is executed.

  • $\begingroup$ Missing here: 1) Encode instructions as numbers. 2) Store these numbers in memory. 3) Concept of the program counter. $\endgroup$
    – Raphael
    Mar 15 '17 at 6:33
  • $\begingroup$ If we associate numbers with instruction then that number will work as circuit selector number and data will be processed accordingly. $\endgroup$
    – Deep Joshi
    Mar 15 '17 at 7:14
  • $\begingroup$ @DeepJoshi : Isn't that similar to what I was thinking about it $\endgroup$
    – itp dusra
    Mar 15 '17 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.