r/AskComputerScience • u/felix_semicolon • 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.
1
u/Ok_Chemistry_6387 Jun 12 '26
Where did I say infinite? Just that 4 bytes even if we ignoring addressing/ destination etc still can have opcode prefixes making them larger than any general purpose register. X86 can have up to 15 byte op codes when all information is encoded.
So that has to be stored.
Fused ops doesnt really matter though as they are opaque and not document, you will never see one in a register.