2082

BIT151 · TU past paper

Microprocessor and Computer Architecture 2082 question paper

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

Tap a question to open its answer.

  1. 1NumericalRISC and CISC architecture comparisonAnswer

    Differentiate between RISC and CISC Architecture and Booth's Multiplication

    RISC vs CISC Architecture and Booth's Multiplication Algorithm

    STEP 1 - EXTRACT: Given Data

    • Multiply 9 × 7 using Booth's Algorithm
    • Multiplicand $M = 9$
    • Multiplier $Q = 7$
    • Both positive, need signed 2's complement representation

    Bit-width check: $9 = 1001_2$ (4 bits). To represent as signed positive, we need a leading 0, so minimum 5 bits: $9 = 01001$. Similarly $7 = 00111$. Use $n = 5$ bits.


    Part 1: RISC vs CISC Architecture [4 Marks]

    RISC (Reduced Instruction Set Computer) uses a small set of simple, fixed-length instructions, each executing in a single clock cycle.

    CISC (Complex Instruction Set Computer) uses a large set of complex, variable-length instructions where one instruction may perform several low-level operations over multiple cycles.

    FeatureRISCCISC
    Instruction SetSmall, simpleLarge, complex
    Instruction LengthFixedVariable
    Execution TimeSingle clock cycleMultiple clock cycles
    Addressing ModesFewMany
    Control UnitHardwiredMicroprogrammed
    RegistersLarge numberFewer
    Memory AccessLoad/Store onlyInstructions can access memory directly
    ExamplesARM, MIPS, SPARCIntel x86, VAX

    Part 2: Booth's Multiplication -- 9 × 7 [6 Marks]

    Booth's Rules

    $Q_0$$Q_{-1}$Operation
    00Shift only
    11Shift only
    01$A = A + M$, then shift
    10$A = A - M$, then shift

    Setup

    • $M = 01001$
    • $-M = 10111$ (2's complement of $M$)
    • $Q = 00111$
    • $A = 00000$, $Q_{-1} = 0$, $n = 5$

    Step-by-Step

    Initial: $A=00000,\ Q=00111,\ Q_{-1}=0$

    Cycle 1: $Q_0 Q_{-1} = 10 \Rightarrow A = A - M$ $$A = 00000 + 10111 = 10111$$ Before ASR: $A=10111,\ Q=00111,\ Q_{-1}=0$ After ASR: $A=11011,\ Q=10011,\ Q_{-1}=1$

    Cycle 2: $Q_0 Q_{-1} = 11 \Rightarrow$ no op After ASR: $A=11101,\ Q=11001,\ Q_{-1}=1$

    Cycle 3: $Q_0 Q_{-1} = 11 \Rightarrow$ no op After ASR: $A=11110,\ Q=11100,\ Q_{-1}=1$

    Cycle 4: $Q_0 Q_{-1} = 01 \Rightarrow A = A + M$ $$A = 11110 + 01001 = 00111$$ Before ASR: $A=00111,\ Q=11100,\ Q_{-1}=1$ After ASR: $A=00011,\ Q=11110,\ Q_{-1}=0$

    Cycle 5: $Q_0 Q_{-1} = 00 \Rightarrow$ no op After ASR: $A=00001,\ Q=11111,\ Q_{-1}=0$

    Summary Table

    CycleAQ$Q_{-1}$$Q_0Q_{-1}$Operation
    Init00000001110--Initialize
    11011100111010A = A - M
    ASR11011100111Shift
    21101110011111No op
    ASR11101110011Shift
    31110111001111No op
    ASR11110111001Shift
    40011111100101A = A + M
    ASR00011111100Shift
    50001111110000No op
    ASR00001111110Shift

    Result

    $$AQ = 00001,11111$$

    Converting to decimal: $0000111111_2 = 63$

    $$9 \times 7 = 63 \checkmark$$

    Conclusion: Booth's algorithm correctly yields the product 63.

  2. 210 marksSAP 2 computer features and architectureAnswer

    Explain the features of SAP2 computer with well labeled block diagram.How is it different compared to SAP1 Computer?[8+2]

    SAP-2 Computer: Features, Block Diagram, and Comparison with SAP-1

    Note: The reference notes did not contain this topic. The following answer is based on standard computer architecture curriculum as taught in TU BSc CSIT (Malvino's "Digital Computer Electronics" textbook content), which is the standard source for SAP computers in this course.


    SAP-2 (Simple As Possible - 2) Computer

    SAP-2 is an improved version of SAP-1, designed to be more powerful and closer to a real microprocessor. It has an 8-bit architecture with enhanced instruction set, more registers, and bidirectional data bus.


    Features of SAP-2 Computer

    1. 8-bit Bidirectional Data Bus

    • SAP-2 uses a bidirectional bus (unlike unidirectional in SAP-1), allowing data to flow in both directions between components.

    2. 64 KB Memory (16-bit Address)

    • SAP-2 has a 16-bit Program Counter and can address up to 65,536 (64K) memory locations, a significant improvement over SAP-1's 16-byte memory.

    3. More General Purpose Registers

    • SAP-2 contains:
      • Accumulator (A) - 8-bit
      • Register B - 8-bit
      • Register C - 8-bit
      • B and C can be used for temporary data storage.

    4. Input/Output Ports

    • SAP-2 has dedicated input ports (Port 1, Port 2) and output ports (Port 3) for I/O operations, making it capable of real I/O communication.

    5. Flags Register

    • SAP-2 includes a Flags register with:
      • Sign Flag (S) - set if result is negative
      • Zero Flag (Z) - set if result is zero
    • These flags enable conditional jump instructions.

    6. Enhanced ALU

    • The ALU supports more operations:
      • Addition (ADD)
      • Subtraction (SUB)
      • Logical AND, OR, NOT (logical operations)
      • Increment / Decrement

    7. Larger Instruction Set

    • SAP-2 supports a much richer instruction set including:
      • Data transfer: MOV, MVI, LDA, STA
      • Arithmetic: ADD, SUB, INR, DCR
      • Logical: ANA, ORA, CMA
      • Branch: JMP, JZ, JNZ, JM
      • I/O: IN, OUT
      • Control: HLT

    8. Controller/Sequencer

    • Uses a more complex control unit with more control words to handle the larger instruction set and more components.

    9. Stack Pointer (in some versions)

    • Some implementations include a Stack Pointer for subroutine handling.

    10. Instruction Register (IR)

    • 8-bit IR stores the fetched instruction. The opcode is decoded by the controller.

    Well-Labeled Block Diagram of SAP-2

            +------------------+
            |   INPUT PORTS    |
            |  (Port 1, Port 2)|
            +--------+---------+
                     |
    +----------------+------------------------------------------+
    |                    8-BIT BIDIRECTIONAL BUS (W BUS)        |
    +---+----------+--------+--------+--------+--------+--------+
        |          |        |        |        |        |
    +---+---+  +--+---+  +--+--+  +--+--+  +--+--+  +--+--+
    |  MAR  |  |  PC  |  |  A  |  |  B  |  |  C  |  |  IR |
    |(Mem   |  |(16-  |  |(Acc)|  |Reg B|  |Reg C|  |(Inst|
    |Addr   |  | bit) |  |8-bit|  |8-bit|  |8-bit|  | Reg)|
    |Reg)   |  +--+---+  +--+--+  +--+--+  +--+--+  +--+--+
    +---+---+     |         |        |                   |
        |         |      +--+--------+--+                |
        |         |      |     ALU       |                |
    +---+---+     |      | (ADD,SUB,AND, |                |
    |MEMORY |     |      |  OR, NOT,INC) |                |
    |(64KB) |     |      +------+--------+                |
    +---+---+     |             |                         |
        |         |         +---+----+                    |
        |         |         | FLAGS  |                    |
        |         |         | (S, Z) |                    |
        |         |         +--------+                    |
        |         |                                       |
        |    +----+------------------------------------------+
        |    |        CONTROLLER / SEQUENCER                  |
        |    |   (Control Word, Ring Counter, Decoder)        |
        |    +------------------------------------------------+
        |
    +---+---------+
    | OUTPUT PORT |
    |  (Port 3)   |
    +-------------+
    

    Simplified Clean Diagram:

     +-----------+     +-----------+     +-----------+
     |  INPUT    |     |  MEMORY   |     |  OUTPUT   |
     | PORTS 1,2 |     |  (64 KB)  |     |  PORT 3   |
     +-----+-----+     +-----+-----+     +-----+-----+
           |                 |                 |
    =======+=========================================+======
                  8-BIT BIDIRECTIONAL W-BUS
    =======+====+====+====+====+====+====+====+======
           |    |    |    |    |    |    |    |
         +-+--+ +-+-+ +-+-+ +-+-+ +-+-+ +-+--+
         | MAR| | PC| | A | | B | | C | | IR |
         +--+-+ +---+ +-+-+ +-+-+ +---+ +--+-+
            |            |     |            |
        +---+---+     +--+-----+--+    +----+-------------+
        |MEMORY |     |    ALU    |    | CONTROLLER /     |
        |(64 KB)|     |(ADD, SUB, |    | SEQUENCER        |
        +-------+     | AND, OR,  |    | (control word,   |
                      | NOT, INC) |    |  ring counter,   |
                      +-----+-----+    |  decoder)        |
                            |          +------------------+
                      +-----+-----+
                      |  FLAGS    |
                      |  (S, Z)   |
                      +-----------+
    

    How SAP-2 Differs from SAP-1 [2 Marks]

    FeatureSAP-1SAP-2
    Memory16 bytes, 4-bit address64 KB, 16-bit address
    RegistersA and B onlyA, B, C and a temporary register
    Instruction set5 instructionsMuch larger set with data transfer, arithmetic, logic, jump, call and I/O instructions
    ALUAddition and subtractionAddition, subtraction, AND, OR, NOT, increment and decrement
    FlagsNoneSign (S) and Zero (Z) flags, so conditional jumps are possible
    Input and outputSingle output registerInput ports 1 and 2, output port 3
    Program flowStraight line onlyJumps, conditional jumps and subroutine call/return
    Program counter4-bit16-bit

    Conclusion

    SAP-2 keeps the single 8-bit W-bus architecture of SAP-1 but grows in every dimension that matters: 64 KB of memory instead of 16 bytes, more registers, a richer ALU with flags, real input and output ports, and an instruction set large enough to support branching and subroutines. Those additions are what turn SAP-1's straight-line toy machine into something that behaves like a genuine microprocessor such as the 8085.

  3. 310 marksAddressing modes in 8085Answer

    Explain different addressing modes in 8085 microprocessor.Explain any five arithmetic instructions in 8085 microprocessor with suitable example.[5+5]

    (a) Addressing Modes An addressing mode refers to the way in which the operand (data) is specified in an instruction. The 8085 microprocessor supports the following addressing modes: --- - The operand (data) is directly specified in the ...

  4. 45 marksNumericalArithmetic instructions with examplesAnswer

    Write an assembly language program to multiply 08H and 09H, store the product in memory location 8050H and carry in 8051H using 8085 microprocessor instructions. [5]

    Assembly Language Program: Multiply 08H × 09H (8085 Microprocessor)

    STEP 1 - Given Data

    • Multiplicand = 08H
    • Multiplier = 09H
    • Product storage address = 8050H
    • Carry (higher byte) storage address = 8051H

    STEP 2 - Solution

    Concept

    The 8085 has no hardware multiply instruction, so multiplication is done by repeated addition: add the multiplicand (08H) to itself the number of times given by the multiplier (09H). Any carry beyond 8 bits is counted in a separate register.

    Program

            LXI  H, 8050H   ; HL points to product location 8050H
            MVI  B, 08H     ; B = multiplicand (08H)
            MVI  C, 09H     ; C = multiplier / counter (09H)
            MVI  A, 00H     ; A = 00H (accumulate product low byte)
            MVI  D, 00H     ; D = 00H (accumulate carry / high byte)
    
    LOOP:   ADD  B          ; A = A + B
            JNC  SKIP       ; if no carry, skip
            INR  D          ; else increment high byte
    SKIP:   DCR  C          ; decrement counter
            JNZ  LOOP       ; repeat until C = 0
    
            MOV  M, A       ; store product low byte at 8050H
            INX  H          ; HL points to 8051H
            MOV  M, D       ; store carry / high byte at 8051H
    
            HLT             ; halt
    

    Execution Trace

    IterationA beforeADD B (08H)CarryD
    100H08H000H
    208H10H000H
    310H18H000H
    418H20H000H
    520H28H000H
    628H30H000H
    730H38H000H
    838H40H000H
    940H48H000H

    Verification

    $$08H \times 09H = 8 \times 9 = 72_{10} = 48H$$

    Since the result 72 fits in one byte (< 256), no carry is generated, so D = 00H.

    Result in Memory

    AddressContentMeaning
    8050H48HProduct (low byte)
    8051H00HCarry (high byte)

    The final product is 48H with carry 00H.

  5. 55 marksArithmetic micro-operationsAnswer

    Explain different arithmetic micro operations in brief. [5]

    Arithmetic micro-operations are basic operations performed on numeric data stored in registers. They involve arithmetic computations on binary data. --- The most fundamental arithmetic micro-operation. The contents of two registers are a...

  6. 65 marksNumericalNines complement and tens complement methoAnswer

    Subtract $(1197){10}$ from $(1234){10}$ using the 999's complement and 10's complement methods. [5]

    Subtraction Using 9's and 10's Complement Methods

    "Subtract $(1197){10}$ from $(1234){10}$" means the minuend is 1234 and the subtrahend is 1197, so the value wanted is $1234 - 1197$. Both numbers have four digits, so every complement below is taken to four digits.

    9's complement method

    The 9's complement of the subtrahend is found by subtracting each digit from 9:

    $$9999 - 1197 = 8802$$

    Adding this to the minuend replaces the subtraction:

    $$1234 + 8802 = 10036$$

      1 2 3 4
    + 8 8 0 2
    ---------
    1 0 0 3 6   (carry out of the most significant digit)
    

    A carry out of the most significant digit tells us the result is positive. In the 9's complement method that carry is not simply discarded: it is added back into the least significant digit, which is why the rule is called the end around carry.

    $$0036 + 1 = 0037$$

    Therefore $1234 - 1197 = +37$.

    10's complement method

    The 10's complement is one more than the 9's complement:

    $$8802 + 1 = 8803$$

    $$1234 + 8803 = 10037$$

      1 2 3 4
    + 8 8 0 3
    ---------
    1 0 0 3 7   (carry out of the most significant digit)
    

    Here the carry is simply discarded rather than added back, because the extra 1 has already been built into the complement. What remains is the answer directly.

    Therefore $1234 - 1197 = +37$, agreeing with the 9's complement method and with ordinary decimal subtraction.

    Summary

    MethodComplement of 1197SumCarry out?Handling of the carryResult
    9's complement880210036YesAdded back to the least significant digit$+37$
    10's complement880310037YesDiscarded$+37$

    Had the operands been the other way round, $1197 - 1234$, no carry would have been produced, and the rule for that case is to recomplement the sum and attach a minus sign, which gives $-37$.

  7. 75 marksMemory hierarchy in computer systemsAnswer

    Explain about memory hierarchy in computer system. [5]

    Memory hierarchy is an organization of different types of memory storage in a computer system, arranged in levels based on speed, cost, and capacity. The fundamental idea is that faster memory is more expensive and smaller in size, while...

  8. 85 marksFETCH operation microprogramAnswer

    Write symbolic microprogram for FETCH operation. [5]

    The FETCH cycle (also called the instruction fetch cycle) is the first phase of every instruction execution. It retrieves the instruction from memory at the address pointed to by the Program Counter (PC) and loads it into the Instruction...

  9. 95 marksPipelining hazards and solutionsAnswer

    What are different pipelining hazards? Explain along with their solution. [5]

    Pipelining Hazards

    Definition

    Pipelining hazards are situations that prevent the next instruction in the instruction stream from executing during its designated clock cycle, causing the pipeline to stall.


    Types of Pipelining Hazards

    1. Structural Hazards

    Definition: Arise when the hardware cannot support all possible combinations of instructions in simultaneous overlapped execution (resource conflict).

    Example: Two instructions needing the same memory unit or ALU at the same time.

    IF  ID  EX  MEM  WB
        IF  ID  EX   MEM  WB
                     ^
             Both need memory at same time --> CONFLICT
    

    Solutions:

    • Resource duplication: Use separate instruction memory and data memory (Harvard architecture).
    • Pipeline stalling (bubble insertion): Insert a NOP (no-operation) cycle to delay one instruction.

    2. Data Hazards

    Definition: Arise when an instruction depends on the result of a previous instruction that has not yet completed execution.

    Types:

    TypeDescription
    RAW (Read After Write)Instruction reads a register before a previous instruction writes to it (most common)
    WAR (Write After Read)Instruction writes before a previous one reads
    WAW (Write After Write)Two instructions write to the same register out of order

    Example (RAW):

    ADD R1, R2, R3    ; writes R1
    SUB R4, R1, R5    ; reads R1 -- hazard!
    

    Solutions:

    • Forwarding (Data Bypassing): Route the result directly from the output of one stage to the input of another without waiting for WB stage.
    • Pipeline Stalling / Bubbles: Insert NOP cycles (stall) until the required data is available.
    • Compiler-based reordering: Reorder instructions so that independent instructions fill the delay slots.

    3. Control Hazards (Branch Hazards)

    Definition: Arise due to branch instructions (conditional/unconditional jumps). The pipeline fetches the next sequential instruction before knowing whether a branch is taken, causing incorrect instructions to enter the pipeline.

    Example:

    BEQ R1, R2, LABEL   ; branch instruction
    ADD R3, R4, R5      ; fetched but may not be needed
    

    Solutions:

    • Branch Prediction: Predict whether a branch will be taken (static or dynamic) and fetch accordingly.
      • Static: Always predict taken or always predict not taken.
      • Dynamic: Use a branch history table (BHT) to predict based on past behavior.
    • Delayed Branching: Execute one or more instructions after the branch (delay slot) that are independent of the branch outcome.
    • Flushing the Pipeline: If a wrong instruction is fetched, flush (discard) it and fetch the correct one (costly but correct).
    • Branch Target Buffer (BTB): Cache the target address of branches to reduce delay.

    Summary Table

    HazardCauseSolution
    StructuralResource conflictResource duplication, stalling
    Data (RAW/WAR/WAW)Data dependencyForwarding, stalling, instruction reordering
    ControlBranch instructionsBranch prediction, delayed branching, flushing

    Key Point: Hazards reduce pipeline efficiency. The goal of all solutions is to minimize CPI (Cycles Per Instruction) and keep the pipeline as full as possible.

  10. 105 marksFlag types and functionsAnswer

    Explain all the flags in 8085 microprocessor. [5]

    The 8085 microprocessor contains a special 8-bit register called the Flag Register (also called Program Status Word). It contains 5 flags that reflect the status of the result after arithmetic and logical operations. --- - Set to 1 if th...

  11. 115 marksDMA controller role and operationAnswer

    Explain the role of DMA controller in DMA operation. [5]

    Direct Memory Access (DMA) is a technique that allows I/O devices to transfer data directly to/from main memory without involving the CPU for each byte/word of the transfer. The component that manages this process is the DMA Controller. ...

  12. 125 marksMicroprogrammed control unit designAnswer

    Write short notes on: (a) Microprogrammed Control Unit (b) Virtual Memory. [5]

    Short Notes

    (a) Microprogrammed Control Unit

    A Microprogrammed Control Unit is a control unit implementation where the control signals required to execute machine instructions are generated by a program stored in a special high-speed memory called the Control Memory (CM).

    Key Concepts

    • Proposed by Maurice Wilkes (1951).
    • Each machine instruction is interpreted by a sequence of microinstructions stored in control memory.
    • A microinstruction specifies the control signals to be activated during one clock cycle.
    • A sequence of microinstructions for one machine instruction is called a microprogram or microcode.

    Components

    ComponentFunction
    Control Memory (CM)Stores microprograms (ROM)
    Control Address Register (CAR)Holds address of next microinstruction
    Control Data Register (CDR)Holds the current microinstruction being executed
    SequencerDetermines the next microinstruction address

    Working

    1. Machine instruction is fetched and decoded.
    2. The opcode maps to a starting address in control memory.
    3. Microinstructions are fetched sequentially, generating control signals.
    4. Execution continues until the microprogram for that instruction completes.

    Advantages

    • Easy to design and modify (change microcode instead of hardware).
    • Flexible and less error-prone than hardwired control.

    Disadvantage

    • Slower than hardwired control due to memory access overhead.

    (b) Virtual Memory

    Virtual Memory is a memory management technique that allows a computer to use more memory than is physically available (RAM) by using a portion of secondary storage (hard disk) as an extension of main memory.

    Key Concepts

    • Programs are given the illusion of a large, contiguous address space called the virtual address space.
    • Only the actively used portions of a program need to reside in physical memory at any time.
    • The rest resides on disk in a swap space or page file.

    How It Works

    • The virtual address space is divided into fixed-size blocks called pages.
    • Physical memory is divided into frames of the same size.
    • A Page Table maps virtual page numbers to physical frame numbers.
    • When a referenced page is not in physical memory, a page fault occurs, and the OS loads the required page from disk.

    Address Translation

    Virtual Address --> [Page Table] --> Physical Address
      (Page No. + Offset)               (Frame No. + Offset)
    

    Benefits

    BenefitDescription
    Larger address spacePrograms can be larger than physical RAM
    MultiprogrammingMore processes can run simultaneously
    Memory isolationEach process has its own virtual address space
    Simplified programmingProgrammer need not manage physical memory

    Disadvantage

    • Thrashing: If too many page faults occur, the system spends more time swapping than executing, severely degrading performance.