Computer Architecture · Unit 3 · 8 hrs
Basic Computer Organization and Design
Exam-focused notes for Basic Computer Organization and Design (Computer Architecture, CSC213): what the TU syllabus asks and how it has actually been tested, with 11 solved past questions from this unit.
Basic Computer Organization and Design in short
This chapter walks through a small, complete hypothetical machine, the basic computer, to show how the register-transfer ideas of the previous chapter combine into a working fetch-decode-execute cycle, from instruction encoding down to the hardwired control logic that drives it.
What this unit covers
- Instruction Code
- Operation Code
- Stored Program Concept
- Registers and memory of Basic Computer
- Common Bus System for Basic Computer
- Instruction Format
- Instruction Set Completeness
- Control Unit of Basic Computer
- Control Timing Signals
- Instruction Cycle of Basic computer
- Determining Type of Instruction
- Memory Reference Instructions
- Input-Output Instructions
- Program Interrupt & Interrupt Cycle
- Description and Flowchart of Basic Computer
Instruction Format
2081 · 5 marks
What is instruction format? Explain instruction formats of basic computer and give two examples of each type of instructions. [5]
Show solved answerHide answer
Instruction Format: Basic Computer
Definition
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.
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 15 | Bits 14-12 | Bits 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
111is reserved) - Bits 0-11: 12-bit address field (can address up to 4096 memory locations)
Examples:
| Instruction | Description |
|---|---|
| LDA 457 | Load the content of memory address 457 into the Accumulator (AC) |
| ADD 300 | Add 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 15 | Bit 14 | Bit 13 | Bit 12 | Bits 11-0 |
|---|---|---|---|---|
| 0 | 1 | 1 | 1 | Operation 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:
| Instruction | Description |
|---|---|
| CLA | Clear the Accumulator (AC ← 0) |
| CMA | Complement 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 15 | Bit 14 | Bit 13 | Bit 12 | Bits 11-0 |
|---|---|---|---|---|
| 1 | 1 | 1 | 1 | Operation 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:
| Instruction | Description |
|---|---|
| INP | Input a character from the input device into AC (bits 0-7) |
| OUT | Output a character from AC (bits 0-7) to the output device |
Summary Table
| Format | Bit 15 | Bits 12-14 | Bits 0-11 | Purpose |
|---|---|---|---|---|
| Memory Reference | 0 or 1 (mode) | Opcode (≠ 111) | Address | Access memory operands |
| Register Reference | 0 | 111 | Operation bits | Operate on registers |
| I/O Reference | 1 | 111 | Operation bits | Handle 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).
2080 · 10 marks
Explain the instruction format of basic computer. Write down symbolic representation for FETCH routine.[10]
Show solved answerHide answer
Instruction Format of Basic Computer and FETCH Routine
Part 1: Instruction Format of Basic Computer
The basic computer has three instruction code formats, each consisting of a total of 16 bits.
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.
Instruction Cycle of Basic computer
2081 · 5 marks
What microoperations are performed in fetch phase of instruction cycle of basic computer? Explain with suitable circuit diagram. [5]
Common Bus System for Basic Computer
2081 · 5 marks
Explain common bus system of basic computer with a diagram. [5]
Show solved answerHide answer
Common Bus System of Basic Computer
Introduction
The common bus system is used in a basic computer to facilitate efficient communication between registers and memory. Instead of connecting every register to every other register with individual wires (which increases hardware complexity), a single shared bus is used to transfer data between all components.
Requirements / Key Features
- The basic computer has eight registers, a memory unit, and a control unit
- Six registers and memory are connected to the bus
- The input register (INPR) and output register (OUTR) are 8-bit registers
- All seven registers, memory, INPR and OUTR are driven by a single-phase clock pulse
- The particular register whose load (LD) input is enabled receives the data from the bus during the next clock pulse
- Which register is selected is determined by selection lines (S1, S0, etc.)
Construction of Common Bus
A common bus can be constructed using either:
- Multiplexers (MUX)
- Three-state buffers
Using Multiplexers
Each bit position of the bus has one MUX. For n registers, the selection lines choose which register drives the bus.
Example: 4-register, 4-bit bus using 4x1 MUX:
Registers: A B C D
| | | |
[MUX 0][MUX 1][MUX 2][MUX 3]
|
COMMON BUS
|
(to all registers)
Selection Lines:
S1 S0 | Selected Register
--------|-------------------
0 0 | A
0 1 | B
1 0 | C
1 1 | D
- The selection lines S1 and S0 are connected to the selection inputs of all MUXes
- All MUXes select the same register at the same time
- The selected register's data is placed on the bus
Diagram: Common Bus System for Basic Computer
+-------+ +-------+ +-------+ +-------+
| AR | | PC | | DR | | AC |
| (12b) | | (12b) | | (16b) | | (16b) |
+---+---+ +---+---+ +---+---+ +---+---+
| | | |
+-----+-----+-----------+-----------+
|
+--------+--------+
| COMMON BUS | (16-bit)
+--------+--------+
|
+-----+-----+
| |
+---+---+ +---+---+
| IR | | TR |
| (16b) | | (16b) |
+-------+ +-------+
|
+----+----+
| MEMORY |
| UNIT |
+---------+
Selection Lines (S2, S1, S0) --> determine which register
drives the bus
How It Works
- The selection lines determine which register is connected to the bus as the source
- The data from the selected register is placed on the common bus
- The register whose LD (load) input is enabled will receive the data from the bus at the next clock pulse
- Only one register can send data on the bus at a time, but any register can receive
Advantages
| Feature | Benefit |
|---|---|
| Reduced wiring | Less hardware complexity |
| Centralized control | Easier to troubleshoot |
| Scalable | Easy to add more registers |
Summary
The common bus system provides an efficient and organized way to transfer information among the registers and memory of the basic computer. By using multiplexers and selection lines, any one of the registers can be selected to place its data on the bus, while the destination register is enabled by its load input to receive the data on the next clock pulse.
2078 · 5 marks
Explain the bus interconnection scheme with diagram. [5]
Program Interrupt & Interrupt Cycle
2077 · 5 marks
Draw an instruction cycle state diagram with interrupt and explain it. [5]
2075.1 · 6 marks
Explain the input-output interrupt with example. [6]
Registers and memory of Basic Computer
Stored Program Concept
Instruction Code
2075.1 · 6 marks
Write short notes on: a. Data communication processor b. Computer Instructions [6]
Make Unit 3 stick
Practice CSC213 with flashcards & quizzes