r/AskComputerScience • • Jun 07 '26

How precisely does the current instruction register work?

In my revision for my upcoming exams, I'm going over the CPU architecture section and looking at the different specific-purpose registers and the CIR has really made me think. I know it holds the instruction being executed by the processor, but it holds this before the decoding stage. This would surely mean it has to hold an arbitrary number of bytes of ASCII - potentially even unicode - while also being a fixed-length buffer. The reason this confuses me is that an instruction may be too long to fit entirely inside the CIR, meaning the control unit would not be able to read the full instruction.

My question is primarily what data does it actually hold, but also what happens if an instruction is too long if that even is a problem that occurs? There will probably be some differences on the answer for this depending on CPU architecture but any answer would be appreciated.

0 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/Ok_Chemistry_6387 Jun 12 '26

You are talking about purely the control mnemonic. Which is only one part of an instruction. Machine code, macro and micro Instructions also encode destination and immediate etc not just the mnemonic (well dont have to but do). Even after decode We have no idea how large uops are but https://uops.info/html-instr/MOV_R64_I64.html suggests that they are going to be larger than 64 bits. We can also get this from intels manual. That says uops with immediate will straddle two lines in the uop cache(32 bits for the immediate). So we know that uops are multi width and can be larger than 64bits. So macro and microps are multi width and larger than 64 bits. They also get stored fused and unfused depending on which stage of the pipeline they are looked at so they can grow and shrink across the decode cache, execution and retirement.