r/computerscience • u/Tranomial_2 • Nov 02 '25
Help How CPUs store opcode in registers
For example an x64 CPU architecture has registers that are 64 bits wide. How does the IR store opcode + addresses of operands? Does the opcode take the 64 bits but hints at the CPU to use the next few bytes as operands? Does the CPU have an IR that is wider than 64 bits? I want to know the exact mechanism. Also if you can provide sources that would be appreciated.
Edit: I did some research, I found out that there is a special purpose register called MAR. So what I think happens is that the CPU decodes a load instruction for example and decides "This is a load instruction so the next few bytes are definitely the operand". It loads the operands address from the program counter register (PC) to the MAR.
Am I onto something or is that totally wrong?
View all comments
Show parent comment
1
u/MasterGeekMX Bachelors in CS Nov 02 '25
The Instruction Register is often considered a separate register from the other registers, which are used to hold numbers used during program execution.
In some architectures, the IR is on a separate data path than the one used to do the actual computation.