1

What is the difference between "Memory address" and "Program counter" in CPU registers?

1 Answer 1

2

The Program Counter specifically points to the address in memory where the next instruction to be fetched and executed is stored.

Address registers point to any address in memory, typically where data that needs to be fetched is stored.

5
  • So program counter doesn't points to "DATA"s but memory address can point to both of the "DATA" and "INSTRUCTION" items. isn't it? but if both of them point to an address of an instruction, which one will be executed? Apr 1, 2014 at 21:58
  • And, when we need to write something to memory, Memory address register will hold the address? Apr 1, 2014 at 22:00
  • 1
    The PC is always where the next instruction is. It doesn't matter if any other register happens to point to an instruction. The processor always only looks to the PC for the next instruction. And yes, when you write to memory, you may instruct the processor to write to where a certain address register is pointing.
    – Spiff
    Apr 1, 2014 at 22:07
  • It might be worth noting that some ISAs provide PC-relative data addressing (especially for loads) and a few (e.g., ARM and PDP-11) have the PC as a general purpose register.
    – user180742
    Apr 1, 2014 at 23:00
  • If i need to read some data from memeory address let us say 6500 , will address store in MAR and say that we need to write something to let us say memory address 3400 , would that will be stored in MAR , i mean you said in your answer , typically where data that needs to be fetched is stored why not , address where data is to be put ?
    – Suraj Jain
    Jan 28, 2017 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .