2081

CSC213 · TU past paper

Computer Architecture 2081 question paper

The complete TU 2081 exam paper for Computer Architecture (CSC213), all 12 questions with solved model answers written to the mark scheme.

Tap a question to open its answer.

  1. 110 marksInstruction Level PipeliningAnswer

    What is pipelining? Explain pipelining using 4-segment instruction cycle. What are its advantages?[10]

    Pipelining: 4-Segment Instruction Cycle and Advantages

    1. What is Pipelining?

    Pipelining is a technique used in computer architecture to improve CPU performance by overlapping the execution of multiple instructions. Instead of waiting for one instruction to complete all its phases before starting the next, the CPU divides instruction execution into a series of stages (segments), and different instructions occupy different stages simultaneously.

    It works like an assembly line in a factory: while one instruction is being executed, the next instruction is being decoded, and the one after that is being fetched, all at the same time.

    Pipelining is easy in RISC architecture because instructions are simple and take a single cycle to execute.


    2. Pipelining Using a 4-Segment Instruction Cycle

    The instruction cycle is divided into 4 segments (stages):

    SegmentStageOperation
    S1Fetch (FI)Fetch the instruction from memory using PC
    S2Decode (DI)Decode the opcode and determine instruction type
    S3Execute (EI)Perform the operation (ALU, memory access, etc.)
    S4Write Back (WB)Store the result back to register/memory

    2.1 Micro-operations at Each Stage

    Stage S1: Fetch

    T0: AR <- PC
    T1: IR <- M[AR], PC <- PC + 1
    

    Stage S2: Decode

    T2: Decode IR(12-14), AR <- IR(0-11), I <- IR(15)
        Determine instruction type (memory-reference, register, or I/O)
    

    Stage S3: Execute

    T3: Execute the instruction based on decoded opcode
        (ALU operation, memory read/write, I/O operation)
    

    Stage S4: Write Back

    T4: Write result to destination register or memory location
        SC <- 0 (reset sequence counter for next instruction)
    

    2.2 Pipeline Timing Diagram

    Without pipelining (sequential execution), each instruction takes 4 clock cycles. With pipelining, instructions overlap:

    Clock Cycle:   1    2    3    4    5    6    7
                   |    |    |    |    |    |    |
    Instruction 1: FI   DI   EI   WB
    Instruction 2:      FI   DI   EI   WB
    Instruction 3:           FI   DI   EI   WB
    Instruction 4:                FI   DI   EI   WB
    
    • Without pipeline: 4 instructions x 4 cycles = 16 clock cycles
    • With pipeline: 4 + (4-1) = 7 clock cycles

    2.3 General Formula for Pipeline Execution Time

    For a k-segment pipeline executing n tasks with clock cycle time t_p:

    $$\text{Total Time} = [k + (n-1)] \times t_p$$

    For our 4-segment pipeline (k = 4):

    $$\text{Total Time} = [4 + (n-1)] \times t_p$$

    Example: Execute 6 instructions (n = 6) with k = 4 segments:

    $$\text{Total Time} = [4 + (6-1)] \times t_p = 9 \times t_p$$

    Without pipelining: $$\text{Total Time} = n \times k \times t_p = 6 \times 4 \times t_p = 24 \times t_p$$

    Speedup = 24 / 9 = 2.67x


    2.4 Instruction Queue (FIFO Execution)

    The instruction pipeline execution works like a queue using average execution (FIFO technique). When an instruction first arrives, it is placed in the queue and executed in the system, and the result is passed on to the next instruction in the queue.

    This means:

    • Instructions enter the pipeline in order (FIFO)
    • Each instruction moves through S1 -> S2 -> S3 -> S4 sequentially
    • Multiple instructions are in different stages at the same time

    3. Advantages of Pipelining

    #AdvantageExplanation
    1Increased ThroughputMore instructions are completed per unit time since multiple instructions execute simultaneously
    2Better CPU UtilizationAll pipeline stages are kept busy, reducing idle time of CPU components
    3Faster ExecutionOverall execution time for a large number of instructions is significantly reduced
    4Cost EffectiveHigher performance is achieved without increasing the clock speed or adding more hardware
    5Supports RISC ArchitectureSimple, uniform instructions in RISC make pipelining very efficient and easy to implement
    6ScalabilityMore pipeline stages (deeper pipeline) can be added to further improve performance

    4. Summary

    FeatureWithout PipelineWith Pipeline
    Execution styleSequentialOverlapped
    Time for n instructionsn x k x t_p[k + (n-1)] x t_p
    CPU utilizationLowHigh
    ThroughputLowHigh

    Pipelining is one of the most fundamental techniques in modern processor design. By dividing the instruction cycle into 4 segments (Fetch, Decode, Execute, Write Back) and overlapping their execution using a FIFO queue mechanism, the CPU achieves significantly higher performance without requiring faster hardware.

  2. 210 marksPriority InterruptAnswer

    What do you understand by priority interrupt? Explain polling, daisy-chaining and parallel priority interrupt.[10]

    A priority interrupt is a system that establishes a priority among various interrupt sources so that when two or more devices request an interrupt simultaneously, the CPU can identify and service the highest-priority device first, and th...

  3. 310 marksNumericalAddition and Subtraction with Signed 2's CAnswer

    Draw flowchart for addition and subtraction of signed 2's complement numbers and perform the operation (90-43).[10]

    • Operation to perform: $90 - 43$ - Numbers are represented in signed 2's complement form. - Using 8-bit representation (sufficient since $90 < 128$). --- Rules: - For addition, add the two numbers directly including the sign bits. - For...
  4. 45 marksError Detection CodesAnswer

    How parity bit is generated in even parity? Demonstrate with suitable table and circuit diagram. [5]

    Parity is an extra bit added with the original message to detect errors during data transmission. In even parity, we count the number of 1's in the binary digit: - If the count of 1's is even → parity bit = 0 - If the count of 1's is odd...

  5. 55 marksInstruction FormatAnswer

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

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

  6. 65 marksInstruction Cycle of Basic computerAnswer

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

  7. 75 marksCommon Bus System for Basic ComputerAnswer

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

    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.

  8. 85 marksFlynn's ClassificationAnswer

    What do you understand by Flynn's classification? Explain. [5]

    Flynn's classification is a taxonomy that categorizes computer architectures into four major groups based on the number of concurrent instruction streams and data streams that a processor can handle simultaneously. - Instruction Stream: ...

  9. 95 marksModes of TransferAnswer

    Why I/O interface is important? Discuss the concept of programmed I/O with suitable flowchart. [5]

    --- Peripherals connected to a computer need a special communication link to interface with the CPU. This special link is called the I/O bus. The I/O interface is important for the following reasons: 1. Speed Mismatch: Peripheral devices...

  10. 105 marksCache MemoryAnswer

    What is meant by cache mapping? Explain working of direct mapping with suitable block diagram. [5]

    Cache Mapping

    Definition

    Cache mapping refers to the technique or procedure by which the contents of main memory blocks are mapped (assigned) to cache memory locations. Since cache memory is much smaller than main memory, a mapping function is needed to determine which cache location a particular main memory block will occupy when it is brought into cache.


    Direct Mapping

    Concept

    In direct mapping, each block of main memory can be placed in one and only one specific location in the cache. Main memory is divided into pages that correspond in size with the cache. Each memory address is divided into three fields:

    FieldPurpose
    TagIdentifies which page/block of main memory is currently in cache
    Index (Line/Block number)Specifies which cache line the block maps to
    Word (Block offset)Identifies the specific word within the block

    Address Division

    For a memory address of k bits:

    | TAG  |  INDEX (Cache Line)  |  WORD (Offset)  |
    |  t   |         d            |       w         |
    
    • Number of cache lines = 2^d
    • Number of words per block = 2^w
    • Tag bits = k - d - w

    The cache line number is determined by:

    Cache Line = (Main Memory Block Number) mod (Number of Cache Lines)


    Block Diagram of Direct Mapping

    Main Memory Address
    +--------+----------+--------+
    |  TAG   |  INDEX   |  WORD  |
    +--------+----------+--------+
         |         |         |
         |         |         |
         |    +----v----+    |
         |    |  Cache  |    |
         |    |  Index  |    |
         |    | (Select |    |
         |    |  Line)  |    |
         |    +----+----+    |
         |         |         |
         |    +----v-----------------------+
         |    | Cache Line                 |
         |    |  +-------++--------------+ |
         |    |  | Valid ||  TAG | DATA  | |
         |    |  +-------++--------------+ |
         |    +----+-----------+----------+
         |         |           |
      +--v--+   Compare      Block
      | TAG |----+           Data
      +-----+    |              |
                 v              |
              +------+          |
              | Hit? |          |
              +--+---+          |
                 |              |
             YES | NO           |
                 |   (Fetch     |
                 |    from      v
                 |    Main   +------+
                 |    Memory)|      |
                 v           | WORD |
              +------+       | MUX  |
              | Data |<------+------+
              | Out  |
              +------+
    

    Working Steps

    1. The CPU generates a memory address which is split into Tag, Index, and Word fields.
    2. The Index field is used to directly select a specific cache line.
    3. The Tag stored in that cache line is compared with the Tag from the CPU address.
    4. If the Valid bit = 1 and Tags match → Cache HIT: the required word is read from the cache using the Word field.
    5. If the Tags do not match or Valid bit = 0 → Cache MISS: the block is fetched from main memory, loaded into the indicated cache line, and the tag is updated.

    Example

    Suppose main memory has 32 blocks and cache has 8 lines:

    • Block 0 maps to Cache Line 0 (0 mod 8 = 0)
    • Block 1 maps to Cache Line 1 (1 mod 8 = 1)
    • Block 9 maps to Cache Line 1 (9 mod 8 = 1)
    • Block 17 maps to Cache Line 1 (17 mod 8 = 1)

    Note: Blocks 1, 9, and 17 all compete for the same cache line, which is the main disadvantage of direct mapping.


    Advantages and Disadvantages

    AdvantagesDisadvantages
    Simple and fast to implementTwo blocks with the same index cannot reside in cache simultaneously
    Low hardware costHigh miss rate if frequently used blocks share the same cache line
    Straightforward tag comparisonInflexible placement of blocks
  11. 115 marksShift MicrooperationsAnswer

    Explain different types of shift microoperations. [5]

    Shift microoperations are used for the transfer of data in a register, and are used in conjunction with arithmetic, logic, and other data processing operations. The content of a register can be shifted to the left or right. --- There are...

  12. 125 marksRISC vs CISCAnswer

    Write short notes on: a) CISC b) Conditional branch [5]

    Short Notes: a) CISC b) Conditional Branch


    a) CISC (Complex Instruction Set Computer)

    CISC is a processor design philosophy where the CPU is capable of executing a large number of complex instructions, each of which can perform multiple low-level operations (such as memory access, arithmetic, and logic) in a single instruction.

    Key Characteristics of CISC:

    FeatureDescription
    Instruction SetLarge and complex set of instructions
    Instruction LengthVariable length instructions
    Addressing ModesMany addressing modes supported
    Memory AccessInstructions can directly access memory
    HardwareComplex hardware with microprogram control unit
    ExecutionSingle instruction may take multiple clock cycles

    Key Points:

    • CISC emphasizes doing more work per instruction, reducing the number of instructions per program.
    • It uses microprogrammed control to implement complex instructions.
    • Examples: Intel x86, Intel 8086, VAX processors.
    • The compiler work is reduced since complex operations are handled directly by hardware.
    • CISC processors typically have a large control memory to store microinstructions for each complex instruction.

    b) Conditional Branch

    Conditional branch is a type of branching mechanism in which the transfer of control to a new address depends on the status (condition) of one or more status bits (flags) at the time of execution.

    Definition:

    Conditional branching is obtained by using part of a micro-instruction to select a specific status bit in order to determine its condition. The branch logic provides decision-making capabilities in the control unit.

    How It Works:

    • A portion of the micro-instruction specifies which status bit to test (e.g., zero flag, carry flag, sign flag).
    • If the condition is TRUE -- the branch is taken and the program jumps to the specified address.
    • If the condition is FALSE -- execution continues sequentially (next instruction).

    Block Diagram (Conceptual):

    Control Memory
          |
          v
    [Micro-instruction] --> [Branch Logic] <-- [Status Bits (flags)]
                                   |
                        ---------------------
                        |                   |
                  Condition TRUE      Condition FALSE
                        |                   |
                 Branch Address      Next Sequential Address
    

    Methods of Selecting Next Microinstruction Address:

    The following methods are used:

    1. Incrementing of the control address register (sequential execution).
    2. Unconditional branch or conditional branch depending on status bit conditions.
    3. A mapping process from instruction bits to a control memory address.
    4. A facility for subroutine call and return.

    Example:

    • In a basic computer, instructions like ISZ (Increment and Skip if Zero) use conditional branching:
      • After incrementing, if DR = 0, then PC is incremented by 1 (branch/skip).
      • Otherwise, execution continues normally.

    Difference: Conditional vs Unconditional Branch

    FeatureConditional BranchUnconditional Branch (BUN)
    ConditionDepends on status bitAlways branches
    FlexibilityMore flexibleFixed transfer
    UseDecision making (if-else, loops)Simple jump

    Significance:

    Conditional branching is essential for implementing loops, if-else decisions, and program flow control in both high-level programs and microprogram control units.