CSC213 · TU past paper
Computer Architecture 2078 question paper
The complete TU 2078 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.
- Q1.10 marksSequencerHideAnswer
Differentiate between hardwired and microprogrammed control unit. Describe with example of microprogram sequencer used in microprogrammed control unit.[10]
- Q2.10 marksAddressing ModesHideAnswer
Explain the various types of addressing modes and compare them algorithm, advantage and disadvantage.[10]
- Q3.10 marksNumericalDivision of Signed magnitude DataHideAnswer
Explain the non-restoring division algorithm with flow chart, and hardware implementation diagram. Divide 10/3 using restoring division.[10]
Non-Restoring Division Algorithm and Restoring Division Example
1. Non-Restoring Division Algorithm
In restoring division, after subtracting the divisor, if the partial remainder becomes negative, the divisor is added back (restored). This wastes an operation.
In non-restoring division, we do NOT restore. Instead, we keep the negative remainder and adjust in the next step:
- If A is positive (or zero): shift left, then subtract B.
- If A is negative: shift left, then add B.
The quotient bit is set based on the sign of A after the operation.
Algorithm Steps
Let
A= accumulator (initially 0),Q= dividend,B= divisor,SC = n.- Initialize
A = 0, load Q with dividend, B with divisor,SC = n. - If sign of A = 0: Shift left AQ, then
A = A - B. If sign of A = 1: Shift left AQ, thenA = A + B. - If sign of A = 0: set
Q[0] = 1. Else setQ[0] = 0. - Decrement SC. If SC ≠0, go to step 2.
- At end, if A is negative, restore once:
A = A + B. - Quotient in Q, Remainder in A.
2. Flowchart
START | A=0, load Q=Dividend, B=Divisor, SC=n | +------> Shift left AQ | | | sign of A = 0 ? | / \ | YES NO | | | | A = A - B A = A + B | \ / | sign of A = 0 ? | / \ | YES NO | Q[0]=1 Q[0]=0 | \ / | SC = SC - 1 | | | SC = 0 ? | / \ +----NO YES | sign of A = 1 ? / \ YES NO A = A + B | \ / Quotient=Q, Remainder=A | STOP
3. Hardware Implementation Diagram
+-----------+ +-----------+ | B Register| | Complementer/ | (Divisor) |-->| Adder | +-----------+ +------+-----+ | +----------------+ v +-----------+-----------+ shift left | A (acc) | Q (Qtnt)| <------------- +-----+-----+-----------+ | sign bit (MSB of A) | v +-----------------+ +-------------+ | Control Logic |<--->| Sequence | | (Add / Subtract)| | Counter SC | +-----------------+ +-------------+Components: A register (n+1 bits, partial remainder), Q register (holds dividend then quotient), B register (divisor), parallel adder/subtractor with complementer, sign flip-flop, sequence counter SC, and control logic that selects add or subtract based on the sign of A.
4. Divide 10 / 3 using Restoring Division
Given data:
- Dividend = 10
- Divisor = 3
Binary representation (4 bits):
- Dividend $Q = 1010$ (10)
- Divisor $B = 0011$ (3)
- $n = 4$
- $A = 00000$ (initially 0, using 5-bit A to hold sign)
- $-B = 11101$ (2's complement of 00011)
The restoring method: shift left AQ, subtract B. If A < 0, set Q[0]=0 and restore (add B back); else set Q[0]=1.
Step Operation A Q Action Init 00000 1010 SC = 4 1 Shift left AQ 00001 010_ A = A - B 11110 0100 A<0, restore: Q[0]=0 Restore A=A+B 00001 0100 2 Shift left AQ 00010 100_ A = A - B 11111 1000 A<0, restore: Q[0]=0 Restore A=A+B 00010 1000 3 Shift left AQ 00101 000_ A = A - B 00010 0001 A≥0, Q[0]=1 4 Shift left AQ 00100 010_ A = A - B 00001 0011 A≥0, Q[0]=1 After 4 iterations:
- Quotient $Q = 0011 = 3$
- Remainder $A = 00001 = 1$
Verification: $10 = 3 \times 3 + 1$ ✓
Final Result
$$\boxed{\text{Quotient} = 3, \quad \text{Remainder} = 1}$$
- Q4.5 marksCommon Bus System for Basic ComputerHideAnswer
Explain the bus interconnection scheme with diagram. [5]
- Q5.5 marksInstruction FormatsHideAnswer
What do you mean by instruction format? Explain with an example. [5]
Instruction Format
Definition
An instruction format defines the layout or structure of a binary instruction stored in memory. It specifies how the bits of an instruction are divided into different fields, each carrying specific information needed by the CPU to execute that instruction.
The simplest way to organize a computer is to have a single processor register called the accumulator, and an instruction format with two parts:
- First part (Opcode field): Specifies the operation to be performed (e.g., ADD, SUB, LOAD, STORE).
- Second part (Address field): Specifies the memory address where the operand is located, i.e., tells the control unit where to find the operand in memory.
General Structure of an Instruction Format
+------------------+----------------------+ | Opcode (bits) | Address (bits) | +------------------+----------------------+
Example: Basic Computer Instruction Format (16-bit)
In a basic computer, each instruction is 16 bits long, organized as follows:
Bit position: 15 14 13 12 11 10 9 ... 0 +-------+---+---+-------+---+---+-------+ | I | Opcode (3) | Address (12) | +-------+---+---+-------+---+---+-------+Field Bits Purpose I (Indirect bit) Bit 15 Indicates direct (0) or indirect (1) addressing Opcode Bits 12 to 14 Specifies the operation (3 bits = 8 possible operations) Address Bits 0 to 11 Specifies the memory address of the operand (12 bits = 4096 locations)
How It Works During Fetch and Decode
According to the fetch-decode cycle:
- T0:
AR <- PC(Address Register gets the Program Counter value) - T1:
IR <- M[AR], PC <- PC + 1(Instruction is fetched from memory into Instruction Register) - T2:
Decode IR(12-14), AR <- IR(0-11), I <- IR(15)(Opcode bits 12-14 are decoded; address bits 0-11 are loaded into AR; indirect bit is noted)
Example Instruction
Suppose a 16-bit instruction is:
0 001 000000000101 ^ ^ ^ I Opcode Address (5)- I = 0 → Direct addressing
- Opcode = 001 → Could represent an ADD operation
- Address = 5 → Operand is located at memory address 5
This means: "Add the value stored at memory location 5 to the accumulator directly."
Summary
Instruction format is essential because it tells the CPU what to do (opcode) and where to find the data (address). The design of the instruction format directly affects the number of operations supported and the size of addressable memory.
- Q6.5 marksData Transfer and manipulationHideAnswer
Explain the data transfer instructions with example. [5]
- Q7.5 marksSymbolic MicroinstructionsHideAnswer
Explain the symbolic microinstruction with example. [5]
- Q8.5 marksInstruction Level PipeliningHideAnswer
Explain an instruction pipeline with an example. [5]
- Q9.5 marksBooth MultiplicationHideAnswer
Explain the Booth Multiplication algorithm with example. [5]
- Q10.5 marksCache MemoryHideAnswer
What are the advantage and disadvantage of direct mapping and associative mapping between cache and main memory? [5]
- Q11.5 marksDirect Memory Access, Input-Output ProcessHideAnswer
What are the major differentiate between Input-output processor (IOP) and direct memory Access (DMA) [5]
Differences Between Input-Output Processor (IOP) and Direct Memory Access (DMA)
Brief Introduction
DMA (Direct Memory Access) is a data transfer mechanism between memory and I/O devices controlled by an external DMA controller circuit, without CPU involvement during the actual transfer.
IOP (Input-Output Processor) is a more advanced processor with direct memory access capability that can execute its own channel programs stored in main memory, communicating independently with I/O devices.
Major Differences
Feature DMA IOP Intelligence / Capability A simple controller circuit; can only transfer data between memory and I/O devices A full processor; can execute a set of instructions called a channel program stored in main memory Program Execution Cannot execute programs; only performs data transfer operations Can execute a channel program independently once initiated by the CPU CPU Involvement CPU must set up the DMA controller (source, destination, count) before each transfer CPU only issues a channel I/O class instruction to initiate; after that, IOP operates completely independently Bus Control Method Uses HOLD/HLDA signals (Bus Request BR and Bus Grant BG) to take control of the bus from the CPU Accesses memory using cycle stealing, without fully taking over the bus Complexity Simpler in design and functionality More complex; essentially a dedicated I/O processor Flexibility Limited to simple block data transfers Highly flexible; can handle complex I/O operations through programmable channel programs Interaction with CPU Interrupts CPU via HOLD line; CPU places buses in high impedance state during burst transfer or cycle stealing Once initiated, the channel (IOP) operates independently of the CPU with minimal interruption Transfer Modes Supports Burst Transfer and Cycle Stealing Primarily uses Cycle Stealing to access main memory Use Case Suitable for simple, high-speed bulk data transfers (e.g., hard disk to memory) Suitable for managing multiple, complex I/O devices simultaneously
Summary
DMA is a hardware controller that temporarily takes over the system bus to transfer data directly between memory and I/O without CPU processing. IOP is a dedicated processor that goes further by executing its own channel programs stored in memory, managing I/O operations fully independently after a single initiation command from the CPU. IOP is therefore a superset of DMA functionality.
- Q12.5 marksParallel ProcessingHideAnswer
Draw a three dimensional hypercube and explain with example. [5]