Practice question · Sort into groups
Two instructions are given: 'ADD R1, R2' adds two registers, and 'ADDI R3, 7' adds the constant 7 to a register. Sort each field by the role it plays.
Groups: Opcode · Register operand · Immediate operand
- 7
- R3
- R2
- R1
- ADD
- ADDI
Hints
- Exactly one field per instruction says WHICH operation; the rest say what it acts on.
- One operand is a value carried inside the instruction itself rather than a place to fetch a value from.
Show the answer
Opcode: ADD, ADDI
Register operand: R1, R2, R3
Immediate operand: 7
Why
ADD and ADDI are opcodes, they select the operation. R1, R2 and R3 name registers to read from or write to. The 7 is an immediate: a constant baked into the instruction, needing no register read. Reading the opcode and operand fields in the wrong roles is the classic decoding mistake.
Practise Data Path and Control
The app has 7 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Data Path and Control
- The control unit works out what an instruction does by inspecting its operand fields.
- Modern x86 processors translate their own instructions into simpler internal micro-operations before…
- The CPU is executing ADD R1, R2, writing the result back into R1. Select every control signal the control…
- Match each field of a 32-bit RISC-V instruction to what it selects.