CSC213 ยท 2080 ยท 10 marks
Explain the instruction format of basic computer. Write down symbolic representation for FETCH routine.
Explain the instruction format of basic computer. Write down symbolic representation for FETCH routine.[10]
Quick answer
The basic computer has three instruction code formats, each consisting of a total of 16 bits.
Instruction Format of Basic Computer and FETCH Routine
Part 1: Instruction Format of Basic Computer
General Structure of a 16-bit Instruction
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
[I] [ Opcode ] [ Address / Operand ]
1 3 bits 12 bits
| Field | Bits | Size | Purpose |
|---|---|---|---|
| I (Mode bit) | 15 | 1 bit | Addressing mode (0 = Direct, 1 = Indirect) |
| Opcode | 12 - 14 | 3 bits | Specifies the operation to be performed |
| Address / Operand | 0 - 11 | 12 bits | Memory address or operand |
The Three Instruction Formats
Format 1: Memory-Reference Instruction
Bit 15 Bits 14-12 Bits 11-0
[I] [ Opcode ] [ Address ]
1 3 bits 12 bits
- I = 0: Direct addressing (the 12-bit field is the actual memory address)
- I = 1: Indirect addressing (the 12-bit field points to the address that holds the actual address)
- The 3-bit opcode (bits 12-14) is decoded using a 3x8 decoder producing outputs D0 to D7
- D0 to D6 represent memory-reference instructions (e.g., AND, ADD, LDA, STA, BUN, BSA, ISZ)
- Example:
AND,ADD,LDA,STA,BUN,BSA,ISZ
Format 2: Register-Reference Instruction
Bit 15 Bits 14-12 Bits 11-0
[0] [ 1 1 1 ] [ Operation bits ]
0 D7=1 12 bits
- I = 0 and Opcode = 111 (i.e., D7 = 1, I = 0)
- The 12-bit field (bits 0-11) specifies the register operation to be performed
- These instructions operate on the Accumulator (AC) or other registers
- Examples:
CLA(Clear AC),CLE(Clear E),CMA(Complement AC),CME,CIR,CIL,INC,SPA,SNA,SZA,SZE,HLT
Format 3: Input-Output (I/O) Instruction
Bit 15 Bits 14-12 Bits 11-0
[1] [ 1 1 1 ] [ I/O Operation bits ]
1 D7=1 12 bits
- I = 1 and Opcode = 111 (i.e., D7 = 1, I = 1)
- The 12-bit field specifies the I/O operation
- Examples:
INP(Input character to AC),OUT(Output character from AC),SKI,SKO,ION,IOF
Summary of Instruction Type Determination
Decode IR(12-14) --> D7?
|
|-- D7 = 0 --> Memory-Reference Instruction
| (check I bit for direct/indirect)
|
|-- D7 = 1 --> Check I bit (bit 15)
|
|-- I = 0 --> Register-Reference Instruction
|
|-- I = 1 --> Input-Output Instruction
Part 2: Symbolic Representation of the FETCH Routine
The FETCH routine retrieves an instruction from memory and places it in the Instruction Register (IR). It also decodes the instruction and prepares the Address Register (AR) for further use.
The FETCH routine uses a Sequence Counter (SC) that starts at 0 and increments with each timing signal (T0, T1, T2).
Symbolic Representation
Timing Signal T0:
T0: AR <-- PC
At time T0, the content of the Program Counter (PC) is transferred to the Address Register (AR) so that the memory can be addressed.
Timing Signal T1:
T1: IR <-- M[AR], PC <-- PC + 1
At time T1, two microoperations occur simultaneously:
- The instruction stored at memory location pointed by AR is loaded into the Instruction Register (IR)
- The Program Counter (PC) is incremented by 1 to point to the next instruction
Timing Signal T2:
T2: D0, D1, D2, D3, D4, D5, D6, D7 <-- Decode IR(12-14)
AR <-- IR(0-11)
I <-- IR(15)
At time T2:
- The opcode in bits 12-14 of IR is decoded using a 3x8 decoder to produce signals D0 through D7
- The address field (bits 0-11) of IR is transferred to AR for possible use in memory-reference instructions
- The mode bit (bit 15) is transferred to flip-flop I to determine addressing mode
Complete FETCH Routine Table
| Timing Signal | Microoperation | Description |
|---|---|---|
| T0 | AR <-- PC | Transfer PC to AR |
| T1 | IR <-- M[AR] | Fetch instruction from memory into IR |
| T1 | PC <-- PC + 1 | Increment PC to point to the next instruction |
| T2 | D0-D7 <-- Decode IR(12-14) | Decode opcode into 8 signal lines |
| T2 | AR <-- IR(0-11) | Load address field into AR |
| T2 | I <-- IR(15) | Load mode bit into flip-flop I |
After T2, control passes to the appropriate EXECUTE routine based on the decoded opcode and mode bit.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.