Computer Science I / Data Path and Control
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

Hints
  1. Exactly one field per instruction says WHICH operation; the rest say what it acts on.
  2. 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.

Read the lesson: Data Path and Control →

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