Skip to main content

Chapter 2

Computer Architecture

TU BSc CSIT past exam questions

Past questions and answers

72 questions set from this chapter. Most repeated first.

  • 2079 · 5 marks

Explain common bus system for basic computer.

Similar questions: Explain common bus system of basic computer (2081)

Answer

Common bus system. In the basic computer, the registers and memory are connected through a single common bus of 16 lines, so that any register can send data to any other by using one shared set of wires. Only one source can drive the bus at any time. The source is chosen by a bus selector built from 16 multiplexers (4-to-1 style, 8 inputs), controlled by the select lines S2S1S0S_2S_1S_0.

S2S1S0S_2S_1S_0Register placed on the bus
000none
001AR (address register, 12 bits)
010PC (program counter, 12 bits)
011DR (data register)
100AC (accumulator)
101IR (instruction register)
110TR (temporary register)
111Memory (4096 x 16)

Diagram:

        +------------- 16-bit common bus --------------+
        |    |     |     |     |     |     |      |    |
       MEM   AR    PC    DR    AC    IR    TR   INPR  OUTR
      (111) (001) (010) (011) (100) (101) (110)
        ^ select by S2 S1 S0 (bus selector / multiplexers)

Operation:

  • The bus selector places the contents of the selected register on the bus.
  • A destination register receives the data when its LD (load) control is 11 at the clock edge. Registers also have INR (increment) and CLR (clear) inputs.
  • The 12-bit registers AR and PC use the lower 12 bits of the bus; the memory address is always taken from AR.
  • Memory read: DR←M[AR]DR\leftarrow M[AR] puts memory on the bus (S2S1S0=111S_2S_1S_0=111) and loads DR. Memory write: M[AR]←DRM[AR]\leftarrow DR with DR on the bus.
  • Example AR←PCAR\leftarrow PC: S2S1S0=010S_2S_1S_0=010 and LD of AR =1=1.
  • The adder and logic unit takes AC and DR as inputs and its output goes to AC; the output of AC is also an input to the bus.

Advantage: fewer connections than separate paths between every pair of registers. Disadvantage: one transfer at a time over the bus.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Write the program for the following statement using three, single, zero address instructions. X = (AB+C-D) / (E+FG)

Similar questions: Write the program for following statement by (2080)

Answer

Statement: X=(A⋅B+C−D)/(E+F⋅G)X=(A\cdot B+C-D)/(E+F\cdot G)

(a) Three-address instructions (OP dest, src1, src2):

MUL R1, A, B      ; R1 = A*B
ADD R1, R1, C     ; R1 = A*B + C
SUB R1, R1, D     ; R1 = A*B + C - D
MUL R2, F, G      ; R2 = F*G
ADD R2, R2, E     ; R2 = E + F*G
DIV X, R1, R2     ; X = R1 / R2

(b) Single-address (accumulator) instructions (AC is the implied operand):

LOAD  F           ; AC = F
MUL   G           ; AC = F*G
ADD   E           ; AC = E + F*G
STORE T           ; T = E + F*G
LOAD  A           ; AC = A
MUL   B           ; AC = A*B
ADD   C           ; AC = A*B + C
SUB   D           ; AC = A*B + C - D
DIV   T           ; AC = (A*B+C-D) / T
STORE X           ; X = AC

(c) Zero-address (stack) instructions (operands are on the stack, the operation uses the top elements):

PUSH A
PUSH B
MUL               ; A*B
PUSH C
ADD               ; A*B + C
PUSH D
SUB               ; A*B + C - D
PUSH E
PUSH F
PUSH G
MUL               ; F*G
ADD               ; E + F*G
DIV               ; (A*B+C-D) / (E+F*G)
POP  X

This is the evaluation of the reverse Polish form AB∗C+D−EFG∗+/AB*C+D-EFG*+/.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Write the program for following statement by using three, single, zero address instructions. X = (A+BC-D)/(EF+G)

Similar questions: Write the program for the following statement (2079)

Answer

Evaluate X=A+B×C−DE×F+GX = \dfrac{A + B \times C - D}{E \times F + G}. The numerator is A+(B×C)−DA + (B \times C) - D and the denominator is (E×F)+G(E \times F) + G.

(a) Three-address instructions (each instruction OP dest, src1, src2). Temporary registers R1 and R2 are used.

MUL R1, B, C      ; R1 = B*C
ADD R1, R1, A     ; R1 = A + B*C
SUB R1, R1, D     ; R1 = A + B*C - D
MUL R2, E, F      ; R2 = E*F
ADD R2, R2, G     ; R2 = E*F + G
DIV X, R1, R2     ; X = R1 / R2

(b) Single-address (accumulator) instructions. One operand is in memory, the other is the accumulator AC. T is a temporary memory location.

LOAD  B        ; AC = B
MUL   C        ; AC = B*C
ADD   A        ; AC = A + B*C
SUB   D        ; AC = A + B*C - D
STORE T        ; T = numerator
LOAD  E        ; AC = E
MUL   F        ; AC = E*F
ADD   G        ; AC = E*F + G
STORE U        ; U = denominator
LOAD  T        ; AC = numerator
DIV   U        ; AC = numerator / denominator
STORE X        ; X = AC

(c) Zero-address (stack) instructions. Operations take their operands from the top of the stack. The expression is converted to reverse Polish notation: A B C ∗ + D − E F ∗ G + /A\,B\,C\,*\,+\,D\,-\,E\,F\,*\,G\,+\,/.

PUSH A
PUSH B
PUSH C
MUL          ; B*C
ADD          ; A + B*C
PUSH D
SUB          ; A + B*C - D
PUSH E
PUSH F
MUL          ; E*F
PUSH G
ADD          ; E*F + G
DIV          ; (A+B*C-D) / (E*F+G)
POP X

The three-address program is shortest (6 instructions) but each instruction is long; the stack program has the shortest instructions but needs the most (14).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Explain common bus system of basic computer with a diagram.

Similar questions: Explain common bus system for basic computer (2079)

Answer

Common bus system. The basic computer has registers (AR, PC, DR, AC, IR, TR), a memory unit with 4096 words of 16 bits, and the INPR/OUTR registers. For data to move between them, instead of a dedicated path for each pair, a single shared common bus is used. The bus is 16 bits wide, and only one register or memory output can place data on it at one time.

Selection of the source. Three select lines S2S1S0S_2S_1S_0 drive a multiplexer (or three-state buffers) that picks the source:

S2S1S0S_2S_1S_0Register placed on bus
000none
001AR
010PC
011DR
100AC
101IR
110TR
111Memory

Diagram (description).

              +------------------------------+
   S2 S1 S0 ->|  16-bit common bus (mux)     |
              +--^---^---^---^---^---^---^---+
                 |   |   |   |   |   |   |
              Memory AR  PC  DR  AC  IR  TR
              (111) (001)(010)(011)(100)(101)(110)
   Each register has LD (load), INR (increment), CLR (clear).
   AR, PC and the memory address use the 12 low-order bits; 
   AC <-> ALU <-> DR; INPR -> ALU; AC -> OUTR.

Operation.

  • The source register is selected by S2S1S0S_2S_1S_0; its contents go on the bus.
  • The destination register has its LD (load) input enabled and takes the bus contents at the next clock pulse. Several registers may load the same bus value at once.
  • The address register AR (12 bits) supplies the memory address; the memory read/write is controlled by Read/Write signals, and data passes through the bus.
  • PC and DR may be incremented (INR) or cleared (CLR); AC takes input from the adder/logic circuit (ALU) which combines AC and DR, as well as INPR.
  • The 12-bit contents of AR and PC are placed in the low-order 12 bits of the bus (the top four bits are 0), and IR sends the 12-bit address field to the bus.

Example: AR←PCAR \leftarrow PC sets S2S1S0=010S_2S_1S_0 = 010 and enables LD of AR. The memory read DR←M[AR]DR \leftarrow M[AR] sets S2S1S0=111S_2S_1S_0 = 111 and enables LD of DR.

Benefits: fewer connections and lower cost. Drawback: only one transfer can happen per clock cycle.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 10 marks

In the RISC architecture, what is meant by over lapping register window? Explain the relationship among register windows with over lapping register windows.

Answer

Overlapping register windows. In a RISC processor (e.g. Berkeley RISC, SPARC) a large bank of registers is divided into small windows, one per procedure. Procedure calls are very frequent in high-level programs, and saving and restoring registers to memory on every call/return is slow. With register windows, a call simply switches to a new window instead of pushing registers on the stack. The windows are overlapped: the registers at the end of one window are physically the same registers as those at the start of the next window, so parameters can be passed without copying.

Organisation of each window. Every window consists of:

  • Local registers: used only by that procedure for its local variables and temporaries.
  • High (input) registers: shared with the calling procedure; they receive the parameters passed by the caller and hold values returned to it.
  • Low (output) registers: shared with the called procedure; the procedure puts parameters for the next call here.
  • A few global registers, visible to all procedures.

Relationship among windows. For procedures A, B and C where A calls B and B calls C:

  • The low (output) registers of A's window are the same physical registers as the high (input) registers of B's window.
  • The low registers of B are the high registers of C.
  • Local registers of each window are private and never shared.

Example (Berkeley RISC, 74 registers): 10 global registers R0-R9; 64 registers in windows. Each window has 10 local registers, 6 high (input), 6 low (output), so a window has 22 registers visible, and 16 physical registers are shared between adjacent windows. With 4 windows, the total is 4×(10+6)=644\times(10+6)=64 window registers (the windows form a circular buffer, so the last window overlaps the first).

 window A:  [ high_A | local_A | low_A ]
                                  ||  (same physical registers)
 window B:                 [ high_B | local_B | low_B ]
                                                 ||
 window C:                                [ high_C | local_C | low_C ]

Operation. On a call, the current window pointer (CWP) moves to the next window, so the caller's low registers instantly become the callee's high registers. On return, CWP moves back and the results left in the callee's high registers are seen by the caller as its low registers. If the nesting depth exceeds the number of windows, the oldest window is saved to memory (window overflow) and brought back on underflow. Advantages: fast procedure call/return, no parameter copying, fewer memory references.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 10 marks

Explain the Flynn’s classification of computer architectures with diagrams.

Answer

Flynn's classification. Michael Flynn (1966) classified computer architectures by the number of instruction streams and data streams that are processed simultaneously, giving four classes.

1. SISD (Single Instruction, Single Data). A conventional uniprocessor. One control unit fetches one instruction at a time and one processing unit operates on one data item at a time. Example: classic von Neumann machines, older PCs. Pipelining or a superscalar design may overlap instructions but the model is still SISD.

 IS            IS          DS
 CU ---------> PU <------> Memory

2. SIMD (Single Instruction, Multiple Data). One control unit broadcasts the same instruction to many processing elements, each working on its own data in lock-step. Suited to regular data-parallel work such as vector/matrix operations and image processing. Examples: array processors, vector processors, GPUs, MMX/SSE extensions.

                  +--> PU1 <--> Memory 1
 CU --- IS ------>+--> PU2 <--> Memory 2
                  +--> PUn <--> Memory n

3. MISD (Multiple Instruction, Single Data). Several processing units each execute a different instruction on the same data stream. It is rarely built in practice; examples are fault-tolerant systems executing different programs on the same input for redundancy (space-shuttle flight computers) and sometimes systolic arrays/pipelines.

 CU1 --IS1--> PU1 \
 CU2 --IS2--> PU2  >--- single data stream <--- Memory
 CUn --ISn--> PUn /

4. MIMD (Multiple Instruction, Multiple Data). Multiple processors, each with its own control unit, execute different instructions on different data at the same time. This is the most general and most common parallel model. Examples: multicore processors, multiprocessor servers, clusters and distributed systems. It has two forms:

  • Shared-memory (tightly coupled) multiprocessors, all CPUs access a common memory.
  • Distributed-memory (loosely coupled) multicomputers, each CPU has local memory and communicates by message passing.
 CU1 -IS1-> PU1 <-DS1-> Memory 1 \
 CU2 -IS2-> PU2 <-DS2-> Memory 2  >-- interconnection network
 CUn -ISn-> PUn <-DSn-> Memory n /
ClassInstruction streamsData streamsExample
SISD11Single-core CPU
SIMD1manyVector processor, GPU
MISDmany1Fault-tolerant redundant systems
MIMDmanymanyMulticore, clusters

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 10 marks

What are the different types of pipe line hazards? Explain each pipe line hazard with example.

Answer

Pipeline hazards. A hazard is a situation that prevents the next instruction in the pipeline from executing in its designated clock cycle, causing a stall (bubble) and reducing throughput. There are three types.

1. Structural hazards. Two instructions need the same hardware resource at the same time, and the resource cannot serve both.

Example: with a single memory shared for instructions and data, a LOAD instruction in its memory-access (MEM) stage conflicts with the instruction fetch (IF) of a later instruction in the same cycle. One must wait a cycle.

Cycle123456
LOADIFIDEXMEMWB
I2IFIDEXMEMWB
I3IFIDEXMEM
I4IF (conflict with LOAD MEM)

Remedy: separate instruction and data memories (caches), duplicate or pipeline the functional units, or stall.

2. Data hazards. An instruction depends on the result of a previous instruction that is not yet complete. Types:

  • RAW (read after write, true dependence): I2 reads a register before I1 has written it.
ADD R1, R2, R3     ; writes R1 in WB (cycle 5)
SUB R4, R1, R5     ; reads R1 in ID (cycle 3): stale value
  • WAR (write after read, anti-dependence): a later instruction writes a register before an earlier instruction has read it (occurs when instructions are reordered).
  • WAW (write after write, output dependence): two instructions write the same register and the writes complete in the wrong order.

Remedies: operand forwarding (bypassing) passes the ALU result straight to the next instruction's input; stalling/inserting NOPs (pipeline interlock); compiler instruction scheduling; register renaming (for WAR/WAW).

3. Control (branch) hazards. A branch or jump changes the program counter, so the instructions fetched after the branch may be the wrong ones, and the target is not known until the branch is decoded or executed.

Example:

      BEQ R1, R2, LABEL    ; outcome known in EX/MEM stage
      ADD R3, R4, R5       ; fetched, but may need to be discarded
      ...
LABEL: SUB R6, R7, R8

If the branch is taken, the instructions already fetched behind it must be flushed, costing 1-3 cycles.

Remedies: branch prediction (static or dynamic with a branch history table), delayed branch (the compiler fills the delay slot with a useful instruction), branch target buffer, early branch resolution in the decode stage, and prefetching both paths.

Summary: structural hazards come from resource conflicts, data hazards from dependences between instructions, and control hazards from changes in the instruction flow.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Explain the computer components.

Answer

A computer system consists of hardware components that work together under a program. The basic components are as follows.

1. Central Processing Unit (CPU). It fetches, decodes and executes instructions. It contains:

  • Arithmetic Logic Unit (ALU): performs arithmetic (add, subtract) and logical (AND, OR, compare, shift) operations.
  • Control Unit (CU): generates timing and control signals that direct the other components and sequence the instruction cycle.
  • Registers: small, very fast storage inside the CPU, such as the program counter (PC), instruction register (IR), memory address register (MAR), memory buffer register (MBR) and accumulator.

2. Main memory. Stores the programs and data currently in use. It is divided into addressable locations. RAM is volatile and read/write; ROM holds permanent start-up code. The CPU transfers data using MAR and MBR.

3. Input/Output (I/O) devices and modules. Input devices (keyboard, mouse, scanner) bring data in; output devices (monitor, printer) deliver results. I/O modules interface the devices to the system, handling speed and format differences, using programmed I/O, interrupts or DMA.

4. Secondary storage. Hard disk, SSD and optical media provide large, permanent (non-volatile) storage at lower speed.

5. System bus (interconnection). The shared pathways that carry information between components: the data bus (data transfer), address bus (location of memory/I/O) and control bus (read/write, interrupt, clock signals).

       +-----------------+
       |  CPU (ALU, CU,  |
       |   registers)    |
       +--------+--------+
                | system bus (data, address, control)
     +----------+-----------+
     |                      |
 Main memory           I/O modules ---> devices

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Explain the store-program concept with example.

Answer

Stored-program concept. The idea, proposed by John von Neumann (and used in the IAS machine), is that the instructions of a program and its data are stored together in the same main memory in binary form. The CPU reads instructions from memory one after another, and decodes and executes them. Earlier machines (such as ENIAC) were programmed by rewiring or setting switches, which was slow and error-prone; with a stored program the machine is reprogrammed simply by loading different contents into memory.

Key features

  • A single read/write memory holds both instructions and data, addressed by location.
  • Instructions are executed sequentially unless a branch changes the flow; the program counter (PC) holds the address of the next instruction.
  • Instructions can be treated as data, so a program can be loaded, modified or generated by another program (compilers, loaders, operating systems).
  • The processor repeatedly performs the fetch-decode-execute cycle.

Example. Computing C=A+BC=A+B, with AA at address 100, BB at 101 and CC at 102, program stored at addresses 0-3:

AddressContentMeaning
0LOAD 100AC ←\leftarrow M[100] (A)
1ADD 101AC ←\leftarrow AC + M[101] (B)
2STORE 102M[102] ←\leftarrow AC
3HALTstop
1005data A
1017data B
102?result C

Execution: PC=0, the CPU fetches LOAD 100 into IR via MAR/MBR, increments PC, decodes, and loads 5 into the accumulator. Next it fetches ADD 101, giving AC = 12. Then STORE 102 writes 12 into location 102. Finally HALT stops the machine. The instructions and the data lie in the same memory.

The shared path between CPU and memory limits speed (the von Neumann bottleneck).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Differentiate between CISC and RISC architectures.

Answer

CISC (Complex Instruction Set Computer) and RISC (Reduced Instruction Set Computer) are two design philosophies for the instruction set of a processor.

BasisCISCRISC
Instruction setLarge (100 to 300+ instructions), many complex onesSmall, simple, mostly single-operation instructions
Instruction formatVariable lengthFixed length (usually 32 bit)
Execution timeInstructions take multiple clock cyclesMost instructions complete in one cycle
Addressing modesMany (10 or more)Few (typically 3 to 5)
Memory accessAny instruction may operate on memoryOnly LOAD and STORE access memory (load/store architecture)
Control unitMostly microprogrammedMostly hardwired
RegistersFew general purpose registersLarge register file (often with register windows)
PipeliningDifficult and less efficientEasy and highly efficient
Code sizeSmall programs, less memoryLarger programs, more instructions
ComplexityComplexity is in hardwareComplexity is moved to the compiler
ExamplesIntel x86, VAX, Motorola 68000ARM, MIPS, SPARC, PowerPC

In short, CISC tries to reduce the number of instructions per program, while RISC reduces the number of cycles per instruction.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Differentiate between instruction pipeline and an arithmetic pipeline.

Answer

Pipelining divides a task into sub-tasks handled by separate segments that work in parallel on different tasks. The two main types are the instruction pipeline and the arithmetic pipeline.

BasisInstruction pipelineArithmetic pipeline
PurposeOverlaps the phases of instruction executionOverlaps the stages of a single arithmetic operation
Where usedIn the CPU control path, for all instructionsIn the ALU or floating-point unit
StagesFetch, decode, operand fetch, execute, write backe.g. for floating-point addition: compare exponents, align mantissas, add mantissas, normalise
Data handledStream of different instructionsStream of operand pairs for the same kind of operation
HazardsStructural, data and control (branch) hazardsHazards are fewer; mainly stage delays and rounding
Typical useGeneral purpose processorsVector and scientific processors (e.g. Cray, floating-point units)
ComplexityNeeds hazard detection, forwarding and branch predictionNeeds registers between the stages and balanced stage delays

Example (arithmetic pipeline). Floating-point addition of X=A×2aX=A\times 2^{a} and Y=B×2bY=B\times 2^{b} is split into four segments: (1) compare exponents, (2) align mantissa of the smaller number, (3) add mantissas, (4) normalise the result. While one pair is being normalised, the next pair is already in the addition stage.

Example (instruction pipeline). While instruction I1I_1 is being executed, I2I_2 is being decoded and I3I_3 is being fetched.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Divide 10/4 using non-restoring division.

Answer

Non-restoring division. The dividend is Q=10=10102Q=10=1010_2, the divisor is M=4=01002M=4=0100_2, the accumulator is A=0000A=0000 and the count is n=4n=4 bits.

Rule for each cycle:

  • If A≥0A\ge 0: shift AQAQ left one bit, then A←A−MA\leftarrow A-M.
  • If A<0A<0: shift AQAQ left one bit, then A←A+MA\leftarrow A+M.
  • If the new A≥0A\ge 0 set q0=1q_0=1, otherwise set q0=0q_0=0.

After nn cycles, if A<0A<0 perform a final correction A←A+MA\leftarrow A+M.

CycleOperationAAQQ
Initial00001010
1shift left, A≥0A\ge0 so A−MA-M0001 → 1101010_ → 0100 (A<0A<0, q0=0q_0=0)
2shift left, A<0A<0 so A+MA+M1010 → 1110100_ → 1000 (A<0A<0, q0=0q_0=0)
3shift left, A<0A<0 so A+MA+M1101 → 0001000_ → 0001 (A≥0A\ge0, q0=1q_0=1)
4shift left, A≥0A\ge0 so A−MA-M0010 → 1110001_ → 0010 (A<0A<0, q0=0q_0=0)
CorrectionA<0A<0 so A+MA+M1110 + 0100 = 00100010

Result: Quotient =Q=00102=2=Q=0010_2=2 and remainder =A=00102=2=A=0010_2=2.

Check: 4×2+2=104\times2+2=10.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Define associative memory. Explain with block diagram how it can be implemented

Answer

Associative memory (content addressable memory, CAM) is a memory in which a word is located by its content rather than by its address. A search key is given and the memory compares it with all stored words simultaneously; the words that match are flagged. It is much faster than address-based search because all comparisons happen in parallel in hardware.

Block diagram and working.

            Argument register (A)  ----> n bits
            Key register (K)  --------> mask (which bits to compare)
                    |
                    v
   +-----------------------------------------+      Match register (M)
   |  Associative memory array               |      +----+
   |  m words x n bits                       |----->| M1 |  word 1 matches?
   |  (each cell has compare logic)          |----->| M2 |
   |                                         |----->| .. |
   +-----------------------------------------+      | Mm |
        ^                    |                      +----+
   Input (write)        Output (read)

Components:

  • Argument register A holds the word to be searched.
  • Key register K masks the argument. Only bit positions where K=1K=1 take part in the comparison; where K=0K=0 the bit is ignored.
  • Associative memory array of mm words, each nn bits, where every cell has comparison logic.
  • Match register M has one bit per word. Mi=1M_i=1 if word ii matches the unmasked part of A.

Operation. The argument is placed in A and the mask in K. Every word is compared with A in parallel, the match bits are set in M, and the words with Mi=1M_i=1 are read out (or written for a write operation). For a single bit of cell jj in word ii the match is xj=AjFij+Aj′Fij′x_j=A_jF_{ij}+A_j'F_{ij}' and the word matches if

Mi=∏j=1n(xj+Kj′)M_i=\prod_{j=1}^{n}\left(x_j+K_j'\right)

Uses: cache memory tags, virtual-memory page tables (TLB), and database or routing-table lookup.

Drawback: every cell needs comparison logic, so it is expensive compared to ordinary RAM.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Differentiate between hardwired control unit and a micro programmed control unit.

Answer

The control unit generates the control signals that drive the data path. It can be built in two ways.

BasisHardwired control unitMicroprogrammed control unit
ImplementationFixed logic circuit of gates, flip-flops, decoders and countersControl signals are stored as microinstructions in a control memory (ROM)
Design methodDesigned using state tables and logic minimisationDesigned by writing a microprogram
SpeedFaster, no memory access to produce signalsSlower, a control-memory fetch for each microinstruction
FlexibilityInflexible; changing the instruction set needs redesign of the circuitFlexible; change the microprogram to modify or add instructions
ComplexityVery complex for large instruction sets, hard to testSimple and systematic, even for complex instruction sets
CostCostly to design for large setsCheaper for complex sets but needs control memory
Error correctionDifficultEasy, microprogram can be edited
Typical useRISC processorsCISC processors
Cost of changesHighLow

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

How does DMA controller work? Give an example of DMA data transfer

Answer

Direct Memory Access (DMA) lets an I/O device transfer a block of data directly to or from main memory without passing every word through the CPU. The transfer is managed by a DMA controller.

Structure of the DMA controller. It contains an address register (starting memory address), a word count register (number of words left), a control register (read/write, mode), a data buffer, and request/acknowledge lines (DREQ, DACK, and the bus-request/bus-grant lines BR and BG to the CPU).

Working.

  1. The CPU initialises the DMA controller by writing the memory start address, the word count and the direction (read or write), and then continues with other work.
  2. When the device is ready it raises DREQ. The DMA controller sends a bus request (BR/HOLD) to the CPU.
  3. The CPU finishes its current bus cycle, floats its address, data and control buses and replies with bus grant (BG/HLDA). The DMA controller now controls the bus.
  4. The controller places the address on the address bus, issues the read or write signal, and moves one word between the device and memory. It then increments the address register and decrements the word count.
  5. Steps 3 and 4 repeat until the count reaches zero (burst mode) or one word at a time with the bus returned in between (cycle stealing).
  6. When the count is zero, the controller releases the bus and sends an interrupt to the CPU to say that the transfer is complete.

Example. Reading a 512-byte disk sector into memory starting at address 2000H2000_H: the CPU loads address register =2000H=2000_H, word count =512=512 and direction = write to memory. The disk controller then fills memory by DMA, using cycle stealing, while the CPU runs another program. At the end, the DMA controller interrupts the CPU. The CPU is involved only at the start and at the end, so the transfer is much faster than programmed or interrupt I/O.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2075 · 5 marks

Explain an inter connection network and its use.

Answer

Interconnection network. In a multiprocessor or multicomputer system, an interconnection network is the hardware path that connects processors to memory modules or to other processors so that they can communicate and share data. Its design decides the bandwidth, latency, cost and scalability of the system.

Common types.

  • Time-shared common bus: all units share one bus; cheap but only one transfer at a time.
  • Multiport memory: each memory module has several ports, one per processor; fast but needs many connections.
  • Crossbar switch: a switch at every processor-memory crosspoint; all non-conflicting transfers go in parallel, but cost grows as n2n^2.
  • Multistage switching network (omega network): stages of 2×22\times2 switches; uses n2log⁡2n\tfrac{n}{2}\log_2 n switches, cheaper than a crossbar but may block.
  • Hypercube: 2n2^n nodes, each connected to nn neighbours.
  • Mesh, ring, tree: other static topologies for direct processor-to-processor links.

Uses.

  1. Connecting many processors to shared memory in multiprocessors.
  2. Message passing between nodes in clusters and parallel computers.
  3. Allowing parallel communication and so improving speed.
  4. Providing alternative paths, which gives fault tolerance.
  5. Inside chips as network-on-chip, and in data-centre switches and routers.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 10 marks

What do you mean by pipeline? Explain with space time diagram for a six segmented pipeline showing the time it takes to process eight tasks.

Answer

Pipeline. Pipelining is a technique in which a task is divided into a sequence of sub-tasks, each executed in its own segment (stage), and the segments work simultaneously on different tasks. Each segment output is held in a register that feeds the next segment, and all segments operate under a common clock. It increases throughput; the time for one task is not reduced, but a new task can finish every clock cycle once the pipe is full.

Space-time diagram for k=6k=6 segments and n=8n=8 tasks.

The first task needs kk cycles to leave the pipeline and each following task finishes one cycle later, so the total number of clock cycles is

k+(n−1)=6+(8−1)=13k+(n-1)=6+(8-1)=13

Segment \ Clock12345678910111213
S1T1T2T3T4T5T6T7T8
S2T1T2T3T4T5T6T7T8
S3T1T2T3T4T5T6T7T8
S4T1T2T3T4T5T6T7T8
S5T1T2T3T4T5T6T7T8
S6T1T2T3T4T5T6T7T8

Task T1 completes at clock 6, T2 at 7, and so on until T8 completes at clock 13. So the pipeline needs 13 clock cycles for 8 tasks.

Comparison with a non-pipelined unit. A non-pipelined unit with the same total delay needs n⋅k=8×6=48n\cdot k=8\times6=48 cycles, so

Speedup=nkk+n−1=4813≈3.69\text{Speedup}=\frac{n k}{k+n-1}=\frac{48}{13}\approx3.69

As n→∞n\to\infty the speedup approaches k=6k=6.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 10 marks

Explain Booth multiplication algorithm with hardware implementation diagram. Multiply (-4) x (-3) using Booth multiplication algorithm.

Answer

Booth's multiplication algorithm multiplies two signed numbers in 2's complement form directly. It treats a string of 1s in the multiplier as 2j+1−2i2^{j+1}-2^{i}, so a run of 1s needs only one subtraction at its start and one addition after its end, and it handles signs automatically.

Hardware. The registers are:

  • BR holds the multiplicand MM.
  • AC (initially 0) and QR (multiplier) form a combined register that shifts right.
  • Q−1Q_{-1} is a one-bit flip-flop to the right of QR (initially 0).
  • SC is a sequence counter set to nn, the number of bits.
  • A parallel adder/subtractor combines AC and BR.
  BR (multiplicand) --> [ Parallel adder / subtractor ] <-- AC
                                      |
                       AC -> QR -> Q(-1)   (arithmetic shift right)
                       Control logic examines Q0 and Q(-1), counter SC

Algorithm.

  1. Initialise AC =0=0, Q−1=0Q_{-1}=0, BR == multiplicand, QR == multiplier, SC =n=n.
  2. Examine Q0Q−1Q_0Q_{-1}:
    • 1010: AC ←\leftarrow AC −- BR
    • 0101: AC ←\leftarrow AC ++ BR
    • 0000 or 1111: no operation
  3. Arithmetic shift right the combined AC, QR, Q−1Q_{-1} (the sign bit of AC is kept).
  4. Decrement SC. If SC ≠0\ne0 go to step 2, otherwise stop. The product is in AC:QR.

Example (−4)×(−3)(-4)\times(-3) using 4 bits. M=−4=1100M=-4=1100, −M=0100-M=0100, multiplier Q=−3=1101Q=-3=1101.

StepQ0Q−1Q_0Q_{-1}OperationACQRQ−1Q_{-1}
Initial000011010
110AC −- M =0000+0100=0000+0100010011010
ASR001001101
201AC ++ M =0010+1100=0010+1100111001101
ASR111100110
310AC −- M =1111+0100=1111+0100 (carry ignored)001100110
ASR000110011
411no operation000110011
ASR000011001

Product == AC:QR =0000 11002=+12=0000\,1100_2=+12.

Check: (−4)×(−3)=12(-4)\times(-3)=12.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 10 marks

Define I/O interface. Comparison between programmed I/O, Interrupt driven I/O and direct memory access (DMA).

Answer

I/O interface. An I/O interface is the hardware (and its control logic) that sits between the CPU/system bus and a peripheral device. It resolves the differences in speed, data format, voltage levels and timing between them. Its functions are: address decoding to select the device, buffering of data, status and control signals, converting data between serial and parallel form, and interrupt/DMA handling.

Comparison of the three data transfer techniques.

BasisProgrammed I/OInterrupt-driven I/ODMA
Who controls the transferCPU, through a programCPU, in an interrupt service routineDMA controller
CPU involvementFull; CPU polls the status flag continuously (busy waiting)CPU works until the device interrupts, then transfers each wordOnly to start and to handle the final interrupt
CPU efficiencyPoor, time is wasted in pollingBetter, no pollingBest, CPU is free during transfer
Speed of transferSlowModerateFast (block transfer at memory speed)
Data pathDevice to CPU register to memoryDevice to CPU register to memoryDevice directly to memory
Hardware costLowestModerate (interrupt controller, interrupt lines)Highest (DMA controller)
Overhead per wordPolling and instruction executionContext saving and interrupt latency for each wordNone per word; overhead only per block
Suitable forSimple, slow devices (keyboard in simple systems)Moderately slow devicesHigh speed devices such as disk and network
ExampleReading a switch by pollingKeyboard, printerDisk read of a sector

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Draw an instruction cycle state diagram with interrupt and explain it

Answer

Instruction cycle. The CPU executes a program by repeating the instruction cycle for each instruction. With interrupts, the cycle is extended so that interrupt requests can be checked and serviced after each instruction.

State diagram.

 +--> (1) Instruction address calc. --> (2) Instruction fetch --> (3) Instruction decode
 |                                                                      |
 |                                                                      v
 |   +--> (4) Operand address calc. --> (5) Operand fetch --> (6) Data operation
 |   |                                                              |
 |   +------------------ more operands ----------------------------+
 |                                                                  v
 |                       (7) Operand address calc. --> (8) Operand store
 |                                                                  |
 |   +---------------- more results <------------------------------+
 |                                                                  v
 |                                                       Interrupt check
 |                                                       /            \
 |                                              no interrupt        interrupt
 |                                                     |                |
 +-----------------------------------------------------+      (9) Interrupt: save PC,
 +----------------------------------------------------------- load ISR address ---+

Explanation of the states.

  1. Instruction address calculation: determine the address of the next instruction (usually PC + length).
  2. Instruction fetch: read the instruction from memory into the instruction register.
  3. Instruction operation decoding: decode the opcode to find the operation and the number and type of operands.
  4. Operand address calculation: find the effective address of each source operand if it is in memory.
  5. Operand fetch: read the operand from memory or register.
  6. Data operation: perform the arithmetic or logical operation in the ALU.
  7. Operand address calculation (result): find the destination address.
  8. Operand store: write the result to memory or register.

States 4 to 8 may repeat for instructions with multiple operands or results.

Interrupt handling. At the end of each instruction execution the CPU checks the interrupt line. If no interrupt is pending (or interrupts are disabled), it fetches the next instruction. If an interrupt is pending, the CPU saves the current PC (and status) on the stack, loads the PC with the address of the interrupt service routine, executes it, and then restores the saved PC and resumes the interrupted program.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Explain register transfer language with example

Answer

Register Transfer Language (RTL). A symbolic notation used to describe the micro-operations of a digital system in terms of the transfer of data between registers and the operations performed on that data. A micro-operation is an elementary operation performed on data stored in registers, such as shift, load, clear, increment, add.

Notation.

  • Registers are named by capital letters: R1R1, MARMAR, PCPC, IRIR. Bits are shown in brackets, e.g. R1(7:0)R1(7:0).
  • Replacement (transfer) is written with an arrow: R2←R1R2\leftarrow R1 copies the contents of R1R1 into R2R2; the source is not changed.
  • A condition is written before a comma: P:R2←R1P: R2\leftarrow R1 means the transfer happens only if control signal P=1P=1.
  • Simultaneous operations are separated by commas: R2←R1, R1←R2R2\leftarrow R1,\ R1\leftarrow R2 (swap).
  • Memory is shown as M[AR]M[AR], a read is DR←M[AR]DR\leftarrow M[AR] and a write is M[AR]←R1M[AR]\leftarrow R1.

Types of micro-operations with examples.

TypeExample
TransferR1←R2R1\leftarrow R2
ArithmeticR3←R1+R2R3\leftarrow R1+R2, R1←R1+1R1\leftarrow R1+1, R3←R1+R2‾+1R3\leftarrow R1+\overline{R2}+1 (subtract)
LogicR3←R1∧R2R3\leftarrow R1\wedge R2, R1←R1‾R1\leftarrow\overline{R1}
ShiftR1←shl R1R1\leftarrow \text{shl }R1

Example (hardware). For T1:R2←R1T_1: R2\leftarrow R1, the output of R1R1 is connected to the input of R2R2, and the load input of R2R2 is enabled by the control signal T1T_1 at the clock edge. For the bus-based transfer, a common bus built with multiplexers or tri-state buffers selects the source register and the destination loads it.

Instruction fetch in RTL: T0:AR←PCT_0: AR\leftarrow PC T1:IR←M[AR], PC←PC+1T_1: IR\leftarrow M[AR],\ PC\leftarrow PC+1

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Write codes using 3, 2 and 1 address instruction formats to perform the given operations. X = A/B + C × D/C

Answer

The expression is X=AB+C×DCX=\frac{A}{B}+\frac{C\times D}{C} evaluated as (A/B)+((C×D)/C)(A/B)+((C\times D)/C).

(a) Three-address instructions (OP dest, src1, src2):

DIV  R1, A, B      ; R1 = A / B
MUL  R2, C, D      ; R2 = C * D
DIV  R2, R2, C     ; R2 = (C * D) / C
ADD  X, R1, R2     ; X = R1 + R2

(b) Two-address instructions (OP dest, src; the destination is also the first operand):

MOV  R1, A         ; R1 = A
DIV  R1, B         ; R1 = A / B
MOV  R2, C         ; R2 = C
MUL  R2, D         ; R2 = C * D
DIV  R2, C         ; R2 = (C * D) / C
ADD  R1, R2        ; R1 = A/B + C*D/C
MOV  X, R1         ; X = R1

(c) One-address instructions (all operations use the accumulator AC):

LOAD  C            ; AC = C
MUL   D            ; AC = C * D
DIV   C            ; AC = (C * D) / C
STORE T            ; T = AC (temporary)
LOAD  A            ; AC = A
DIV   B            ; AC = A / B
ADD   T            ; AC = A/B + C*D/C
STORE X            ; X = AC

Counts: 4 instructions for 3-address, 7 for 2-address and 8 for 1-address. As the number of addresses per instruction decreases, the program becomes longer but each instruction is shorter.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Explain the various addressing modes with example.

Answer

The addressing mode is the rule used to find the operand (effective address, EA) from the address field of an instruction. Modes give flexibility to handle pointers, arrays, loops and relocation.

ModeHow the operand is foundExample
ImpliedOperand is implicit in the opcode (e.g. accumulator or stack)CMA (complement accumulator)
ImmediateThe operand itself is in the instructionMVI A, 25 or ADD #5
Register directOperand is in the named registerMOV R1, R2
Register indirectRegister holds the memory address of the operand; EA =(R)=(R)MOV A, (R1)
Direct (absolute)Address field is the EALDA 2000H
IndirectAddress field points to a memory word holding the EA; EA =M[addr]=M[\text{addr}]LOAD @500
RelativeEA =PC+address field=\text{PC}+\text{address field}JMP +10 (branches)
IndexedEA =address field+index register=\text{address field}+\text{index register}LOAD 1000(X) for array element
Base registerEA =base register+displacement=\text{base register}+\text{displacement}Used for relocation and segments
Auto-increment / decrementRegister used as pointer, then incremented or decrementedMOV A, (R1)+

Example. Let the instruction be LOAD 500 with R1 =400=400, memory M[500]=800M[500]=800, M[800]=300M[800]=300, M[900]=700M[900]=700.

  • Immediate: AC ←500\leftarrow500.
  • Direct: AC ←M[500]=800\leftarrow M[500]=800.
  • Indirect: AC ←M[M[500]]=M[800]=300\leftarrow M[M[500]]=M[800]=300.
  • Register indirect (R1 =900=900): AC ←M[900]=700\leftarrow M[900]=700.
  • Indexed (X =400=400): EA =500+400=900=500+400=900, AC ←M[900]=700\leftarrow M[900]=700.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Differentiate between hardwired control unit and microprogrammed control unit

Answer

BasisHardwired control unitMicroprogrammed control unit
PrincipleControl signals produced by fixed combinational and sequential logicControl signals are read from a control memory as microinstructions
ComponentsInstruction decoder, step counter, gates, flip-flopsControl memory (ROM), control address register, microinstruction register, sequencer
SpeedFast, limited only by gate delaysSlower due to control memory access
FlexibilityHard to modify; any change needs rewiringEasy to modify by changing the microprogram
DesignComplex for large instruction sets; time-consumingSystematic and simple
CostHigh design cost for complex sets, cheaper for small setsNeeds control memory but cheaper for complex sets
Testing and debuggingDifficultEasier
Instruction setSuited to small, simple (RISC) setsSuited to large, complex (CISC) sets
ExamplesMIPS, ARMIBM 360, VAX, Intel x86 (older)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

How performance of computer is increased using pipeline? Explain with practical example

Answer

How pipelining improves performance. In a non-pipelined processor one instruction must finish before the next starts. In a pipelined processor the instruction is divided into stages (for example fetch, decode, execute) and a new instruction enters the pipeline every clock cycle, so several instructions are in progress at once. The execution time of one instruction does not decrease, but the throughput (instructions completed per unit time) increases and the CPI approaches 1.

For kk stages, nn tasks and clock period tpt_p (non-pipelined time per task tn=k tpt_n=k\,t_p):

Speedup=n tn(k+n−1) tp=nkk+n−1→k(n→∞)\text{Speedup}=\frac{n\,t_n}{(k+n-1)\,t_p}=\frac{nk}{k+n-1}\to k \quad (n\to\infty)

Practical example (washing clothes / assembly line). Washing, drying and ironing each take 30 minutes. For 4 loads without overlap, the total time is 4×90=3604\times90=360 min. With a pipeline, the washer starts the next load as soon as the first moves to the dryer, so the total is (3+4−1)×30=180(3+4-1)\times30=180 min, a speedup of 2.

Example with instructions. Take a 3-stage pipeline (fetch, decode, execute) with 10 instructions and a clock of 1 ns.

  • Non-pipelined: 10×3=3010\times3=30 ns.
  • Pipelined: (3+10−1)×1=12(3+10-1)\times1=12 ns.
  • Speedup =30/12=2.5=30/12=2.5.
Clock12345
FetchI1I2I3I4I5
DecodeI1I2I3I4
ExecuteI1I2I3

Real speedup is lower than ideal because of hazards (data, control, structural) and unequal stage delays, which are reduced by forwarding, branch prediction and stalls.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Differentiate between restoring division and non-restoring division

Answer

Both algorithms divide unsigned integers using shift and subtract, for a dividend in QQ, divisor MM and partial remainder AA.

BasisRestoring divisionNon-restoring division
IdeaIf A−MA-M is negative, the old value of AA is restored by adding MM backNo restoration; a negative AA is corrected in the next step by adding MM
Per-cycle operationShift left, subtract MM; if A<0A<0 add MM back and set q0=0q_0=0, else q0=1q_0=1Shift left; if A≥0A\ge0 subtract MM, else add MM; q0=1q_0=1 if the new A≥0A\ge0, else 00
Additions/subtractions per cycleOne or twoExactly one
SpeedSlower (extra addition when the result is negative)Faster
HardwareNeeds restore step and controlSimpler cycle, but needs final correction
Final stepNot neededIf A<0A<0 at the end add MM to get the remainder
ComplexitySimple to understandSlightly harder to understand

Why non-restoring works. Restoring then shifting gives 2(A+M)−M=2A+M2(A+M)-M=2A+M. Non-restoring skips the restore and simply adds MM in the next cycle, so the result is the same with one fewer operation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Give the appropriate reasons why replacement algorithm is required in associative mapping?

Answer

In associative (fully associative) mapping a main-memory block can be placed in any cache line, and the tag of every line is compared in parallel with the requested block address.

A replacement algorithm is required because:

  1. There is no fixed line for a block. When a miss occurs and the cache is full, the hardware must choose which of the existing blocks to remove. In direct mapping this is not needed because each block has exactly one possible line.
  2. The cache is much smaller than main memory, so the number of blocks that can compete for space is much larger than the number of lines.
  3. The choice affects the hit ratio. Removing a block that will be used again soon causes another miss, while removing a block that will not be needed keeps performance high.
  4. It must be done in hardware for speed, since the cache is accessed at CPU speed.

Common algorithms: Least Recently Used (LRU), First-In First-Out (FIFO), Least Frequently Used (LFU) and Random replacement. LRU is the most popular because of temporal locality of reference.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2077 · 5 marks

Differentiate between isolated versus memory mapped I/O

Answer

BasisIsolated I/O (I/O-mapped)Memory-mapped I/O
Address spaceSeparate address space for I/O and memoryI/O devices share the memory address space
Control signalsSeparate signals (IORD, IOWR, M/IO)Same MEMR and MEMW signals as memory
InstructionsSpecial instructions IN and OUTOrdinary memory instructions (LOAD, STORE, MOV)
Addressing modesLimited (only direct or register)All memory addressing modes are available
Address available for memoryFull address space (e.g. 64 KB)Reduced by the size used for I/O
Number of I/O portsLimited (e.g. 256 for 8-bit port address)Large, up to the address space left
HardwareNeeds extra control pins and decodingSimple; no extra control signals
Data manipulationData must move through accumulatorAny register or arithmetic instruction can work on I/O data directly
ProgrammingEasy to separate I/O codeMore flexible, but memory and I/O are mixed
ExampleIntel 8085, 8086 (IN/OUT)Motorola 68000, ARM

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Differentiate between hardwired and microprogrammed control unit. Describe with example of microprogram sequencer used in microprogrammed control unit.

Answer

Hardwired versus microprogrammed control unit.

BasisHardwired control unitMicroprogrammed control unit
ImplementationFixed logic: decoders, gates, flip-flops, countersMicroinstructions stored in a control memory (ROM)
SpeedFastSlower because of control-memory access
FlexibilityHard to change; redesign neededEasy to change by editing the microprogram
ComplexityComplex for large instruction setsSystematic and easier to design
CostHigh for complex setsLower for complex sets, but needs control memory
DebuggingDifficultEasier
Used inRISC machinesCISC machines

Microprogram sequencer. In a microprogrammed control unit, each machine instruction is carried out by a sequence of microinstructions in the control memory. The microprogram sequencer (next-address generator) decides the address of the next microinstruction.

Components:

  • Multiplexer (MUX) selects the source of the next address.
  • Branch logic tests the status bits and selects the branch condition.
  • Incrementer adds 1 to the control address register (CAR) for sequential execution.
  • Subroutine register (SBR) stores the return address for micro-subroutines.
  • Mapping logic converts the opcode of the instruction into the starting address of its microroutine.
  • Control address register (CAR) holds the current address, and the control memory with its microinstruction register supplies the control word.
 Instruction opcode --> [Mapping logic] ---+
 CAR --> [Incrementer] --------------------+
 SBR (return address) ---------------------+--> [MUX] --> CAR --> [Control memory] --> Microinstruction
 Branch address field ---------------------+        ^
 External address ---------------------+            |
 Status bits --> [Branch/condition logic]-----select-+

Example (instruction fetch/execute sequence). The next address is selected as:

  1. Sequential: CAR←CAR+1CAR\leftarrow CAR+1.
  2. Unconditional branch: CAR←CAR\leftarrow address field.
  3. Conditional branch: if the condition (e.g. Z flag) is true CAR←CAR\leftarrow address field, else CAR←CAR+1CAR\leftarrow CAR+1.
  4. Call: SBR←CAR+1SBR\leftarrow CAR+1, CAR←CAR\leftarrow address field.
  5. Return: CAR←SBRCAR\leftarrow SBR.
  6. Map: CAR←CAR\leftarrow mapping of the opcode (at the end of the fetch routine, to jump to the routine for the decoded instruction).

For example, the fetch routine at addresses 6464 to 6666 ends with a MAP microinstruction which loads CAR with the start address of the ADD routine, e.g. 8080. The ADD microprogram executes sequentially and finishes with a branch back to the fetch routine at 6464.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Explain the various types of addressing modes and compare them algorithm, advantage and disadvantage.

Answer

The addressing mode specifies how the effective address (EA) of the operand is found from the address field of the instruction.

Types, algorithm (EA calculation), advantages and disadvantages.

ModeAlgorithm / effective addressAdvantagesDisadvantages
ImpliedOperand is implicit (accumulator or stack top)Shortest instruction, no address fieldVery limited use
ImmediateOperand = address fieldNo memory access to fetch the operand, fast; good for constantsOperand size limited by the field; value cannot change at run time
Register directOperand =R=RVery fast, small fieldFew registers
Register indirectEA =(R)=(R)Small field, good for pointers and arraysExtra memory reference; the register must be set up
DirectEA =A=ASimple, one memory referenceLimited address space by field size
IndirectEA =M[A]=M[A]Large address space, supports pointersTwo or more memory references; slow
RelativeEA =PC+A=PC+APosition independent code, short branchesRange limited by displacement
IndexedEA =A+(X)=A+(X)Efficient for arrays and loopsNeeds an index register, extra addition
Base registerEA =(B)+A=(B)+ARelocation of programs and segmentsExtra addition, base register must be managed
Auto-increment/decrementEA =(R)=(R), then R←R±1R\leftarrow R\pm1Efficient for stacks and sequential array accessSide effects, more complex hardware

Example. For LOAD 500 with M[500]=800M[500]=800, M[800]=300M[800]=300, R=900R=900, index X=400X=400 and PC=200PC=200:

  • Immediate: operand =500=500.
  • Direct: operand =M[500]=800=M[500]=800, EA =500=500.
  • Indirect: EA =800=800, operand =300=300.
  • Register indirect: EA =900=900.
  • Indexed: EA =500+400=900=500+400=900.
  • Relative: EA =200+500=700=200+500=700.

Comparison summary. Speed (fastest to slowest): immediate, register, register indirect, direct, indexed/relative/base, indirect. Flexibility (least to most): immediate and direct, then register indirect, then indexed, base and indirect. Modes with a computed address give flexibility at the price of more memory references or additions.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 10 marks

Explain the non-restoring division algorithm with flow chart, and hardware implementation diagram. Divide 10/3 using restoring division.

Answer

Non-restoring division. It divides without restoring the accumulator after a negative result.

Hardware. Registers:

  • A (accumulator, n+1n+1 bits) holds the partial remainder, initially 0.
  • Q (nn bits) holds the dividend and ends with the quotient.
  • M (n+1n+1 bits) holds the divisor.
  • An adder/subtractor combines A and M, and a counter holds nn.
  • The sign bit of A controls whether to add or subtract.
   M (divisor) ---> [ Adder / Subtractor ] <--- A (partial remainder)
                               |
              A:Q shifted left as one register, q0 gets quotient bit
              Control logic uses sign of A, counter n

Flow chart (algorithm).

  1. Start: A←0A\leftarrow0, Q←Q\leftarrow dividend, M←M\leftarrow divisor, count←ncount\leftarrow n.
  2. If A≥0A\ge0 (sign bit 0): shift A:QA:Q left, then A←A−MA\leftarrow A-M. Otherwise (A<0A<0): shift A:QA:Q left, then A←A+MA\leftarrow A+M.
  3. If now A≥0A\ge0 then q0←1q_0\leftarrow1, else q0←0q_0\leftarrow0.
  4. count←count−1count\leftarrow count-1. If count≠0count\ne0 go to step 2.
  5. If A<0A<0 then A←A+MA\leftarrow A+M (final correction).
  6. Stop: QQ is the quotient and AA is the remainder.

Divide 10÷310\div3 using restoring division (as asked). Q=1010Q=1010, M=0011M=0011, A=0000A=0000, n=4n=4. Each cycle: shift left, A←A−MA\leftarrow A-M; if A<0A<0, restore (A←A+MA\leftarrow A+M) and q0=0q_0=0; else q0=1q_0=1.

CycleAfter shift (AA, QQ)A−MA-MActionAAQQ
Initial00001010
10001, 010_0001−0011<00001-0011<0restore, q0=0q_0=000010100
20010, 100_0010−0011<00010-0011<0restore, q0=0q_0=000101000
30101, 000_0101−0011=00100101-0011=0010keep, q0=1q_0=100100001
40100, 001_0100−0011=00010100-0011=0001keep, q0=1q_0=100010011

Result: Quotient =00112=3=0011_2=3, remainder =00012=1=0001_2=1.

Check: 3×3+1=103\times3+1=10.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Explain the bus interconnection scheme with diagram.

Answer

Bus interconnection. A bus is a shared communication path of lines that connects the CPU, memory and I/O modules, so that they can exchange data. Only one device can transmit at a time, while all others can listen.

Bus structure.

   +-----+     +--------+     +-------+     +-------+
   | CPU |     | Memory |     | I/O 1 |     | I/O 2 |
   +--+--+     +----+---+     +---+---+     +---+---+
      |             |             |             |
 =====+=============+=============+=============+===== Address bus
 =====+=============+=============+=============+===== Data bus
 =====+=============+=============+=============+===== Control bus

Three groups of lines.

  • Address bus: carries the address of the memory location or I/O port; unidirectional from the CPU. Its width fixes the maximum memory (2n2^n locations for nn lines).
  • Data bus: carries data and instructions; bidirectional. Its width (8, 16, 32, 64 bits) gives the amount of data moved at once.
  • Control bus: carries timing and control signals such as memory read/write, I/O read/write, interrupt request/acknowledge, bus request/grant, clock and reset.

Operation. To write to memory: the CPU requests the bus, places the address on the address bus and the data on the data bus, and asserts memory-write on the control bus. The addressed device is selected by decoding the address and takes the data.

Multiple bus hierarchy. A single bus becomes a bottleneck when many devices are attached, so systems use a hierarchy: a local bus (CPU to cache), a system bus (to main memory), and expansion buses (PCI, USB) connected through bridges, which gives higher performance.

Bus arbitration is needed when more than one device may be bus master: centralised (daisy chaining, polling, independent request) or distributed.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

What do you mean by instruction format? Explain with an example.

Answer

Instruction format. An instruction format defines the layout of the bits of an instruction, divided into fields. It tells the control unit how to interpret the instruction. The main fields are:

  • Opcode: specifies the operation (add, load, jump).
  • Address / operand fields: specify the operand or its location (register or memory address).
  • Mode field: specifies the addressing mode used to find the operand.
 | Opcode | Mode | Operand 1 / Address | Operand 2 / Address |

Types by number of address fields.

  • Three-address: ADD R1, R2, R3 means R1←R2+R3R1\leftarrow R2+R3.
  • Two-address: ADD R1, R2 means R1←R1+R2R1\leftarrow R1+R2.
  • One-address: ADD X means AC←AC+M[X]AC\leftarrow AC+M[X].
  • Zero-address (stack): ADD pops two items from the stack and pushes the sum.

Example. A 16-bit instruction with a 4-bit opcode, 3-bit mode and 9-bit address:

Opcode (4)Mode (3)Address (9)
0001001000000101

The 4-bit opcode gives 24=162^4=16 operations, and the 9-bit address field can address 29=5122^9=512 words. This instruction could mean ADD using direct addressing with the operand at address 5.

Fixed versus variable length. Fixed-length formats (RISC) are easy to decode; variable-length formats (CISC) save space but are harder to decode.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Explain the data transfer instructions with example

Answer

Data transfer instructions copy data from one place to another (register, memory, I/O or stack) without changing its value, and normally do not alter the flags. The source is not modified.

InstructionMeaningExample
Move (MOV)Copy between registers, or between register and memoryMOV R1, R2 (R1←R2R1\leftarrow R2)
Load (LD/LOAD)Memory to register or accumulatorLD R1, 500 (R1←M[500]R1\leftarrow M[500])
Store (ST/STORE)Register or accumulator to memoryST R1, 600 (M[600]←R1M[600]\leftarrow R1)
Exchange (XCHG)Swap the contents of two locationsXCHG R1, R2
Input (IN)Read from an I/O port to a registerIN A, 40H
Output (OUT)Write a register to an I/O portOUT 41H
Push (PUSH)Put a word on top of the stackPUSH R1 (SP←SP−1SP\leftarrow SP-1, M[SP]←R1M[SP]\leftarrow R1)
Pop (POP)Take the top word from the stack to a registerPOP R1 (R1←M[SP]R1\leftarrow M[SP], SP←SP+1SP\leftarrow SP+1)
Immediate loadLoad a constant into a registerMVI A, 25 or LDI R1, 25

Example program. To copy the value in memory location 500 to location 600:

LD  R1, 500     ; R1 = M[500]
ST  R1, 600     ; M[600] = R1

To swap R1 and R2 using the stack:

PUSH R1
PUSH R2
POP  R1
POP  R2

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Explain the symbolic microinstruction with example.

Answer

Symbolic microinstruction. In a microprogrammed control unit each microinstruction is stored in control memory as a binary word. When writing a microprogram, a symbolic microinstruction is the human-readable form of that word. An assembler converts the symbols into the binary microinstruction.

Fields of a symbolic microinstruction (as in the basic computer microprogram with a 20-bit word):

FieldMeaning
F1, F2, F3Three micro-operation fields, each selecting one micro-operation (e.g. ADD, CLRAC, INCAC, DRTAC, READ, WRITE)
CDCondition for branching: U (unconditional), I (indirect bit), S (sign), Z (zero)
BRBranch type: JMP, CALL, RET, MAP
ADAddress field: symbolic address (label) of the next microinstruction

A symbolic line is written as: LABEL: F1, F2, F3, CD, BR, AD. A field that is not used is written NOP. A label ends with a colon, and the assembler assigns it a control-memory address.

Example: fetch routine.

        ORG 64
FETCH:  PCTAR      U   JMP  NEXT
NEXT:   READ, INCPC U  JMP  NEXT1
NEXT1:  DRTAR      U   MAP
  • PCTAR (F1) means AR←PCAR\leftarrow PC.
  • READ (F2) means DR←M[AR]DR\leftarrow M[AR] and INCPC (F3) means PC←PC+1PC\leftarrow PC+1.
  • DRTAR means AR←DR(0-10)AR\leftarrow DR(0\text{-}10).
  • U JMP NEXT means jump unconditionally to the label NEXT.
  • MAP loads the control address register from the opcode, so execution moves to the microroutine of the instruction.

The assembler gives each line a binary word. For example, PCTAR corresponds to F1 =110=110, so the first word has F1 =110=110, F2 =000=000, F3 =000=000, CD =00=00 (U), BR =00=00 (JMP) and AD == address of NEXT.

Advantage. Symbols make the microprogram easy to write, read and debug compared with raw binary.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Explain an instrction pipeline with an example.

Answer

Instruction pipeline. Pipelining divides instruction processing into several stages, each handled by a separate segment. While one instruction is in a later stage, the next instructions occupy the earlier stages. Several instructions are therefore in progress at the same time, which raises throughput.

Four-segment instruction pipeline:

  1. FI - fetch the instruction from memory.
  2. DA - decode the instruction and calculate the effective address.
  3. FO - fetch the operand from memory.
  4. EX - execute the instruction and store the result.

Space-time diagram for three instructions I1,I2,I3I_1, I_2, I_3:

Clock123456
I1I_1FIDAFOEX
I2I_2FIDAFOEX
I3I_3FIDAFOEX

Speed-up. For nn instructions and kk stages with clock period tpt_p:

  • Pipelined time =(k+n−1) tp=(k+n-1)\,t_p.
  • Non-pipelined time =n k tp=n\,k\,t_p.

S=nkk+n−1S=\frac{nk}{k+n-1}

Example: with k=4k=4 and n=100n=100, S=400103≈3.88S=\dfrac{400}{103}\approx 3.88, which approaches k=4k=4 for large nn.

Problems (hazards). Resource conflicts (structural), data dependency between instructions (data hazard), and branch instructions (control hazard) can stall the pipeline. They are handled by operand forwarding, delayed load, branch prediction and delayed branch.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Explain the Booth Multiplication algorithm with example.

Answer

Booth multiplication algorithm. Booth's algorithm multiplies two signed numbers in 2's complement form. A string of 1s in the multiplier is treated as 2k+1−2m2^{k+1}-2^{m}, so only the two ends of a string of 1s need an operation (subtract at the start, add at the end).

Registers: BRBR = multiplicand, QRQR = multiplier, AC=0AC=0, Qn+1=0Q_{n+1}=0 (an extra flip-flop), SC=nSC=n (number of bits).

Steps. Examine QnQn+1Q_n Q_{n+1} (the last bit of QRQR and Qn+1Q_{n+1}):

  • 1010 (beginning of a string of 1s): AC←AC+BR‾+1AC\leftarrow AC+\overline{BR}+1 (subtract).
  • 0101 (end of a string of 1s): AC←AC+BRAC\leftarrow AC+BR.
  • 0000 or 1111: no operation.
  • Arithmetic shift right AC,QR,Qn+1AC, QR, Q_{n+1} (sign bit of ACAC is kept), then SC←SC−1SC\leftarrow SC-1.
  • Repeat until SC=0SC=0. The product is in AC QRAC\,QR.

Example: (−3)×(+3)(-3)\times(+3) with 4 bits. BR=1101BR=1101 (−3-3), QR=0011QR=0011 (+3+3), −BR=0011-BR=0011.

StepQnQn+1Q_nQ_{n+1}OperationACACQRQRQn+1Q_{n+1}
initial000000110
110AC−BRAC-BR001100110
ashr000110011
211ashr000011001
301AC+BRAC+BR110111001
ashr111011100
400ashr111101110

The product is AC QR=1111 01112AC\,QR=1111\ 0111_2, which is −9-9 in 2's complement. This agrees with −3×3=−9-3\times 3=-9.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

What are the advantage and disadvantage of direct mapping and associative mapping between cache and main memory?

Answer

Direct mapping. Each main-memory block can go to only one cache line, given by i=j mod mi=j \bmod m (jj = block number, mm = number of cache lines). The address is split into tag, line and word fields.

AdvantagesDisadvantages
Simple and cheap hardwareEach block has a fixed cache line, so two frequently used blocks that map to the same line keep replacing each other (thrashing)
Only one tag comparison is needed, so access is fastHit ratio is lower when the program uses blocks with the same index
No replacement algorithm is needed; the line is fixedCache utilisation can be poor, since some lines stay unused while others are overloaded

Associative mapping. Any main-memory block can be placed in any cache line. The address is split into a tag and a word field; the tag is compared with the tags of all lines in parallel.

AdvantagesDisadvantages
Most flexible; a block can go in any free lineNeeds expensive associative (content-addressable) memory, with a comparator for every line
Highest hit ratio and best cache utilisationComplex hardware and slower, since all tags are searched
Thrashing is avoidedA replacement algorithm (LRU, FIFO, random) is needed
Tag is longer, so more storage is needed for tags

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

What are the major differentiate between Input-output processor (IOP) and direct memory Access (DMA)

Answer

IOP versus DMA.

BasisInput-output processor (IOP)Direct memory access (DMA)
NatureA processor with its own instruction set and program, able to execute I/O programs (channel programs)A hardware controller that only transfers blocks of data between I/O device and memory
IntelligenceCan fetch and decode instructions, do code conversion, error checking and format conversionCannot execute instructions; only has address register, word count register and control logic
CPU involvementCPU only starts the IOP and gets an interrupt at the end of the whole I/O programCPU initialises the DMA registers for each block transfer and gets an interrupt after the block
ControlIOP controls many devices and sequences of transfersDMA controller handles transfer for one or a few devices
MemoryHas its own local memory in some designs and shares system memoryUses only the system bus and memory
Cost and complexityHighLow
ExampleIBM channel, Intel 8089Intel 8237

In short, a DMA controller is a simple data mover, while an IOP is a special-purpose processor that takes over the full I/O workload from the CPU.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2078 · 5 marks

Draw a three dimensonal hypercube and explain with example.

Answer

Hypercube (n-cube) interconnection. A hypercube is a multiprocessor interconnection structure with 2n2^n nodes (processors), each node connected to nn neighbours. A 3-dimensional hypercube has 23=82^3=8 nodes, each with 3 links, and 8×3/2=128\times 3/2=12 links in all.

Each node is given a binary address of n=3n=3 bits. Two nodes are directly connected if their addresses differ in exactly one bit.

        110 ------------ 111
        /|               /|
      010 ------------ 011|
       | 100 ---------- |101
       |/               |/
      000 ------------ 001

Edges: 000000-001001, 010010-011011, 100100-101101, 110110-111111 (differ in bit 0); 000000-010010, 001001-011011, 100100-110110, 101101-111111 (bit 1); 000000-100100, 001001-101101, 010010-110110, 011011-111111 (bit 2).

Example of routing. To send a message from node 001001 to node 110110, XOR the addresses: 001⊕110=111001\oplus 110=111. The number of 1s is 3, so the distance is 3 hops. The message corrects one differing bit per hop, for example 001→000→010→110001\to 000\to 010\to 110. The maximum distance (diameter) in an nn-cube is n=3n=3.

Properties. Short diameter (log⁡2N\log_2 N), several alternative paths between nodes, good fault tolerance, and the number of links per node grows only as log⁡2N\log_2 N.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

What is cache memory? Explain the mapping process. Differentiate between direct mapping and associate mapping.

Answer

Cache memory. A small, very fast memory placed between the CPU and main memory. It holds copies of the most recently or frequently used instructions and data, so that most memory accesses are served at cache speed. It works because of the locality of reference (temporal and spatial). If the CPU finds the word in the cache it is a hit, otherwise a miss and the block is loaded from main memory.

Hit ratio=hitshits+misses,Tavg=h Tc+(1−h) Tm\text{Hit ratio}=\frac{\text{hits}}{\text{hits}+\text{misses}},\qquad T_{avg}=h\,T_c+(1-h)\,T_m

Mapping process. The transformation of main-memory blocks into cache lines is called mapping. Main memory is divided into blocks of KK words and the cache into lines of the same size. There are three techniques.

1. Direct mapping. Block jj goes to line i=j mod mi=j \bmod m (mm = number of lines). The address has three fields: Tag | Line | Word. The line field selects one cache line, and the tag stored there is compared with the tag of the address. If equal it is a hit.

2. Associative mapping. A block can be placed in any line. The address has Tag | Word. The tag is compared with all line tags simultaneously.

3. Set-associative mapping. The cache is divided into vv sets of kk lines. Block jj goes to set j mod vj \bmod v and to any line in that set. The address has Tag | Set | Word. It is a compromise of the other two.

Example. Main memory 6464 K words (1616-bit address), cache 11 K words, block size 1616 words. Then word field =4=4 bits, cache lines =1024/16=64=1024/16=64, so the line field =6=6 bits and the tag =16−6−4=6=16-6-4=6 bits for direct mapping. For associative mapping the tag is 1212 bits.

Difference between direct and associative mapping.

BasisDirect mappingAssociative mapping
PlacementA block maps to exactly one line (j mod mj \bmod m)A block can go in any line
Address fieldsTag, line, wordTag, word
Tag comparisonOne comparisonAll tags compared in parallel
HardwareSimple and cheapCostly (associative memory)
Replacement algorithmNot neededNeeded (LRU, FIFO, random)
Hit ratioLower because of conflict missesHigher
SpeedFast lookupSlower and more complex search

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

Describe micro-programmed control unit. Explain different types of addressing modes with example.

Answer

Micro-programmed control unit. A control unit whose control signals are generated by a stored program called a microprogram, kept in a control memory (ROM). Each machine instruction is executed by a sequence of microinstructions, each of which produces the control word for one clock period.

Organisation:

  • Control memory stores the microprograms.
  • Control address register (CAR) holds the address of the next microinstruction.
  • Control data register / microinstruction register holds the microinstruction being executed.
  • Next-address generator (sequencer) decides the next CAR value: increment, branch, call, return or map from the opcode.
  • Control signals go to the datapath; the status bits go back to the sequencer.

Working. The opcode of the instruction is mapped to the starting address of its microroutine and loaded into CAR. The microinstruction is read, its fields drive the control lines, and the sequencer computes the next address. The routine ends by returning to the fetch routine.

Advantages: flexible and easily modified, systematic design. Disadvantage: slower than a hardwired unit.

Addressing modes. The addressing mode tells how the operand (or its effective address, EA) is found from the address field of the instruction. Assume R1=300R1=300, PC=200PC=200, index register XR=100XR=100, and the address field =500=500, with M[500]=800M[500]=800, M[600]=700M[600]=700, M[800]=900M[800]=900.

ModeEffective address / operandExample
ImpliedOperand is implicit in the opcodeCMA complements AC
ImmediateOperand is in the instruction itselfLDA #500, AC=500AC=500
RegisterOperand is in a registerADD R1, operand =300=300
Register indirectRegister holds the EALD (R1), EA =300=300, operand =M[300]=M[300]
Autoincrement / autodecrementRegister indirect, then register is ±1\pm 1LD (R1)+
DirectAddress field is the EALD 500, operand =M[500]=800=M[500]=800
IndirectAddress field gives the address of the EALD @500, EA =M[500]=800=M[500]=800, operand =M[800]=900=M[800]=900
RelativeEA=PC+address fieldEA=PC+\text{address field}EA=200+500=700EA=200+500=700 (PC already points to the next instruction)
IndexedEA=XR+address fieldEA=XR+\text{address field}EA=100+500=600EA=100+500=600, operand =M[600]=700=M[600]=700
Base registerEA=base register+displacementEA=\text{base register}+\text{displacement}Used for relocation of programs

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 10 marks

Differentiate between floating point representation and fixed point representation. Divide 23 by 9 using restoring division algorithm.

Answer

Fixed-point versus floating-point representation.

BasisFixed pointFloating point
Position of binary pointFixed (usually at the right end for integers, or fixed after the sign for fractions)Moves; its position is given by an exponent
FormatSign + magnitude bitsSign, exponent and mantissa: ±M×BE\pm M\times B^{E}
RangeSmallVery large range of very big and very small numbers
PrecisionFixed absolute precisionFixed relative precision
HardwareSimple and fastComplex (alignment, normalisation)
OverflowOccurs easilyRare
UseInteger arithmetic, simple processorsScientific computation, FPU

Restoring division of 2323 by 99. Dividend Q=23=101112Q=23=10111_2, divisor M=9=010012M=9=01001_2, A=00000A=00000, count =5=5.

Each step: shift left A QA\,Q, then A←A−MA\leftarrow A-M. If A<0A<0 set Q0=0Q_0=0 and restore AA (add MM back); else set Q0=1Q_0=1.

StepOperationAAQQ
start0000010111
1shift left000010111_
A−M=11000A-M=11000 (negative)restore: 0000101110
2shift left000101110_
A−M=11001A-M=11001 (negative)restore: 0001011100
3shift left001011100_
A−M=11100A-M=11100 (negative)restore: 0010111000
4shift left010111000_
A−M=00010A-M=00010 (positive)0001010001
5shift left001010001_
A−M=11100A-M=11100 (negative)restore: 0010100010

Result: quotient Q=000102=2Q=00010_2=2 and remainder A=001012=5A=00101_2=5.

Check: 9×2+5=239\times 2+5=23.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

What are different methods for representing signed numbers? Represent (-71) in those formats.

Answer

Methods of representing signed numbers. The leftmost bit is the sign bit (00 = positive, 11 = negative). Three methods are used:

  1. Signed magnitude: the sign bit followed by the magnitude in binary.
  2. Signed 1's complement: a negative number is the 1's complement (every bit inverted) of the positive number.
  3. Signed 2's complement: a negative number is the 1's complement plus 1.

Representation of −71-71 in 8 bits.

71=64+4+2+1=01000111271=64+4+2+1=01000111_2.

MethodWorkingResult
Signed magnitudesign 11, magnitude 100011110001111100011111000111
1's complementinvert 01000111010001111011100010111000
2's complement10111000+110111000+11011100110111001

Check of 2's complement: 101110012=−128+32+16+8+1=−7110111001_2=-128+32+16+8+1=-71.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Explain Direct Memory Acess with suitable diagram.

Answer

Direct Memory Access (DMA). A technique in which an I/O device transfers a block of data directly to or from main memory without passing through the CPU. A DMA controller takes control of the buses (bus request, then bus grant) and does the transfer, so the CPU is free to do other work and is interrupted only at the end of the block. It is used for fast devices such as disks.

DMA controller registers:

  • Address register: starting memory address of the block.
  • Word count register: number of words to transfer.
  • Control register: mode of transfer (read/write).

Block diagram:

   CPU  <--- Data bus ---> | DMA controller |   <--- Address bus --->
                           |  Address reg   |
 Memory <----------------> |  Word count    | <---> I/O device
                           |  Control reg   |
   BR (bus request)  <-------- DMA request
   BG (bus grant)    --------> DMA acknowledge
   Interrupt         <-------- at end of transfer

Operation:

  1. The CPU initialises the controller with the memory address, word count and direction, and then continues other work.
  2. The device sends a DMA request. The controller asks the CPU for the bus using BR.
  3. The CPU finishes the current bus cycle, floats its buses and replies with BG.
  4. The controller places the address on the address bus and transfers a word between device and memory; the address register is incremented and the word count decremented.
  5. When the word count is 00, the controller releases the bus and interrupts the CPU.

Modes of transfer: burst (block) mode, where the controller holds the bus for the whole block, and cycle stealing, where it takes the bus for one cycle at a time.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Explain the data transfer and manipulation instruction with example.

Answer

Data transfer instructions. These move data between memory, registers and I/O without changing the data.

InstructionMnemonicExample
LoadLDLD R1, 500 loads M[500]M[500] into R1R1
StoreSTST R1, 500 stores R1R1 into M[500]M[500]
MoveMOVMOV R2, R1 copies R1R1 to R2R2
ExchangeXCHXCH R1, R2 swaps contents
Input / OutputIN, OUTIN R1, port
Push / PopPUSH, POPPUSH R1 puts R1R1 on the stack

Data manipulation instructions. These perform operations on data and give the computational ability of the processor. There are three groups.

1. Arithmetic instructions: increment INC, decrement DEC, add ADD, subtract SUB, multiply MUL, divide DIV, add with carry ADDC, negate NEG. Example: ADD R1, R2 gives R1←R1+R2R1\leftarrow R1+R2.

2. Logical and bit-manipulation instructions: clear CLR, complement COM, AND, OR, XOR, clear carry CLRC, set carry SETC. Example: AND R1, #0F clears the upper four bits, so 10110101∧00001111=0000010110110101\wedge 00001111=00000101.

3. Shift instructions: logical shift right/left SHR/SHL, arithmetic shift ASHR/ASHL, rotate ROR/ROL, rotate through carry RORC/ROLC. Example: SHL on 0011010100110101 gives 0110101001101010 (multiplies by 2); ASHR on 1011010010110100 gives 1101101011011010 (the sign is kept).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Explain the binary adder-subtractor circuit with suitable diagram.

Answer

Binary adder-subtractor. A binary adder is built from a chain of full adders (FA). A 4-bit parallel adder adds A3A2A1A0A_3A_2A_1A_0 and B3B2B1B0B_3B_2B_1B_0, the carry out of each FA going to the carry in of the next.

For each bit: Si=Ai⊕Bi⊕CiS_i=A_i\oplus B_i\oplus C_i and Ci+1=AiBi+(Ai⊕Bi)CiC_{i+1}=A_iB_i+(A_i\oplus B_i)C_i.

Subtraction is done by the 2's complement method: A−B=A+B‾+1A-B=A+\overline{B}+1. To combine both in one circuit, each input BiB_i is passed through an XOR gate whose other input is the mode control MM, and MM is also the carry input C0C_0 of the first FA.

 B3 --XOR-- FA3 -- S3        M = 0 : add
 B2 --XOR-- FA2 -- S2        M = 1 : subtract
 B1 --XOR-- FA1 -- S1
 B0 --XOR-- FA0 -- S0
 M ---> all XOR inputs and C0
 A3..A0 go directly to FA3..FA0;  C4 = carry out
  • M=0M=0: B⊕0=BB\oplus 0=B and C0=0C_0=0, so the circuit computes A+BA+B.
  • M=1M=1: B⊕1=B‾B\oplus 1=\overline{B} and C0=1C_0=1, so the circuit computes A+B‾+1=A−BA+\overline{B}+1=A-B.

Overflow detection (for signed numbers): the extra XOR gate gives V=Cn−1⊕CnV=C_{n-1}\oplus C_n i.e. the carry into the sign bit XOR the carry out of the sign bit. V=1V=1 shows overflow.

Example: 0111−00100111-0010 (7−27-2): B‾=1101\overline{B}=1101, C0=1C_0=1; 0111+1101+1=101010111+1101+1=10101, discard the carry, result 0101=50101=5.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

What do you mean by Register Transfer Language? Explain the use of Register Transfer Language control function.

Answer

Register Transfer Language (RTL). A symbolic notation used to describe the micro-operations of a digital system. A micro-operation is an elementary operation on data stored in registers (transfer, arithmetic, logic, shift). RTL describes the registers and the information flow between them clearly and concisely.

Notation:

  • R2←R1R2\leftarrow R1 copies the contents of R1R1 into R2R2.
  • R1R1, PCPC, ARAR denote registers; R1(7:0)R1(7:0) denotes a range of bits; M[AR]M[AR] denotes memory.
  • A comma separates micro-operations that happen at the same clock, e.g. R2←R1, R1←R2R2\leftarrow R1,\ R1\leftarrow R2.

Control function. A control function is a Boolean variable (or expression) that is 11 or 00 and decides whether a transfer takes place. It is written before a colon:

P: R2←R1P:\ R2\leftarrow R1

The transfer from R1R1 to R2R2 takes place only when P=1P=1 (the load input of R2R2 is enabled by PP). A control function can combine conditions, for example T2D5:AC←AC+DRT_2 D_5 : AC\leftarrow AC+DR, and in the basic computer the timing signals T0,T1,…T_0,T_1,\ldots and the decoded opcode DiD_i are used as control functions.

Hardware use.

  • PP comes from the control unit and goes to the load input of the destination register, so the transfer occurs at the next clock edge.
  • For the transfer of R1R1 to R2R2, the output of R1R1 is connected to the input of R2R2, which loads when P=1P=1.
  • When several sources transfer to the same register at different times, e.g. T1:R1←R2T_1: R1\leftarrow R2 and T2:R1←R3T_2: R1\leftarrow R3, a multiplexer or bus selects the source, and the load is enabled by T1+T2T_1+T_2.

Example (instruction fetch): T0:AR←PCT_0: AR\leftarrow PC T1:IR←M[AR], PC←PC+1T_1: IR\leftarrow M[AR],\ PC\leftarrow PC+1

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

What do you mean by sequencer? Explain with microprogram sequencer.

Answer

Sequencer. A sequencer (next-address generator) is the part of the control unit that determines the order in which the control signals or microinstructions are issued. In a microprogrammed control unit, the microprogram sequencer produces the address of the next microinstruction, to be loaded in the control address register (CAR). It must provide sequential execution, branching (conditional and unconditional), subroutine calls and returns, and the mapping from an instruction opcode to the start of its microroutine.

Block diagram of a microprogram sequencer:

 Opcode ---> [Mapping logic] ---+
 Branch address (from control    |
   memory) ----------------------+--> [MUX 1] --> [CAR] --> [Control memory]
 SBR --------------------------+      ^                          |
 CAR+1 (from incrementer) -----+      | S1 S0                    |
                                  [Input logic] <-- I1 I0 (BR field)
 Status bits --> [MUX 2] --T-----^      ^                        
 (selected by CD field)                 +-- L (load SBR with CAR+1)

Components:

  • MUX 1 selects the next address: S1S0=00S_1S_0=00 gives CAR+1CAR+1, 0101 the branch address, 1010 the subroutine register SBR, 1111 the address from the mapping logic.
  • MUX 2 selects one status bit according to the CD field and gives the test value TT.
  • Input logic uses the BR field bits I1I0I_1I_0 and TT to produce S1S0S_1S_0 and the SBR load signal LL.
  • Incrementer gives CAR+1CAR+1. SBR stores the return address of a micro-subroutine.

Input logic truth table:

I1I0I_1I_0 (BR)TTS1S0S_1S_0LLAction
00 (JMP)0000next sequential
00 (JMP)1010jump to branch address
01 (CALL)0000next sequential
01 (CALL)1011call: SBR ←\leftarrow CAR+1, jump
10 (RET)x100return: CAR ←\leftarrow SBR
11 (MAP)x110CAR ←\leftarrow mapped address

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2079 · 5 marks

Write short notes on (any two): a. CISC b. Overlapped register c. Pipelining hazards

Answer

(a) CISC (Complex Instruction Set Computer). A CISC processor has a large instruction set (often 100 to 300 instructions) with many addressing modes and variable-length instruction formats. A single instruction can do a complex job such as a memory-to-memory operation or string handling.

Characteristics:

  • Many complex instructions and addressing modes; a program needs fewer instructions.
  • Instructions take multiple clock cycles; control is usually microprogrammed.
  • Few general registers; memory operands are directly used in many instructions.
  • Variable instruction length makes pipelining harder.
  • Examples: Intel x86, VAX, Motorola 68000.

Advantages: smaller programs and a simple compiler mapping from high-level statements. Disadvantages: complex hardware, slower clock and poor pipelining.

(b) Overlapped register windows. Used in RISC processors to speed up procedure call and return. The large register file is divided into windows. Each window has local registers, plus registers that overlap with the neighbouring windows.

  • Global registers are common to all procedures.
  • Local registers belong to one procedure only.
  • Input (high) registers of a procedure are the same physical registers as the output (low) registers of the calling procedure.

When procedure A calls B, the window pointer moves to the next window; the parameters placed by A in its output registers are directly visible as input registers of B, so no copying to memory or stack is needed. On return, the results go back the same way. This avoids the time of saving and restoring registers in memory.

(c) Pipeline hazards. Situations that stop the next instruction from executing in its clock cycle, so the pipeline stalls.

  1. Structural (resource) hazards: two instructions need the same hardware, e.g. one memory for instruction fetch and operand fetch. Solved by separate resources or a stall.
  2. Data hazards: an instruction needs a result that a previous instruction has not yet produced. Types are RAW, WAR and WAW, e.g. ADD R1,R2,R3 followed by SUB R4,R1,R5. Solved by operand forwarding, hardware interlocks, delayed load or compiler scheduling.
  3. Control (branch) hazards: a branch changes the PC, so the instructions fetched after it may be wrong. Solved by prefetching both paths, a branch target buffer, branch prediction or delayed branch.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

Explain the working of Booth’s multiplication algorithm and perform multiplication of 50 and (-13) using the same algorithm.

Answer

Booth's multiplication algorithm. Booth's algorithm multiplies two signed binary numbers in 2's complement form. A string of 1s in the multiplier from bit mm to bit kk is worth 2k+1−2m2^{k+1}-2^{m}, so instead of adding for every 1, we subtract at the first 1 of a string and add after the last 1. This makes the multiplication of signed numbers uniform and faster when the multiplier has long strings of 1s.

Registers. BRBR = multiplicand, QRQR = multiplier, AC=0AC=0, Qn+1=0Q_{n+1}=0, SC=nSC=n.

Algorithm. For each of the nn cycles examine QnQn+1Q_nQ_{n+1} (QnQ_n is the least significant bit of QRQR):

QnQn+1Q_nQ_{n+1}Action
10AC←AC−BRAC\leftarrow AC-BR (i.e. AC+BR‾+1AC+\overline{BR}+1)
01AC←AC+BRAC\leftarrow AC+BR
00 or 11no change

Then do an arithmetic shift right of AC,QR,Qn+1AC,QR,Q_{n+1} (keeping the sign of ACAC) and SC←SC−1SC\leftarrow SC-1. When SC=0SC=0, the 2n2n-bit product is in AC QRAC\,QR.

Multiplication of 50×(−13)50\times(-13) using n=8n=8 bits.

BR=50=00110010BR=50=00110010, −BR=11001110-BR=11001110. QR=−13QR=-13: 13=0000110113=00001101, 1's complement 1111001011110010, plus 1 gives 1111001111110011.

CycleQnQn+1Q_nQ_{n+1}OperationACACQRQRQn+1Q_{n+1}
init00000000111100110
110AC−BRAC-BR11001110111100110
ashr11100111011110011
211ashr11110011101111001
301AC+BRAC+BR00100101101111001
ashr00010010110111100
400ashr00001001011011110
510AC−BRAC-BR11010111011011110
ashr11101011101101111
611ashr11110101110110111
711ashr11111010111011011
811ashr11111101011101101

Product =AC QR=11111101 011101102=AC\,QR=11111101\ 01110110_2.

Since the sign bit is 11, the product is negative. Its magnitude is the 2's complement: 00000010 100010102=512+128+8+2=65000000010\ 10001010_2=512+128+8+2=650.

Hence 50×(−13)=−65050\times(-13)=-650. This is correct.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

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

Answer

Instruction format of the basic computer. The basic computer has a 16-bit instruction word. The three types of instruction are distinguished by the opcode bits (bits 12-14) and the mode bit II (bit 15).

1. Memory-reference instruction (opcode 000000 to 110110):

1514-1211-0
IIOpcodeAddress

I=0I=0 is direct addressing and I=1I=1 is indirect addressing; the 12-bit address field addresses 4096 words. Examples: AND, ADD, LDA, STA, BUN, BSA, ISZ.

2. Register-reference instruction (opcode 111111, I=0I=0):

1514-1211-0
0111Register operation (one bit set)

They act on the registers; examples are CLA, CMA, CIR, INC, HLT.

3. Input-output instruction (opcode 111111, I=1I=1):

1514-1211-0
1111I/O operation (one bit set)

Examples are INP, OUT, SKI, SKO, ION, IOF.

The control unit decodes the three opcode bits into D0,…,D7D_0,\ldots,D_7. If D7=0D_7=0 the instruction is a memory-reference instruction; if D7=1D_7=1 and I=0I=0 it is register-reference; if D7=1D_7=1 and I=1I=1 it is input-output.

Fetch routine (symbolic representation). The sequence counter SC gives timing signals T0,T1,T2,…T_0,T_1,T_2,\ldots

T0: AR←PCT_0:\ AR\leftarrow PC T1: IR←M[AR], PC←PC+1T_1:\ IR\leftarrow M[AR],\ PC\leftarrow PC+1 T2: D0,…,D7←Decode IR(12-14), AR←IR(0-11), I←IR(15)T_2:\ D_0,\ldots,D_7\leftarrow \text{Decode }IR(12\text{-}14),\ AR\leftarrow IR(0\text{-}11),\ I\leftarrow IR(15)

  • T0T_0: the address of the next instruction is moved from PC to AR through the common bus.
  • T1T_1: the instruction is read from memory into IR and PC is incremented.
  • T2T_2: the opcode is decoded, the address field is moved to AR and the mode bit is saved in flip-flop II.

After T2T_2, the control unit goes on to the indirect cycle or the execution depending on D7D_7 and II.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 10 marks

What is DMA? Explain the DMA controller with block diagram. How the DMA interact with I/O device.

Answer

DMA (Direct Memory Access). A method of data transfer in which a special controller, the DMA controller, transfers a block of data directly between an I/O device and main memory without CPU intervention for each word. The CPU only sets up the transfer and is interrupted when it is complete. This avoids the overhead of programmed I/O and interrupt-driven I/O and is suited to high-speed devices such as disks.

DMA controller. It contains:

  • Address register: holds the memory address of the next word; it is incremented after every transfer.
  • Word (data) count register: holds the number of words left; it is decremented after each transfer. A zero count shows the end of the block.
  • Control register: specifies the mode (read or write, burst or cycle stealing).
  • Address bus buffers and data bus buffers, and control logic with the DMA request, DMA acknowledge, BR (bus request), BG (bus grant) and interrupt lines.

Block diagram:

                        Address bus (to memory)
                              ^
  CPU <-- BR ---------+  +----+-------------------+
  CPU --- BG -------->|  |  DMA controller         |  <-- DMA request --- I/O device
  CPU <-- Interrupt --+  |  [Address register]     |  --- DMA acknowledge -->
  CPU ---- RD/WR ---->   |  [Word count register]  |
  CPU <--- Data bus --->  |  [Control register]     |  <--> Data to/from device
                         +------------------------+
                              v
                        Main memory (RD/WR)

How the DMA interacts with an I/O device (steps):

  1. The CPU initialises the DMA controller by writing the starting memory address into the address register, the number of words into the word count register, and the direction (read or write) into the control register. Then it carries on with other work.
  2. The I/O device, when ready, sends a DMA request to the controller.
  3. The controller sends BR (bus request) to the CPU.
  4. The CPU completes its current bus cycle, disables its address, data and control buses (puts them in high-impedance state) and replies with BG (bus grant).
  5. The controller sends a DMA acknowledge to the device and puts the address from its address register on the address bus. For a write to memory (input from device), the data from the device is placed on the data bus and the write signal is given; for a read from memory (output), the word is read and passed to the device.
  6. The address register is incremented and the word count is decremented. Steps 2-5 repeat for each word.
  7. When the word count reaches zero, the controller releases the bus (BR =0=0) and raises an interrupt to the CPU. The CPU gets control of the bus again.

Modes of transfer:

  • Burst (block) mode: the controller holds the bus until the whole block has been transferred; the CPU is idle.
  • Cycle stealing: the controller takes the bus for one memory cycle for each word and returns it, which slows the CPU only slightly.

Advantages: high speed data transfer and less CPU load. Disadvantage: extra hardware and the CPU may be delayed when the bus is stolen.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What is arithmetic overflow? How can it be detected?

Answer

Arithmetic overflow. When two numbers of nn bits are added (or subtracted) and the result needs more than nn bits to be represented correctly, the result is out of range and the sign bit of the answer is wrong. This is called an arithmetic overflow. It can happen only when two numbers of the same sign are added (or numbers of opposite sign are subtracted, since that is addition of the same sign). For nn-bit 2's complement numbers, the range is −2n−1-2^{n-1} to 2n−1−12^{n-1}-1.

Example (4 bits, range −8-8 to +7+7): 5+45+4:

0101+0100=10010101+0100=1001

The result 10011001 is read as −7-7, which is wrong, since 5+4=9>75+4=9>7. Another example: (−5)+(−4)(-5)+(-4): 1011+1100=101111011+1100=10111, drop the carry to get 0111=+70111=+7, wrong, since the true answer −9<−8-9<-8.

Detection.

  1. Sign-bit rule: Overflow occurs if two positive numbers give a negative sum, or two negative numbers give a positive sum. Adding numbers of opposite sign never overflows.
  2. Carry rule: Overflow occurs when the carry into the sign bit is different from the carry out of the sign bit: V=Cn−1⊕CnV=C_{n-1}\oplus C_n with an XOR gate on those two carries of the last stage of the adder. V=1V=1 means overflow, and it is stored in an overflow flip-flop.

Check with 5+45+4: the carry into the sign bit is 11 (from 1+11+1 in bit 2), the carry out is 00, so V=1⊕0=1V=1\oplus 0=1: overflow. For 3+2=0011+0010=01013+2=0011+0010=0101: carry in =0=0, carry out =0=0, V=0V=0: no overflow.

For unsigned numbers, overflow is simply a carry out of the most significant bit.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What do you mean by error correction codes? Explain any one of error correction technique.

Answer

Error-correcting codes. When data is stored or transmitted, noise can change bits. An error-detecting code, such as a parity bit, only shows that an error exists. An error-correcting code (ECC) adds redundant check bits so that the receiver can detect the position of an erroneous bit and correct it by inverting it. They are used in memory systems and communication.

Hamming code (single-error correcting). For mm data bits, kk parity bits are added so that 2k≥m+k+1.2^{k}\ge m+k+1. For 4 data bits, k=3k=3 and the word has 7 bits. The bits are numbered 1 to 7; the parity bits P1,P2,P4P_1,P_2,P_4 are in positions that are powers of 2 and the data bits are in the other positions (3, 5, 6, 7).

Each parity bit checks the positions in which the corresponding bit of the position number is 1 (even parity):

  • P1P_1 checks positions 1, 3, 5, 7.
  • P2P_2 checks positions 2, 3, 6, 7.
  • P4P_4 checks positions 4, 5, 6, 7.

Example. Data D=1011D=1011, i.e. positions 3, 5, 6, 7 hold 1,0,1,11,0,1,1.

  • P1P_1: bits 3, 5, 7 are 1,0,11,0,1 (sum 22), so P1=0P_1=0.
  • P2P_2: bits 3, 6, 7 are 1,1,11,1,1 (sum 33), so P2=1P_2=1.
  • P4P_4: bits 5, 6, 7 are 0,1,10,1,1 (sum 22), so P4=0P_4=0.

Codeword (positions 1 to 7): 0 1 1 0 0 1 10\,1\,1\,0\,0\,1\,1.

Detecting and correcting. Suppose position 6 flips during transmission, so 01100010110001 is received. The receiver recomputes the parity checks:

  • C1C_1 (positions 1, 3, 5, 7): 0,1,0,10,1,0,1 gives even, C1=0C_1=0.
  • C2C_2 (positions 2, 3, 6, 7): 1,1,0,11,1,0,1 gives odd, C2=1C_2=1.
  • C4C_4 (positions 4, 5, 6, 7): 0,0,0,10,0,0,1 gives odd, C4=1C_4=1.

The check number C4C2C1=1102=6C_4C_2C_1=110_2=6 gives the position of the erroneous bit. Position 6 is inverted to get back 01100110110011, and the data is 10111011. If C4C2C1=000C_4C_2C_1=000, there is no error.

Adding an overall parity bit gives the SEC-DED code, which corrects one error and detects two errors.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Explain block diagram of microprogram sequencer in brief.

Answer

Microprogram sequencer. In a microprogrammed control unit, the sequencer is the circuit that generates the address of the next microinstruction for the control address register (CAR). It supports sequential execution, conditional and unconditional branches, subroutine call and return, and mapping from the opcode of the instruction.

Block diagram:

 Instruction opcode --> [Mapping logic] ----+
 Branch address (from microinstruction) ----+
 SBR (subroutine register) -----------------+--> [MUX 1] --> [CAR] --> [Control memory]
 CAR + 1 ([Incrementer]) -------------------+       ^           |  \--> CAR+1 --> SBR (load by L)
                                                    | S1 S0     v
 Status bits --> [MUX 2] -- T --> [Input logic] ----+      Microinstruction
                    ^                   ^                  (fields: F, CD, BR, AD)
                    | CD field          | BR field (I1 I0)

Parts and functions:

  • MUX 1 selects the next address among four sources: CAR+1CAR+1 (S1S0=00S_1S_0=00), branch address from the AD field (0101), the subroutine register SBR (1010) and the mapping logic (1111).
  • MUX 2 is controlled by the CD field and selects one of the status bits (or a constant 11 for an unconditional branch); its output is the test bit TT.
  • Input logic has inputs I1I0I_1I_0 (from the BR field) and TT, and gives the MUX 1 select lines S1S0S_1S_0 and the load signal LL for SBR.
  • Incrementer adds 1 to CAR for sequential flow.
  • SBR stores the return address (CAR+1CAR+1) on a call and supplies it for the return.
  • Mapping logic converts the opcode bits of the instruction to the start address of its microroutine.

Operation. The microinstruction read from control memory goes to the microinstruction register; its CD and BR fields give the test and the branch type. The sequencer then loads CAR with the chosen address: next sequential address, branch address, return address or mapped address.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What is cache memory? Explain the elements of cache design.

Answer

Cache memory. A small, fast memory between the CPU and main memory that keeps copies of the frequently used data and instructions. Because of locality of reference, most accesses are hits and the average access time comes close to the cache access time.

Elements of cache design.

  1. Cache size. The cache should be large enough that the average access time is near that of the cache, and small enough that cost and the time to search stay low. Larger caches are slower and costlier.

  2. Mapping function. Decides where a main-memory block is placed in the cache: direct (one fixed line, j mod mj \bmod m), fully associative (any line) or set-associative (any line within a set).

  3. Replacement algorithm. Chooses which block is removed when a new block must come in and no space is free: LRU (least recently used), FIFO, LFU (least frequently used) or random. Direct mapping needs none.

  4. Write policy. Keeps main memory consistent with the cache: write-through (every write goes to both cache and memory; simple but generates memory traffic) or write-back (write only to the cache and mark the line dirty; the line is written to memory on replacement). In multiprocessors, cache coherence is also needed.

  5. Line (block) size. A larger block brings more nearby data (spatial locality) and raises the hit ratio at first, but too large a block means fewer lines and more useless data, and the hit ratio falls. Sizes of 8 to 64 bytes are common.

  6. Number of caches. Multi-level caches (L1, L2, L3), where L1 is small and fast and the next levels are larger and slower; and unified or split caches, where a split cache keeps instructions and data separate to avoid contention in pipelined processors.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What is micro operation? Explain different arithmetci microoperations.

Answer

Micro-operation. A micro-operation is an elementary operation performed on data stored in registers during one clock pulse. A machine instruction is executed as a sequence of micro-operations (for example R1←R2+R3R1 \leftarrow R2 + R3). Micro-operations are of four types: register transfer, arithmetic, logic and shift.

Arithmetic micro-operations. These perform arithmetic on numeric data held in registers.

Symbolic notationDescription
R3←R1+R2R3 \leftarrow R1 + R2Add contents of R1 and R2, store in R3
R3←R1−R2R3 \leftarrow R1 - R2Subtract R2 from R1
R2←R2‾R2 \leftarrow \overline{R2}Complement (1's complement) of R2
R2←R2‾+1R2 \leftarrow \overline{R2} + 12's complement (negate) of R2
R3←R1+R2‾+1R3 \leftarrow R1 + \overline{R2} + 1Subtraction using 2's complement
R1←R1+1R1 \leftarrow R1 + 1Increment
R1←R1−1R1 \leftarrow R1 - 1Decrement

1. Add. The contents of two registers are added by a parallel adder (a chain of full adders) and the sum is loaded into the destination register.

2. Subtract. Done by adding the 2's complement of the subtrahend: R1−R2=R1+R2‾+1R1 - R2 = R1 + \overline{R2} + 1. The complement is obtained with inverters and the extra 1 is supplied as the input carry of the adder.

3. Increment and decrement. Add 1 to, or subtract 1 from, a register. An up/down counter or a half-adder chain with one input fixed to 1 does this.

4. Complement and negate. The 1's complement flips every bit; the 2's complement (negation) is the 1's complement plus 1.

Binary adder-subtractor. A single circuit does both add and subtract. Each bit of BB is XORed with a mode input MM and MM is also fed as the input carry C0C_0 of the nn-bit adder.

  • M=0M = 0: B⊕0=BB \oplus 0 = B, C0=0C_0 = 0, so the output is A+BA + B.
  • M=1M = 1: B⊕1=B‾B \oplus 1 = \overline{B}, C0=1C_0 = 1, so the output is A+B‾+1=A−BA + \overline{B} + 1 = A - B.

Overflow is detected as V=Cn⊕Cn−1V = C_{n} \oplus C_{n-1} (carry into and out of the sign bit).

Binary incrementer. A chain of half adders, with the input carry of the first fixed to 1, gives A+1A + 1.

Arithmetic circuit. By selecting the second operand of the adder through a multiplexer (B, B‾\overline{B}, all 0s or all 1s) and the carry input, one circuit produces: A+BA+B, A+B+1A+B+1, A+B‾A+\overline{B}, A+B‾+1A+\overline{B}+1 (A−BA-B), AA, A+1A+1, A−1A-1 (adding all 1s), and transfer of AA.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

What do you mean by pipelining concept? Discuss various pipeline hazards and their solutions in detail.

Answer

Pipelining. Pipelining is a technique in which the execution of an instruction (or arithmetic task) is divided into several sub-operations (segments or stages), each handled by a dedicated segment, so that different instructions are at different stages at the same time. Like an assembly line, a new instruction enters the pipeline every clock cycle, so after the pipeline fills one instruction completes per cycle.

For kk stages, nn instructions and clock time tpt_p, the time is (k+n−1)tp(k + n - 1)t_p against nktpn k t_p without a pipeline, so the speedup is

S=nkk+n−1→k as n→∞S = \frac{n k}{k + n - 1} \rightarrow k \text{ as } n \rightarrow \infty

Pipeline hazards. A hazard is a situation that stops the next instruction from executing in its designated clock cycle, producing a stall and lowering throughput. There are three kinds.

1. Structural hazard (resource conflict). Two instructions need the same hardware resource in the same cycle, for example one memory used for both instruction fetch and operand access.

Solutions: separate instruction and data memories/caches, duplicate or pipeline functional units, add more register-file ports, or stall one instruction.

2. Data hazard. An instruction depends on the result of an earlier instruction that has not yet finished.

  • RAW (read after write): ADD R1,R2,R3 followed by SUB R4,R1,R5. The SUB reads R1 before it is written.
  • WAR (write after read) and WAW (write after write) occur when instructions are reordered or complete out of order.

Solutions:

  • Operand forwarding (bypassing): feed the ALU output straight back to the ALU input of the next instruction.
  • Pipeline interlock/stall (hardware): detect the dependency and insert bubbles until the data is ready.
  • Compiler scheduling: reorder independent instructions or insert NOPs (delayed load).
  • Register renaming removes WAR and WAW hazards.

3. Control (branch) hazard. A branch or jump changes the program counter, so instructions already fetched after it may be wrong and must be discarded.

Solutions:

  • Pipeline flushing / stalling until the branch is resolved.
  • Branch prediction (static or dynamic with a branch history table), with a branch target buffer.
  • Prefetching both paths (the target and the next sequential instruction).
  • Delayed branch: the compiler fills the slot after the branch with a useful instruction or a NOP.
  • Resolving the branch earlier in the pipeline.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Differentiate between RISC and CISC architecture.

Answer

RISC (Reduced Instruction Set Computer) uses a small set of simple, fixed-length instructions, usually executed in one clock cycle. CISC (Complex Instruction Set Computer) uses a large set of complex instructions, many of which do multi-step work in one instruction.

BasisRISCCISC
Instruction setSmall, simple (about 50-100)Large, complex (200+)
Instruction lengthFixedVariable
Execution timeMostly one cycle per instructionMany cycles, varies by instruction
Addressing modesFew, simpleMany, complex
Memory accessOnly LOAD and STORE access memory; all other work is register to registerAny instruction may access memory directly
RegistersLarge register fileFewer registers
Control unitHardwired, fastMicroprogrammed (control memory)
PipeliningEasy and efficientDifficult because of varying length and time
Code sizeLarger programs (more instructions)Smaller programs
CompilerComplexity is in the compilerComplexity is in the hardware
Hardware cost/chip areaSimple hardware, space for registers/cacheComplex, more transistors for control
ExamplesARM, MIPS, SPARC, PowerPCIntel x86, VAX, IBM 360

Summary: RISC trades longer programs for fast, pipelined, simple hardware; CISC trades hardware complexity for compact programs and a smaller semantic gap with high-level languages.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2080 · 5 marks

Write short notes on (any two)
  • Control ROM
  • Common Bus System
  • Flynn’s Classification

Answer

(a) Control ROM (control memory). In a microprogrammed control unit, the control information is stored as microinstructions in a read-only memory called the control ROM (control memory). Each machine instruction is interpreted by a small sequence of microinstructions, called a microprogram or routine.

Organisation:

  • The control address register (CAR) holds the address of the next microinstruction.
  • The control ROM returns the microinstruction, which goes to the control data register (pipeline register).
  • The microinstruction fields (control bits for the datapath, condition select, branch address) drive the registers, ALU and bus.
  • A next-address generator (sequencer) chooses the next CAR value: increment, branch address, a mapped address from the opcode of the instruction register, or a return address.

Advantages: simple to design and modify (changing the ROM changes the instruction set), systematic and flexible. Disadvantage: slower than a hardwired control unit because of the ROM access time.

(b) Common bus system. Several registers need to exchange data. Instead of separate lines between each pair, a single set of shared lines (the common bus) is used, and a selection mechanism decides which register places data on it.

  • Multiplexers (or three-state buffers) with select lines S2S1S0S_2S_1S_0 choose which register output drives the bus. For example, S2S1S0=001S_2S_1S_0 = 001 selects AR, 010010 selects PC, 011011 selects DR, 100100 selects AC, 101101 selects IR, 110110 selects TR, and 111111 selects memory.
  • Any register may load the bus value when its LD (load) input is enabled with a clock pulse; INR and CLR control increment and clear.
  • Memory is read/written through the bus using the address in AR.

Benefit: far fewer wires and low cost; limitation: only one transfer can occur per clock cycle.

(c) Flynn's classification. Flynn classifies computers by the number of instruction streams and data streams that can be processed at one time.

ClassInstruction streamData streamExample
SISDSingleSingleConventional uniprocessor
SIMDSingleMultipleArray/vector processors, GPUs
MISDMultipleSingleRare; fault-tolerant/systolic pipelines
MIMDMultipleMultipleMultiprocessors, multicore, clusters

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

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

Answer

Pipelining. Pipelining is a technique of decomposing a sequential process into sub-operations (segments), each executed in a dedicated segment that works concurrently with the others. Several tasks are therefore in different stages at the same time, and results flow from segment to segment like items on an assembly line. Registers between segments hold intermediate results so that each segment works independently.

Four-segment instruction pipeline. The instruction cycle is divided into four segments:

  1. FI (Fetch Instruction): fetch the instruction from memory.
  2. DA (Decode and calculate Address): decode the instruction and calculate the effective address of the operand.
  3. FO (Fetch Operand): fetch the operand from memory.
  4. EX (Execute): execute the operation and store the result.

Space-time diagram for four instructions (clock cycles 1 to 7):

Instruction1234567
I1FIDAFOEX
I2FIDAFOEX
I3FIDAFOEX
I4FIDAFOEX

In a non-pipelined machine, four instructions need 4×4=164 \times 4 = 16 cycles. In the pipeline they need k+n−1=4+4−1=7k + n - 1 = 4 + 4 - 1 = 7 cycles.

Speedup=nktn(k+n−1)tp=167≈2.29\text{Speedup} = \frac{n k t_n}{(k + n - 1)t_p} = \frac{16}{7} \approx 2.29

As nn grows, the speedup approaches k=4k = 4.

When a branch instruction is executed, the instructions already fetched after it must be discarded (control hazard), and data dependencies between instructions may cause stalls. The pipeline then delivers less than one instruction per cycle.

Advantages of pipelining.

  • Higher instruction throughput: one instruction completes per clock cycle once the pipeline is full.
  • Better utilisation of hardware units, since all segments are busy at once.
  • Speedup of up to kk times without raising clock speed or duplicating the whole unit.
  • Overall program execution time falls, while the CPU can run at the clock rate of its slowest stage.

Limitations are hazards (structural, data, control) and the extra cost of segment registers and control.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

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

Answer

Priority interrupt. In a system with many I/O devices, several devices may request an interrupt at the same time. A priority interrupt system establishes a priority among the sources, so that the device with the highest priority is serviced first, and a lower-priority device cannot interrupt a higher-priority service routine, while a higher-priority device can interrupt a lower-priority one. Priority can be set by software (polling) or hardware (daisy-chaining, parallel priority).

1. Polling (software method). On an interrupt, a common branch address starts a program that polls each device in order of priority, testing the interrupt flag (status) of each in turn. The first device found with its flag set is serviced. The order of polling is the order of priority.

  • Advantage: simple, no special hardware, priority can be changed by changing the polling order.
  • Disadvantage: slow, because time is spent polling devices before the interrupting device is identified.

2. Daisy chaining (serial hardware priority). The devices are connected in series. The interrupt request line is shared (wired-OR). The CPU's interrupt acknowledge (INTACK) signal enters the first device (highest priority) and passes through each device via a PI (priority in) to PO (priority out) path.

  • If a device did not request an interrupt, it passes PI to PO (PO = 1 if PI = 1).
  • If a device requested an interrupt and PI = 1, it blocks the signal (PO = 0) and places its vector address (VAD) on the data bus.
  • Devices further down the chain therefore get lower priority.

Advantage: simple, cheap and expandable. Disadvantage: priority is fixed by position, and the acknowledge signal must ripple through the chain, so it is slow for long chains.

3. Parallel priority interrupt. Each device has its own interrupt line, connected to a bit of an interrupt register. Each bit can be masked by a bit of the mask register. A priority encoder takes the unmasked requests and produces a 2-bit code (x,y)(x, y) for the highest-priority requesting device, which is used as part of the vector address, and the interrupt status flag IST is set when any unmasked request exists.

  • Masking lets the system disable low-priority devices selectively (for example, while a high-priority device is being served).
  • The mask register can be programmed, so priority handling is flexible.

Advantage: the fastest, as the priority is decided by hardware in parallel, and flexible through masking. Disadvantage: more hardware and cost.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 10 marks

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

Answer

Addition and subtraction of signed 2's complement numbers. Negative numbers are stored in 2's complement form, and the sign bit is treated as part of the number. Addition is done by adding the two numbers, including their sign bits, and discarding the carry out of the sign bit. Subtraction A−BA - B is done by adding the 2's complement of BB to AA. Overflow is detected when the carry into the sign bit differs from the carry out of it.

Flowchart (algorithm).

              START
                |
   AC <- multiplicand A,  BR <- B
                |
         Add or subtract?
        /                 \
     Add                  Subtract
      |                      |
  AC <- AC + BR       AC <- AC + BR' + 1
      V <- overflow       V <- overflow
        \                 /
         V = 1 ?
        /       \
      Yes        No
       |          |
   Overflow     Result is in AC
       \        /
          END

Steps: load the first operand into AC and the second into BR. For addition, compute AC←AC+BRAC \leftarrow AC + BR. For subtraction, complement every bit of BR, add 1 and then add it to AC, i.e. AC←AC+BR‾+1AC \leftarrow AC + \overline{BR} + 1. Set the overflow flag V=Cn−1⊕CnV = C_{n-1} \oplus C_n. If V=1V = 1 the answer is out of range; otherwise AC holds the result.

Perform 90 - 43 (8-bit).

90=0101 101090 = 0101\,1010, 43=0010 101143 = 0010\,1011.

1's complement of 43: 1101 01001101\,0100. Add 1: 1101 01011101\,0101, which is −43-43.

Now 90+(−43)90 + (-43):

0101 1010+  1101 01011 0010 1111\begin{array}{r} 0101\,1010 \\ +\;1101\,0101 \\ \hline 1\,0010\,1111 \end{array}

The carry out of the sign bit (the leftmost 1) is discarded, leaving 0010 11110010\,1111.

Carry into the sign bit is 1 and the carry out of the sign bit is 1, so V=1⊕1=0V = 1 \oplus 1 = 0 and there is no overflow.

0010 1111=32+8+4+2+1=470010\,1111 = 32 + 8 + 4 + 2 + 1 = 47, which equals 90−43=4790 - 43 = 47.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

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

Answer

Parity bit. A parity bit is an extra bit added to a group of data bits to detect single-bit errors in transmission or storage. In even parity the parity bit PP is chosen so that the total number of 1s in the data bits plus the parity bit is even. The parity bit is therefore the XOR of the data bits: P=D1⊕D2⊕⋯⊕DnP = D_1 \oplus D_2 \oplus \dots \oplus D_n.

Generation for a 3-bit message (x,y,z)(x, y, z).

xyzNo. of 1s in dataEven parity bit P
00000
00111
01011
01120
10011
10120
11020
11131

From the table, P=x⊕y⊕zP = x \oplus y \oplus z (P is 1 exactly when the number of 1s in the data is odd).

Circuit. The parity generator uses two XOR gates in cascade:

x ──┐
    XOR ──┐
y ──┘     XOR ──── P  (even parity bit)
z ────────┘

Gate 1 gives x⊕yx \oplus y; gate 2 gives (x⊕y)⊕z=P(x \oplus y) \oplus z = P. The transmitted word is x y z Px\,y\,z\,P.

Checking at the receiver. The parity checker is a 4-input XOR of x,y,z,Px, y, z, P (three XOR gates). The output C=x⊕y⊕z⊕PC = x \oplus y \oplus z \oplus P is 0 when no error has occurred (even number of 1s) and 1 when a single-bit error has occurred. Parity cannot detect an even number of bit errors and cannot locate the error.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

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

Answer

Instruction format. An instruction format is the layout of the bits of an instruction, divided into fields: the operation code (opcode), which specifies the operation, the addressing-mode bit, and the address or operand fields. It tells the control unit how to interpret the instruction.

Instruction formats of the basic computer. The basic computer has 16-bit instructions and a 12-bit address. The three formats are:

1. Memory-reference instructions. Bits 12-14 hold the opcode (000 to 110), bit 15 is the addressing mode II (0 = direct, 1 = indirect), and bits 0-11 hold the address.

1514-1211-0
IOpcode (000-110)Address

Examples: AND (opcode 000), ADD (opcode 001; AC←AC+M[AR]AC \leftarrow AC + M[AR]), LDA (010), STA (011), BUN (100), BSA (101), ISZ (110).

2. Register-reference instructions. Bits 12-15 are 01110111 (opcode 111 with I=0I = 0), and bits 0-11 select one register operation (one bit set per instruction).

15-1211-0
0111Register operation

Examples: CLA (clear AC, 7800 hex), CMA (complement AC, 7200 hex), also INC, CIR, HLT.

3. Input-output instructions. Bits 12-15 are 11111111 (opcode 111 with I=1I = 1), and bits 0-11 select an I/O operation.

15-1211-0
1111I/O operation

Examples: INP (input character to AC, F800 hex), OUT (output character from AC, F400 hex), also SKI, SKO, ION, IOF.

The control decides the type from bits 12-14 and 15: if the opcode is not 111 it is memory-reference; if it is 111 and I=0I = 0 register-reference; if I=1I = 1 input-output.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

What microoperations are performed in fetch phase of instruction cycle of basic computer? Explain with suitable circuit diagram.

Answer

Fetch phase. The instruction cycle of the basic computer is fetch, decode, read the effective address (for indirect), and execute. The fetch phase reads the instruction from the memory address held in PC, puts it in IR and increments PC. It is controlled by the timing signals T0,T1,T2T_0, T_1, T_2 from a sequence counter SC (with R′R' meaning no interrupt pending).

Microoperations of fetch (when R′=1R' = 1).

R′T0:AR←PCR'T_0: AR \leftarrow PC

R′T1:IR←M[AR],  PC←PC+1R'T_1: IR \leftarrow M[AR],\; PC \leftarrow PC + 1

R′T2:D0,…,D7←Decode IR(12-14),  AR←IR(0-11),  I←IR(15)R'T_2: D_0, \dots, D_7 \leftarrow \text{Decode } IR(12\text{-}14),\; AR \leftarrow IR(0\text{-}11),\; I \leftarrow IR(15)

  • T0T_0: the address of the next instruction is transferred from PC to the address register AR.
  • T1T_1: the instruction is read from memory at address AR into IR, and PC is incremented to point to the next instruction.
  • T2T_2: the opcode bits 12-14 are decoded into D0…D7D_0 \dots D_7, the address part is copied to AR, and the mode bit goes to flip-flop II.

Circuit (bus transfers).

 SC --> 3x8 decoder --> T0, T1, T2 ...
 
 T0: S2S1S0 = 010 (select PC on bus) ; LD(AR) = 1
 T1: S2S1S0 = 111 (select memory)    ; Read = 1 ; LD(IR) = 1 ; INR(PC) = 1
 T2: LD(AR) <- IR(0-11) ; decoder 3x8 on IR(12-14) ; I <- IR(15)

In the common-bus circuit, T0T_0 puts PC on the bus and enables the load input of AR. At T1T_1 the memory output is selected on the bus, the read signal is on, IR loads the bus and PC receives an increment pulse. At T2T_2 the opcode in IR is decoded by a 3-to-8 decoder to give D0D_0 to D7D_7 and the address bits of IR load AR, while IR bit 15 is stored in flip-flop II. After T2T_2, the control goes on to the execute phase (or the indirect-address cycle at T3T_3 if D7′I=1D_7' I = 1).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

What do you understand by Flynn’s classification? Explain.

Answer

Flynn's classification. Michael Flynn (1966) classified computer architectures by the number of instruction streams (sequence of instructions executed) and data streams (sequence of data operated on) that can be processed simultaneously. This gives four classes.

1. SISD (Single Instruction, Single Data). One control unit fetches one instruction stream and executes it on one data stream. Instructions are executed sequentially (although they may overlap through pipelining). Example: a conventional uniprocessor, the classic von Neumann machine.

2. SIMD (Single Instruction, Multiple Data). One control unit broadcasts the same instruction to many processing elements, each operating on its own data. It suits data-parallel work such as array and matrix computation, image processing and graphics. Examples: array processors, vector processors, GPUs, SSE/AVX.

3. MISD (Multiple Instruction, Single Data). Several processing units execute different instructions on the same data stream. It is rarely built; examples are systolic arrays and some fault-tolerant systems where several units process the same data and vote.

4. MIMD (Multiple Instruction, Multiple Data). Multiple processors each execute their own instruction stream on their own data, asynchronously. This is the architecture of multiprocessors and multicomputers. Examples: multicore CPUs, SMP servers, clusters, distributed systems. It may be shared-memory (tightly coupled) or distributed-memory (loosely coupled).

ClassInstruction streamsData streamsExample
SISD11Single-core CPU
SIMD1ManyVector processor, GPU
MISDMany1Systolic array
MIMDManyManyMulticore, cluster

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

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

Answer

Importance of the I/O interface. Peripheral devices differ greatly from the CPU and memory, so a direct connection is not possible. An I/O interface is needed because:

  • Peripherals are electromechanical devices whose speed is much lower than that of the CPU, so synchronisation is needed.
  • Their data formats and word lengths differ from those of the CPU, so the data must be converted (serial/parallel).
  • Their signal levels and operating modes are different, so the interface converts them to levels the CPU bus accepts.
  • The CPU must be able to select one device out of many (address decoding) and to read device status and send control commands.
  • The interface buffers data and, with interrupts or DMA, lets the CPU do other work.

Programmed I/O. In programmed I/O, the transfer of data between the CPU and an I/O device is controlled by instructions in the CPU program. The CPU executes a program that initiates the transfer, and then keeps checking the device's status flag in a loop (polling or busy waiting) until the device is ready. The CPU then transfers the data.

Procedure for input (device to CPU).

  1. The CPU reads the status register of the interface.
  2. If the flag shows the device is not ready, repeat step 1 (busy wait).
  3. If it is ready, read the data register of the interface into a CPU register (the accumulator).
  4. Write the data from the CPU register to memory.
  5. Check whether all words are transferred; if not, return to step 1.

Flowchart for input (data transfer from I/O device to CPU).

 START
   |
   v
 Read status register  <-----------+
   |                               |
 Flag set (ready)? --No------------+
   | Yes
   v
 Read data register -> CPU (AC)
   |
 Transfer data from AC to memory
   |
 More words? --Yes--> (back to Read status register)
   | No
 END

For output, the CPU waits for the device to be ready, writes the word to the data register, and the interface sets the flag to "busy" until the device has accepted it.

Drawback: the CPU wastes time in the polling loop because the device is much slower, so programmed I/O is suitable only for simple or small systems. Interrupt-driven I/O and DMA remove this waste.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

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

Answer

Cache mapping. The cache is much smaller than main memory, so a rule is needed to decide where a block of main memory is placed in the cache and how it is found. This rule is the mapping function. The three techniques are direct mapping, associative mapping and set-associative mapping.

Direct mapping. Each block of main memory can go to only one specific cache line, given by

Cache line=(Main memory block number) mod (number of lines in cache)\text{Cache line} = (\text{Main memory block number}) \bmod (\text{number of lines in cache})

The CPU's address is divided into three fields:

TagIndex (line)Word/offset
high-order bitsselects the cache lineselects the word in the block

Example: with a main memory of 32K words (15-bit address) and a cache of 512 words, the address is split into a 6-bit tag, a 9-bit index. (Using one word per block.) The cache stores, with each line, the tag and the data.

Working (block diagram described).

 CPU address:  [ Tag | Index | Word ]
                 |      |
                 |      v
                 |   Cache memory (index selects one line)
                 |   [ valid | tag | data ] 
                 v           |
            Comparator <------+  (stored tag)
                 |
          match? -- Yes -> HIT : data to CPU
                 -- No  -> MISS: read block from main memory,
                            store it with the new tag in that line,
                            send data to CPU
  1. The index field of the CPU address selects one line of the cache.
  2. The tag stored in that line is compared with the tag field of the address.
  3. If they match (and the valid bit is 1) it is a hit and the word is delivered from the cache.
  4. Otherwise it is a miss: the block is fetched from main memory, replaces whatever block was in the line and the tag is updated.

Advantages: simple and cheap, needs only one comparator, no replacement algorithm. Disadvantage: if two frequently used blocks map to the same line they keep replacing each other (conflict misses, thrashing), so the hit ratio can be low.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Explain different types of shift microoperations.

Answer

Shift microoperations. Shift microoperations move the bits of a register left or right, and are used for serial transfer, for multiplication/division by powers of 2 and for other data manipulation. The bit shifted in and out depends on the type. There are three types: logical, circular and arithmetic.

1. Logical shift. A logical shift moves the bits and inserts 0 at the vacated end. The bit shifted out is lost (or goes to a carry).

  • Shift left: shl R1 means R1←shl R1R1 \leftarrow shl\,R1
  • Shift right: shr R1 means R1←shr R1R1 \leftarrow shr\,R1

Example: R1 = 1011; shl gives 0110 (the serial input is 0); shr gives 0101.

2. Circular shift (rotate). The bit shifted out at one end is fed back into the other end, so no data is lost.

  • Circular left cil R1: R1←cil R1R1 \leftarrow cil\,R1
  • Circular right cir R1: R1←cir R1R1 \leftarrow cir\,R1

Example: R1 = 1011; cil gives 0111; cir gives 1101.

3. Arithmetic shift. This shifts a signed binary number while keeping its sign.

  • Arithmetic shift right (ashr) keeps the sign bit and shifts the other bits right, copying the sign: R←ashr RR \leftarrow ashr\,R. It divides the number by 2. Example: 1100 (-4) becomes 1110 (-2).
  • Arithmetic shift left (ashl) shifts all bits left and inserts 0 at the right; it multiplies by 2. Overflow occurs if the sign bit changes: V=Rn−1⊕Rn−2V = R_{n-1} \oplus R_{n-2}. Example: 0011 (3) becomes 0110 (6).

Hardware. A bidirectional shift register with parallel load can implement all shifts. A combinational shifter built with multiplexers has, for each bit position, a 4-to-1 multiplexer with inputs from the left neighbour, the right neighbour, and the register bit itself, and with the selection signals SS determining the shift direction. The serial inputs (I_L and I_R) supply 0, the circulated bit, or the sign bit depending on the type of shift.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2081 · 5 marks

Write short notes on: a) CISC b) Conditional branch

Answer

(a) CISC (Complex Instruction Set Computer). A CISC processor has a large instruction set of powerful, complex instructions, often with variable length and many addressing modes. A single instruction can do a multi-step job, for example loading from memory, performing arithmetic and storing back.

Features:

  • Large number of instructions (typically over 200) and 5 to 20 addressing modes.
  • Variable-length instruction formats and different execution times.
  • Direct memory-to-memory operations are possible.
  • Control unit is usually microprogrammed.
  • Fewer registers.
  • Compact programs, which reduces the semantic gap with high-level languages.

Advantages: small programs and less memory used; simple compiler design. Disadvantages: complex hardware, difficult to pipeline, slow clock cycle; many instructions are rarely used. Examples: Intel x86, VAX, IBM System/360.

(b) Conditional branch. A conditional branch instruction changes the flow of a program, i.e. loads the PC with the target address, only if a specified condition is true; otherwise execution continues with the next instruction. The condition is based on the status flags (condition codes) set by earlier instructions: carry C, sign S, zero Z, overflow V, and so on.

Examples:

InstructionBranch condition
BZ (branch if zero)Z = 1
BNZ (branch if not zero)Z = 0
BC (branch if carry)C = 1
BN (branch if minus)S = 1
BV (branch if overflow)V = 1
BP (branch if plus), BGT, BLT etc.Based on signed or unsigned comparison

Operation: if (condition) PC←PC \leftarrow effective address, else PC←PC+1PC \leftarrow PC + 1. A comparison instruction such as CMP A, B sets flags first and then the branch tests them. Conditional branches are used to implement if, loops and decisions. In pipelined machines they cause control hazards, handled by branch prediction and delayed branching. An unconditional branch (jump) always changes the PC.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

Questions from TU BSc CSIT 2075 Third Semester Numerical Method (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Numerical Method (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Numerical Method (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Numerical Method (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Numerical Method (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Numerical Method (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Computer Architecture (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Computer Architecture (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Computer Architecture (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Computer Architecture (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Computer Architecture (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Computer Architecture (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Computer Graphics (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Computer Graphics (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Computer Graphics (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Computer Graphics (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Computer Graphics (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Computer Graphics (TU IOST board exam, 2081), TU BSc CSIT 2082 Third Semester Computer Graphics (TU IOST board exam, 2082), TU BSc CSIT 2074 Third Semester Data Structures and Algorithms (TU IOST board exam, 2074), TU BSc CSIT 2075 Third Semester Data Structures and Algorithms (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Data Structures and Algorithms (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Data Structures and Algorithms (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Data Structures and Algorithms (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Data Structures and Algorithms (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Data Structures and Algorithms (TU IOST board exam, 2081), TU BSc CSIT 2075 Third Semester Statistics II (TU IOST board exam, 2075), TU BSc CSIT 2077 Third Semester Statistics II (TU IOST board exam, 2077), TU BSc CSIT 2078 Third Semester Statistics II (TU IOST board exam, 2078), TU BSc CSIT 2079 Third Semester Statistics II (TU IOST board exam, 2079), TU BSc CSIT 2080 Third Semester Statistics II (TU IOST board exam, 2080), TU BSc CSIT 2081 Third Semester Statistics II (TU IOST board exam, 2081) and TU BSc CSIT 2082 Third Semester Statistics II (TU IOST board exam, 2082). Answers are written for this site; check them against your class notes.