r/AskComputerScience • • Apr 18 '26

Difference between Program counters and Memory address registers?

What are the differences?

8 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/flatfinger Apr 20 '26

What do you think about the 68000's style of having separate address and data registers? The only downside I can see to such a design is that it makes it impossible for a C implementation to efficiently pass arguments in registers while allowing literal zeroes to be treated as null pointers when passed to non-prototyped functions that expect pointers, but that downside was sufficient back in the day to prevent C compilers for the 68000 from using efficient calling conventions for most function calls.

1

u/MasterGeekMX BSCS Apr 24 '26

Many architectures on the past did things in such ways because that made sense in the context. But as things advanced, that context became obsolete, or simply a lack of oversight.

For example, MIPS CPUs have a delayed-branch instruction, where a jump is made based on the result of the next instruction. In two-staged pipelines, that makes sense, as the CPU does not need to flush the pipeline. But as soon as you add more stages to the pipeline (something that almost all performant chips do nowdays), that thing becomes useless.

1

u/flatfinger Apr 27 '26

There are plenty of microcontroller architectures, even today, where delayed branch instructions or a bona fide loop mode could offer useful performance benefits in the absence of opcode-space limitations.