UVMArena

Types of Instructions

Understanding instruction types is fundamental to processor design. Instructions define the operation, source operands, and destination where results are stored.

Instruction Register (IR)

The Instruction Register (IR) holds the instruction currently being executed by the processor. It contains binary data that defines:

  • Operation type (e.g., add, move)
  • Source operands
  • Destination register

Each clock cycle, the processor fetches an instruction into the IR and executes it.

Instruction Types

Instructions are classified based on how many operand addresses are explicitly defined.

Three-Address Instructions

These instructions explicitly define two source operands and one destination.

add r2, r1, r0
r2 = r1 + r0
  • All operands explicitly defined
  • Fewer instructions required
  • Higher hardware complexity

Two-Address Instructions

One operand acts as both source and destination.

add r0, r1
r0 = r0 + r1
  • One implicit operand
  • Moderate complexity
  • More instructions than three-address

Single-Address Instructions

Uses an implicit accumulator register along with one explicit operand.

add r0
A = A + r0

Example sequence for r0 + r1:

move A, r1
add r0
move r0, A
  • Uses accumulator
  • Simpler hardware
  • Requires multiple instructions

Zero-Address Instructions

No operands specified. Uses a stack-based architecture.

PUSH r0
PUSH r1
ADD
  • Operands taken from stack
  • Simplest hardware design
  • Highest number of instructions required

Trade-Off Summary

Type Hardware Complexity Instruction Count
Three-address High Low
Two-address Medium Medium
Single-address Low High
Zero-address Very Low Very High

Design Choice

For this processor project, we will use three-address instructions.

  • Clear operand definition
  • Efficient execution
  • Better for debugging and verification

Interview Questions

  • Why are three-address instructions efficient?
  • What is the role of the accumulator?
  • How do stack-based architectures work?
  • What are the trade-offs between instruction types?