2081 5

CSC213 ยท 2081 ยท 5 marks

What is instruction format? Explain instruction formats of basic computer and give two examples of each type of instructions.

What is instruction format? Explain instruction formats of basic computer and give two examples of each type of instructions. [5]

Computer ArchitectureChapter 3: Basic Computer Organization and DesignInstruction Format

Quick answer

An instruction format is the layout or structure that defines how the bits of an instruction word are organized and interpreted by the processor. It specifies the fields within an instruction, such as the opcode, address, and mode bits, so that the control unit can correctly decode and execute each instruction.

Instruction Format: Basic Computer

Definition

In the basic computer, each instruction is 16 bits wide and there are three types of instruction formats.


Three Instruction Formats of Basic Computer

1. Memory Reference Instruction

This type of instruction references a memory location as its operand.

Format (16 bits):

Bit 15Bits 14-12Bits 11-0
I (Mode)Opcode (3 bits)Address (12 bits)
  • Bit 15 (I-bit): Addressing mode indicator
    • I = 0 โ†’ Direct addressing (operand is at the given address)
    • I = 1 โ†’ Indirect addressing (given address holds the address of the operand)
  • Bits 12-14: 3-bit opcode (can represent up to 7 memory reference instructions, since opcode 111 is reserved)
  • Bits 0-11: 12-bit address field (can address up to 4096 memory locations)

Examples:

InstructionDescription
LDA 457Load the content of memory address 457 into the Accumulator (AC)
ADD 300Add the content of memory address 300 to the Accumulator (AC)

2. Register Reference Instruction

This type of instruction performs operations on CPU registers (primarily the Accumulator) and does not reference memory.

Format (16 bits):

Bit 15Bit 14Bit 13Bit 12Bits 11-0
0111Operation bits (12 bits)
  • Bits 12-14 = 111 and Bit 15 = 0 identifies this as a register reference instruction
  • Bits 0-11: Each bit specifies a particular register operation (only one bit is set at a time)

Examples:

InstructionDescription
CLAClear the Accumulator (AC โ† 0)
CMAComplement the Accumulator (AC โ† AC')

3. Input/Output (I/O) Reference Instruction

This type of instruction handles communication with input/output devices and does not reference memory.

Format (16 bits):

Bit 15Bit 14Bit 13Bit 12Bits 11-0
1111Operation bits (12 bits)
  • Bits 12-14 = 111 and Bit 15 = 1 identifies this as an I/O reference instruction
  • Bits 0-11: Each bit specifies a particular I/O operation

Examples:

InstructionDescription
INPInput a character from the input device into AC (bits 0-7)
OUTOutput a character from AC (bits 0-7) to the output device

Summary Table

FormatBit 15Bits 12-14Bits 0-11Purpose
Memory Reference0 or 1 (mode)Opcode (โ‰  111)AddressAccess memory operands
Register Reference0111Operation bitsOperate on registers
I/O Reference1111Operation bitsHandle I/O operations

Key Point: The basic computer distinguishes between the three instruction types during the decode phase (T2) by examining bit 15 and the opcode bits 12-14 of the Instruction Register (IR).

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.