3 Basic Computer Organization And Design

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.

Basic Computer Organization and Design: notes

Instruction Code

An instruction code is a group of bits that instructs the computer to perform a specific operation. The control unit reads an instruction code from memory into the instruction register and interprets its bit fields to determine which registers and operations are involved in carrying it out.

Operation Code

The operation code (opcode) is the field of an instruction that specifies the operation to perform, such as add, subtract, load or shift; the number of bits reserved for the opcode depends on the total number of distinct operations the computer must support; with $k$ opcode bits, up to $2^k$ distinct operations can be encoded.

Stored Program Concept

The stored program concept holds that both the instructions of a program and the data it operates on are stored together, in binary form, in the same read/write memory, so that the computer can fetch instructions the same way it fetches data, rather than instructions being wired permanently into the hardware. The basic computer illustrates this with a single processor register, the accumulator (AC), and a memory organized as 4096 words of 16 bits each, of which some words hold instructions (the program) and others hold operands. Since the memory has $2^{12}=4096$ words, 12 bits address any word, and since the opcode field is 4 bits, up to $2^4=16$ distinct operations are possible; the instruction word is divided into an opcode (bits 15-12) and an address (bits 11-0).

Registers and memory of Basic Computer

RegisterSymbolBitsFunction
Data registerDR16Holds the memory operand
Address registerAR12Holds an address for memory
AccumulatorAC16General-purpose processor register
Instruction registerIR16Holds the instruction code
Program counterPC12Holds the address of the next instruction
Temporary registerTR16Holds temporary data
Input registerINPR8Holds an input character
Output registerOUTR8Holds an output character

The memory itself is organized as 4096 words of 16 bits ($4096\times16$).

Common Bus System for Basic Computer

A common bus connects the basic computer's seven registers and its memory unit, so that any one of them can be selected onto a single 16-bit path rather than wiring each register directly to every other one, considerably reducing hardware complexity. Five registers (AR, PC, DR, AC, TR) have three control inputs, LD (load), INR (increment) and CLR (clear); IR and OUTR have only an LD input. All registers, memory, INPR and OUTR share a single clock; whichever register has its LD input enabled receives the bus data on the next clock pulse.

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 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 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).

Open this answer on its own page →

2080 · 10 marks

Explain the instruction format of basic computer. Write down symbolic representation for FETCH routine.[10]

Show solved 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
FieldBitsSizePurpose
I (Mode bit)151 bitAddressing mode (0 = Direct, 1 = Indirect)
Opcode12 - 143 bitsSpecifies the operation to be performed
Address / Operand0 - 1112 bitsMemory 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 SignalMicrooperationDescription
T0AR <-- PCTransfer PC to AR
T1IR <-- M[AR]Fetch instruction from memory into IR
T1PC <-- PC + 1Increment PC to point to the next instruction
T2D0-D7 <-- Decode IR(12-14)Decode opcode into 8 signal lines
T2AR <-- IR(0-11)Load address field into AR
T2I <-- 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.

Open this answer on its own page →

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]

A microoperation is an elementary operation performed on data stored in registers (e.g., add, subtract, load, clear, shift). The fetch phase retrieves the next instruction from memory and prepares it for decoding and execution. --- The fetch phase occurs at timing signals T0, T1, and T2 of the se...

Open this answer on its own page →

Common Bus System for Basic Computer

2081 · 5 marks

Explain common bus system of basic computer with a diagram. [5]

Show solved 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:

  1. Multiplexers (MUX)
  2. 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

  1. The selection lines determine which register is connected to the bus as the source
  2. The data from the selected register is placed on the common bus
  3. The register whose LD (load) input is enabled will receive the data from the bus at the next clock pulse
  4. Only one register can send data on the bus at a time, but any register can receive

Advantages

FeatureBenefit
Reduced wiringLess hardware complexity
Centralized controlEasier to troubleshoot
ScalableEasy 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.

Open this answer on its own page →

2079 · 5 marks

Explain common bus system for basic computer. [5]

The common bus system is a shared communication pathway used in a basic computer to transfer information between registers and memory efficiently. Instead of connecting every register to every other register with individual wires (which would require enormous hardware), a single common bus is use...

Open this answer on its own page →

2078 · 5 marks

Explain the bus interconnection scheme with diagram. [5]

A bus is a set of conducting wires (lines) that connect multiple components of a computer system and serve as a shared communication pathway for transferring data, addresses, and control signals between the CPU, memory, and I/O devices. --- A typical bus interconnection scheme consists of three m...

Open this answer on its own page →

Program Interrupt & Interrupt Cycle

2077 · 5 marks

Draw an instruction cycle state diagram with interrupt and explain it. [5]

--- When the computer starts, the following registers are initialized: - SC (Sequence Counter) is cleared to 0 - IEN (Interrupt Enable flip-flop) is cleared to 0 - R (Interrupt Request flip-flop) is cleared to 0 --- The instruction cycle begins with fetch and decode: Timing Signal Operation Descr...

Open this answer on its own page →

2075.1 · 6 marks

Explain the input-output interrupt with example. [6]

An input-output interrupt is a mechanism by which an I/O device signals the CPU that it requires attention (i.e., it has completed a data transfer or is ready for the next one), causing the CPU to temporarily suspend its current program, service the I/O request, and then resume the original progr...

Open this answer on its own page →

Registers and memory of Basic Computer

2075 · 5 marks

Explain the computer components. [5]

A computer is a digital system that performs various computational tasks. It is composed of several key components that work together to execute instructions and process data. --- The CPU is the brain of the computer. It performs all processing tasks. It consists of: - Arithmetic Logic Unit (ALU)...

Open this answer on its own page →

Stored Program Concept

2075 · 5 marks

Explain the store-program concept with example. [5]

The stored-program concept is the idea that both instructions (program) and data are stored together in the same memory unit of a computer. The CPU fetches instructions one by one from memory, decodes them, and executes them sequentially. This concept forms the foundation of the modern von Neuman...

Open this answer on its own page →

Instruction Code

2075.1 · 6 marks

Write short notes on: a. Data communication processor b. Computer Instructions [6]

--- A Data Communication Processor (also called an Input/Output Processor - IOP) is a specialized processor that handles data transfer between the CPU/memory and I/O devices, without the direct involvement of the CPU. - The IOP is similar to a CPU in that it can fetch and execute its own instruct...

Open this answer on its own page →