質問

I have been reading up on assembly programming and computer architecture over the last few weeks, but I am left with a couple of questions that I cannot seem to find the answer to.

When reading about CPU builds etc., you learn about the MAR and MDR registers, and how they control the flow of data between memory and the CPU.

Separately, in assembly language (referring to IA-32 here), we learn that the x86 architecture has 8 General-Purpose Registers (EAX, ESP, EDI, etc.), 6 Segment Registers and 2 Control Registers (1 Flags Register and an Instruction Pointer). That is 16 registers in total.

None of the registers mentioned in assembly language guides mention the MDR and the MAR.

The questions are as follows:

How does the MAR / MDR fit into the assembly language list of registers?

Does the x86 in fact have more than 16 registers?

How many registers does ARM / MIPS have?

Thank you very much in advance.

役に立ちましたか?

解決

MAR/MDR registers are a particular implementation technique that can be used for a CPU to directly control a memory bus. As such they're only relevent for simple processors -- all the processors you name have a cache between the CPU and memory, so are much more complex.

The key thing to understand, however, is that the assembly/machine language supported by a chip is just a langauge. Very few CPUs execute that language directly -- most involve some kind of interpreter or translator that breaks the instructions down into simpler steps for execution. The closest thing to a CPU that actually implements the assembly language is something like early MIPS processors, which is part of the RISC design philosophy. But even there, later versions started changing things.

  1. How does the MAR / MDR fit into the assembly language list of registers?

They don't. For a processor such as a 6800 (which uses MAR/MDR internally), they're not directly accessable from the assembly language. Instead, this type of processor uses microcode instructions to implement the assembly instructions, and those microcode instruction move data to and from the MAR, MDR and other registers (A, B, X, and S, which are visible in the assembly code). Its possible the 8088 used this same technique -- the 8086 is necessarily more complex as it had a 16-bit data bus, but still included 8-bit instructions.

  1. Does the x86 in fact have more than 16 registers?

Most recent x86 processors use register renaming (in which machine instructions are translated into uops on the fly and potentially reordered), so have far more actual hardware registers to allow processing many more instructions in parallel.

  1. How many registers does ARM / MIPS have?

original ARM has 16 (including the PC), while original MIPS has 31 (plus the PC). Later versions added floating point registers. ARM in addition has some 'shadow' registers (alternate registers used for handling interrupts), and both have MSR registers (which aren't like "normal" registers -- you don't use them for computation, but instead for controlling things).

他のヒント

Try to get your hands on this. It's a bit old, but it explains the basic internals of a processor pretty well.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top