cpu-architecturevon-neumann

What is the purpose of the CIR if I have the MDR in Von Neumann Architecture?


From the fetch decode execute cycle of the Von Neumann Architecture, at a basic level, here is what I understand:

  1. Memory address in PC is copied to MAR.
  2. PC +=1
  3. The instruction / data in the address of the MAR is stored in the MDR after being fetched from main memory.
  4. Instruction from MDR is copied to CIR
  5. Instruction / data in memory is decoded & executed by the CU .
  6. Result from the calculation stored in ACC.
  7. Repeat

Now if the MDR value is copied to the CIR, why are they both necessary. I am quite new to systems architecture so I may have gotten the wrong end of the stick, but I've tried my best :)


Solution

  • Think about what happens if the current instruction is a load or store: does anything need to happen after the MDR? If so, how is the CPU going to remember what it's in the middle of doing if it doesn't keep track of that somehow.

    Whether that requires the original instruction bits the whole time or not depends on the design.

    A CPU that needs to do a lot of decoding (e.g. a CISC with a compact variable-length instruction set, like original 8086) may not keep the actual instruction itself around, but instead just some decode results. For example, actual 8086 decoded incrementally, scanning through prefixes one byte at a time until reaching the opcode. And modern x86 decodes to uops which it sends down the pipeline; the original machine-code bytes aren't needed.

    But CPUs like MIPS were specifically designed so parts of the instruction word could be used directly as internal control signals. Still, it's not always necessary to keep the whole instruction around in one piece.

    It might make more sense to look at CIR as being the input latches of the decoding process that produces the necessary internal control signals, or sequence of microcode depending on the design. Having a truly physical CIR separate from that is ok if you don't mind redoing decoding at any step you need to consult it to figure out what step to do next.