2022 question paper
COMPUTER ORGANIZATION & ARCHITECTURE
22 questions
Q1(a). (a) The 8-bit encoding format used to store data in a computer is (i) ASCII (ii) EBCDIC (iii) ANCI (iv) USCII20222m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →(a) The 8-bit encoding format used to store data in a computer is
(i) ASCII
(ii) EBCDIC
(iii) ANCI
(iv) USCIIWorked SolutionAnswer: (ii) EBCDIC (8-bit) — with note:
- EBCDIC (Extended Binary Coded Decimal Interchange Code) is 8-bit encoding used in IBM mainframes to store data. ASCII is originally 7-bit (extended 8-bit later), but classic textbook for 8-bit format cites EBCDIC.
- USCII/ANCI are not standard encodings.
If strict modern context: Extended ASCII is also 8-bit, but among given options EBCDIC is the intended 8-bit format. Some keys mark EBCDIC as correct.
Q1(b). (b) The bus used to connect the monitor to the CPU is (i) PCI bus (ii) SCSI bus (iii) memory bus (iv) ram bus20222m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →(b) The bus used to connect the monitor to the CPU is
(i) PCI bus
(ii) SCSI bus
(iii) memory bus
(iv) ram busWorked SolutionAnswer: (i) PCI bus
Explanation: PCI (Peripheral Component Interconnect) bus is commonly used to connect graphics/monitor via graphics adapter to CPU. SCSI is for disks, memory bus connects CPU to main memory. RAM bus is not standard term for monitor connection. Modern: PCIe for graphics.
Q1(c). \(c\) The alternate way of writing the instruction, ADD #5, R1 is (i) ADD [5],[R1]; (ii) ADDI 5,R1; (iii) ADDIME 5,[R1]; (iv) There is no other way20222m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →(c) The alternate way of writing the instruction, ADD #5, R1 is
(i) ADD [5],[R1];
(ii) ADDI 5,R1;
(iii) ADDIME 5,[R1];
(iv) There is no other wayWorked SolutionAnswer: (ii) ADDI 5, R1
Explanation:
ADD #5, R1is Immediate addressing mode -#5denotes constant 5 as operand, added to register R1.ADDI= ADD Immediate - dedicated mnemonic for immediate operation.ADDI 5,R1is architecturally identical toADD #5,R1.- (i)
ADD [5],[R1]- is direct/memory addressing, wrong. - (iii)
ADDIMEis not a standard mnemonic.
Note: Syntax varies by assembler (
ADD R1, #5), butADDIis the conventional alternate.Q1(d). (d) The instruction fetch phase ends with (i) placing the data from the address in MAR into MDR (ii) placing the address of the data into MAR (iii) completing the execution of the data and placing its storage address into MAR (iv) decoding the data in MDR and placing it in IR20222m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →(d) The instruction fetch phase ends with
(i) placing the data from the address in MAR into MDR
(ii) placing the address of the data into MAR
(iii) completing the execution of the data and placing its storage address into MAR
(iv) decoding the data in MDR and placing it in IR
Worked SolutionAnswer: (iv) decoding the data in MDR and placing it in IR
Explanation:
Instruction Fetch Cycle steps:MAR ← PC- place address of next instruction in MARMDR ← M[MAR]- read memory word into MDR (option i)IR ← MDR- transfer instruction to Instruction Register and decodePC ← PC + 1
The phase ends when instruction is available in IR for decode/execution. Option (ii) is start of fetch, (i) is middle. Hence (iv) is correct. Note: Some texts stop fetch at MDR loading (i), but classical fetch-decode cycle includes IR loading as final step.
Q1(e). (e) For converting a virtual address into the physical address, the programs are divided into (i) pages (ii) frames (iii) segments (iv) blocks20222m
Module 4: Memory Organization
View this question on its own page →(e) For converting a virtual address into the physical address, the programs are divided into
(i) pages
(ii) frames
(iii) segments
(iv) blocksWorked SolutionAnswer: (i) pages
Explanation:
- Virtual memory - Programs (logical address space) are divided into fixed-size blocks called pages.
- Physical memory is divided into same-size blocks called frames/page frames.
- Page table maps virtual page number → physical frame number for address translation via MMU.
- Segments are variable-size logical divisions (segmentation), while blocks is generic; for pure paging the division is pages.
Hence programs are divided into pages, physical memory into frames.
Q1(f). (f) The transfer of large chunks of data with the involvement of the processor is done by (i) DMA controller (ii) arbitrator (iii) user system programs (iv) None of the above20222m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →(f) The transfer of large chunks of data with the involvement of the processor is done by
(i) DMA controller
(ii) arbitrator
(iii) user system programs
(iv) None of the aboveWorked SolutionAnswer: (i) DMA controller (intended question = WITHOUT processor involvement)
Explanation:
- Large block I/O via Programmed I/O burdens CPU (polling/interrupt per word).
- DMA (Direct Memory Access) controller steals/borrows bus and transfers large chunks directly between I/O and memory without continuous CPU involvement, only initial setup and final interrupt by CPU.
- The question wording "with involvement of the processor" is likely a typo; strictly with involvement would be (iv) None of the above. For "WITHOUT CPU involvement", answer is (i) DMA controller.
DMA registers: Address, Count, Control/Status - handles burst/cycle-stealing modes and bus arbitration.
Q1(g). (g) The computer architecture *aimed at* reducing the time of execution of instructions is (i) CISC (ii) RISC (iii) ISA (iv) ANNA20222m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →(g) The computer architecture aimed at reducing the time of execution of instructions is
(i) CISC
(ii) RISC
(iii) ISA
(iv) ANNAWorked SolutionAnswer: (ii) RISC
Explanation:
- RISC (Reduced Instruction Set Computer): Aimed at reducing CPI / execution time per instruction via simple, fixed-length instructions, load/store architecture, hardwired control, pipelining - executes each instruction in ~1 cycle.
- CISC (Complex Instruction Set Computer): Aimed at reducing number of instructions/code size via complex variable-length instructions, microprogrammed control - but each instruction takes multiple cycles.
- ISA = Instruction Set Architecture (interface), ANNA = not relevant.
Hence architecture focused on time of execution = RISC.
Q1(h). Which table handle stores the addresses of the interrupt handling sub-routines? (i) Interrupt-vector table (ii) Vector table (iii) Symbol link table (iv) None of the above20222m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Which table handle stores the addresses of the interrupt handling sub-routines?
(i) Interrupt-vector table
(ii) Vector table
(iii) Symbol link table
(iv) None of the aboveWorked SolutionAnswer: (i) Interrupt-vector table
Explanation:
- Interrupt Vector Table (IVT) is an array in low memory (e.g., 0x00000 in x86) storing addresses (vectors) of ISRs (Interrupt Service Routines) indexed by interrupt number/type.
- On interrupt, CPU uses interrupt number × entry size to fetch vector and jump to handler.
- Vector table (ii) is generic; Symbol link table is unrelated (linking).
Hence correct is Interrupt-vector table.
Q1(i). (i) The situation wherein the data of operands are not available is called (i) data hazard (ii) stock (iii) deadlock (iv) structural hazard20222m
Module 3: Pipelining
View this question on its own page →(i) The situation wherein the data of operands are not available is called
(i) data hazard
(ii) stock
(iii) deadlock
(iv) structural hazardWorked SolutionAnswer: (i) data hazard
Explanation:
- Data hazard: Operand/data not yet available/computed by previous instruction (RAW - Read After Write) when needed, causing stall.
- Structural hazard: Hardware resource conflict (e.g., same memory port used by two stages).
- Control hazard: Due to branch/jump altering PC.
- Stock/deadlock are not pipeline hazard terms (stock is typo for stall).
Hence unavailable operand = data hazard.
Q1(j). (j) The DMA controller has ____ registers. (i) 4 (ii) 2 (iii) 3 (iv) 120222m
Module 4: Memory Organization
View this question on its own page →(j) The DMA controller has ____ registers.
(i) 4
(ii) 2
(iii) 3
(iv) 1Worked SolutionAnswer: (iii) 3
Explanation:
Standard DMA controller (e.g., Intel 8237) has 3 main registers per channel:- Address Register - holds starting address of memory block (source/destination)
- Word Count Register - number of words/bytes to transfer
- Control/Status Register - direction, mode (burst/cycle stealing), enable
Some descriptions count 4 including Data Buffer register, but classic exam answer is 3 registers.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q2(a). (a). List and briefly define the main structural components of a computer.20227m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →(a). List and briefly define the main structural components of a computer.
Worked SolutionMain Structural Components of a Computer (7M)
Derived from Von Neumann model (Stallings). Four top-level components interconnected via System Bus.
+-------------------+ | System Bus | | A (Address) D (Data) C (Control) | +--+-----+------+---+ | | | +----------+ +---+----+ +--+----------+ | CPU | | Memory | | I/O System | |Processor | | | |Module/Device| +----------++----+-----+ +-------------+ | | | (Control, ALU, Registers)1. Central Processing Unit (CPU) - Brain
- Function: Fetches instructions, decodes, executes, controls entire system.
- Sub-components:
- ALU (Arithmetic Logic Unit): Performs arithmetic (ADD, SUB, MUL) and logical (AND, OR, NOT, SHIFT). Operates on registers.
- Control Unit (CU): Generates timing & control signals (micro-operations) to coordinate fetch-decode-execute. Hardwired or Microprogrammed.
- Registers: Very fast internal storage - PC (Program Counter), IR (Instruction Register), MAR/MDR (Memory Address/Data Registers), GPRs, PSW/FLAGS, SP.
- Internal Bus: Connects CU-ALU-Registers.
CPU performs Fetch Cycle (MAR <- PC, MDR <- Memory, IR <- MDR, PC++) and Execute Cycle.
2. Main Memory - Storage for Program & Data
- Function: Stores instructions & data temporarily while program runs. Byte-addressable, random access.
- Types: RAM (Volatile, read/write) - DRAM/SRAM for main memory; ROM (Non-volatile) - BIOS, bootstrap.
- Organization: Address space
2^nlocations, n = address bus width (e.g., 32-bit CPU -> 4GB). Memory hierarchy includes Cache (SRAM, L1/L2/L3 between CPU & RAM) to bridge speed gap. - Interface: Address Bus selects location, Data Bus carries data, Control (MEMR/MEMW) signals read/write. Access time ~ 50-100 ns vs CPU cycle ~ 1 ns -> cache needed.
3. I/O System (Input / Output) - Interface to External World
- Function: Transfers data between computer and peripherals / outside. Also called I/O Module / I/O Subsystem.
- Examples: Keyboard, Mouse, Display, Disk, Network card, Printer, Sensors.
- I/O Module Functions: Control & timing, CPU communication (decode address, data buffering), device communication, error detection.
- Techniques: Programmed I/O, Interrupt-driven I/O, DMA (direct memory access). Includes ports, device controllers, bus adapters.
4. System Bus - Communication Highway
- Function: Set of shared communication lines interconnecting CPU, Memory, I/O. Uses bus protocols/arbitration.
Three buses (can be multiplexed):
- Address Bus (Unidirectional, CPU -> Memory/I/O): Carries address
k-bits to select one of2^klocations. With 32-bit bus => 4GB. - Data Bus (Bidirectional): Carries data/instruction word (8/16/32/64-bit) - width determines word size.
- Control Bus (Mixed): Carries control signals -
MEMR*,MEMW*,IOR*,IOW*,CLK,RESET,READY,INTR,HOLD/HLDA,INTA*.
In single-bus structure, only one transfer at a time; arbitration needed (centralized 8289 or distributed).
Operation Cycle Example: CPU places address on Address Bus -> asserts
MEMR*on Control Bus -> Memory puts data on Data Bus -> CPU latches via MDR.Supplementary Interconnections:
Some texts list Interconnection Structure as 5th view, but exam expects 4. Mention that performance depends on bus width/speed (bandwidth = data_width * clock_rate).For diagram: Draw central System Bus as three lines linking four blocks; inside CPU expand to CU+ALU+Registers; show I/O module between bus and peripheral.
Q2(b). (b) Discuss the design and logic of a microprogram sequence.20227m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →(b) Discuss the design and logic of a microprogram sequence.
Worked SolutionDesign and Logic of a Microprogram Sequence (7M)
1. Microprogrammed Control Unit Basics
Instead of hardwired logic, Control Unit stores microinstructions (control words) in Control Memory (CM) / microstore (ROM/Flash). Each microinstruction is a set of control signals (
PCout, MARin, Readetc.). A macro-instruction (e.g.,ADD) is executed as a sequence of microinstructions - called microprogram.Wilkes (1951) proposed this concept.
Example: Fetch phase micro-sequence
T1: PCout, MARin, Read, Select4, Yin, WMFC T2: MDRout, IRin, PC+42. Microinstruction Format
- Control field (CW):
nbits, one per control line (horizontal) or encoded (vertical). - Next Address field: Address of next microinstruction in CM.
- Branch/Sequencing field: Condition select + branch control.
Two types control encoding:
- Horizontal: 1 bit per signal (wide, fast, e.g., 40-60 bit microinstruction)
- Vertical: Encoded fields (narrow, slow, needs decoder)
- Nanoprogramming: Two-level.
3. Design of Microprogram Sequence Logic - Next Microaddress Generation
After executing current microinstruction at address
uPC, how to find nextuPC?Three techniques:
a) Sequential + Explicit Address:
Next address supplied in current microinstruction. Simple but wastes bits if many sequential steps.uPC_next = Addr field of current microinstructionb) Incremental uPC + Branch (Most common):
Use microprogram counteruPCthat increments by 1 by default; if branch condition true, load address from current microinstruction.if (Branch = 0) uPC = uPC + 1 else if (Cond true) uPC = BranchAddress else uPC = uPC + 1Uses uPC register + incrementer + MUX. Condition flags:
ZERO,CARRY,OPCODE bits,INTERRUPT,BUSY.c) Mapping via Opcode (Dispatch):
After fetch & decode, opcode bits in IR map to starting address of corresponding microprogram via mapping ROM / decoder.Start Address = Mapping(IR[opcode])
E.g.,ADD(opcode 0010) -> µaddr0x10,SUB->0x18.Implemented as: High bits from table + low bits from opcode. Often a Dispatch ROM does
µAddr = Base + opcode * offset.d) Combinations: Two-phase sequencing
Modern microprogrammed CU does:
- Fetch sequence (fixed at µaddr 0)
- Decode/dispatch (branch on IR opcode)
- Execute sequence for that opcode
- Branch back to fetch or handle indirect addressing / interrupt.
4. Logic Diagram (Next Address Generator)
+-----+ Condition codes (FLAGS, IR bits) | MUX |<-----------------+ +-----+ | ^ +-------------+ +-----------+ | | Branch Addr | | Condition | | | from µIR | | Select | | +-------------+ +-----------+ +-----+ +---+----+ +--------+ +----------+ +----+ | uPC |->| CM |->| µIR |---->| Next Addr|-->|uPC | | Reg |<-| (ROM)| | (hold) | | Logic | | | +-----+ +---+----+ +--------+ +----------+ +----+ ^ | | control signals ---------> to CPU datapath +--------+ Incrementer (uPC+1) ---------------+Components: Control Memory (512 x 36 bit typical), Control Address Register (CAR/uPC), Control Data/Register (CDR/µIR), Next-address logic (incrementer + branch MUX + mapping PROM).
5. Example Microprogram Sequence for
ADD R1, (R2)Assume instruction:
ADD R1, [R2](R1 = R1 + Mem[R2])µAddr : Microoperation Comment
0 : PCout, MARin, Read, WMFC Fetch opcode
1 : MDRout, IRin, PC++ Load IR
2 : R2out, MARin, Read Use R2 as address
3 : MDRout, Yin, WMFC Load operand to Y
4 : R1out, SelectY, Add, Zin ALU ADD
5 : Zout, R1in, END Write back, return to fetchDispatch after µaddr1: If opcode = ADD,
µPC = 2, if BRA then goto branch routine, etc.6. Design Steps (for exam)
- List datapath control signals needed (Register in/out, ALU function, Memory Read/Write, PC inc).
- Write micro-operation sequences for each macro instruction (fetch-decode-execute).
- Encode signals into µinstruction control field (horizontal/vertical choice) - consider control word width vs decode delay.
- Determine sequencing needed: sequential flow, conditional branch on flags/ opcode, subroutine calls (e.g., for interrupt handling,
CALLmicro-subroutine with µ-stack). - Choose next-address logic implementation: plain counter vs mapping ROM; assign CM addresses; generate mapping function.
- Optimize with field encoding, nanostore, or writable control memory (WCS) for vertical microprogramming to reduce size.
Advantages: Flexible (change microprogram to change instruction set), easier debugging, supports complex CISC (IBM 360, 68000, x86). Disadvantage: Slower than hardwired due to CM access (1 cycle extra); modern RISC uses hardwired, but x86 internally translates CISC to RISC µops via microcode.
Diagram to draw: Microprogrammed CU block with CM, CAR, CDR, mapping logic, and next-address generation MUX branching back.
- Control field (CW):
Q3. (3). Consider a hypothetical 32-bit microprocessor having 32-bit instructions composed of two fields—the first byte contains the opcode and the remainder the immediate operand or an operand address. (a) What is the maximum directly addressable memory capacity (in bytes)? (b) Discuss the impact on the system speed if the microprocessor bus has— i) a 32-bit local address bus and a 16-bit local data bus, or ii) a 16-bit local address bus and a 16-bit local data bus. \(c\) How many bits are needed for the program counter and the instruction register?202214m
Module 4: Memory Organization
View this question on its own page →(3). Consider a hypothetical 32-bit microprocessor having 32-bit instructions composed of two fields—the first byte contains the opcode and the remainder the immediate operand or an operand address.
(a) What is the maximum directly addressable memory capacity (in bytes)?
(b) Discuss the impact on the system speed if the microprocessor bus has—
i) a 32-bit local address bus and a 16-bit local data bus, or
ii) a 16-bit local address bus and a 16-bit local data bus.
(c) How many bits are needed for the program counter and the instruction register?Worked SolutionHypothetical: Instruction = 32 bits = 8 bits opcode + 24 bits address/immediate.
(a) Maximum Directly Addressable Memory Capacity
Direct field = bits.
If byte-addressable: bytes B MB.
If word-addressable (32-bit word =4B): words B MB, i.e. words.
Note: If microprocessor internally has full 32-bit address bus, theoretical max = B GB, but with given format without indirect/indexing you can only encode 24-bit direct address only MB directly without using indirect or paging.
(b) Impact of Bus Width on Speed
Assume memory and CPU are 32-bit, but buses narrower:
i) 32-bit address bus, 16-bit data bus
- Address bus 32-bit can address full GB.
- Data bus 16-bit each 32-bit instruction or operand needs 2 bus cycles to fetch/transfer (16 bits per cycle).
- e.g. Instruction fetch: vs with 32-bit data bus.
- Data read/write of 32-bit word also 2 cycles. Bus bandwidth halved: bits/cycle vs .
- Needs two memory accesses, causes wait states, effective CPI increases.
- Still functionally correct, but speed roughly ~50% for memory-intensive code + extra control logic (byte assembly, multiplexing).
ii) 16-bit address bus, 16-bit data bus
- Address 16-bit directly addressable = KB only! Massive limitation.
- To access beyond 64KB need banking, segment registers, page registers, or multiplexed address (like 8086 with 20-bit via segment:offset) – adds software/hardware overhead and slowdown.
- Cannot use full 32-bit address field; higher bits must be latched in two cycles (address multiplexing) or ignored.
- Data 16-bit same 2-cycle fetch as case (i).
- Overall: Much slower than (i) + severely limited memory. Requires extra bus cycles to send full 32-bit address (send low 16 then high 16) if attempting to address 4GB, effectively 2 address cycles + 2 data cycles per access. System speed degraded by and programmability restricted.
Summary: Widening address bus increases address space; widening data bus increases throughput. Halving data bus doubles memory cycles. Halving address bus collapses address space.
(c) Bits needed for PC and IR
- Instruction Register (IR): Must hold full instruction bits (8 opcode +24 operand). So bits.
- Program Counter (PC): Must hold address of next instruction.
- If holding direct field only: bits (to address MB).
- If holding full memory address (32-bit address bus): bits to address full GB, even though instruction can only encode 24 bits directly (rest via indirect).
- Practical design: bits, bits. For byte-addressable with word-aligned instructions (4B), PC increments by 4.
Exam answer: bits, bits minimum ( bits for full 4GB system).
Q4(a). A set-associative cache has a block size of four 16-bit words and a set size of 2. The cache can accommodate a total of 4096 words. The main memory size that is cacheable is 64K 32 bits. Design the cache structure and show how the processor’s addresses are interpreted.20227m
Module 4: Memory Organization
View this question on its own page →A set-associative cache has a block size of four 16-bit words and a set size of 2. The cache can accommodate a total of 4096 words. The main memory size that is cacheable is 64K 32 bits. Design the cache structure and show how the processor’s addresses are interpreted.
Worked SolutionSet-Associative Cache Design (Numerical)
Given: Block = -bit words bits bytes
Cache capacity words bit bits bytes
Set size (2-way set-associative)
Cacheable main memory bits bytes KB1. Number of Blocks & Sets
If normalized to 32-bit CPU word: block bits offset bit. Add byte offset bit if byte-addressed.2. Address Interpretation
Main memory bits needs bits for 32-bit word address (). Equivalent bits needs bits for 16-bit word address.
Case A - 16-bit word address (most exam-expected):
Total 17 bits (- for )17-bit word address: | Tag (6) | Set index (9) | Word (2) | 16-11 10-2 1-0If CPU byte-addressed: add bit byte offset inside 16-bit word:
Tag(6) | Set(9) | Word(2) | Byte(1)=18 bits total for KB.Case B - 32-bit word address (normalized):
Total bits, block words16-bit address: | Tag (6) | Set (9) | Block offset (1) | 15-10 9-1 0With byte offset:
Tag(6)|Set(9)|Word(1)|Byte(2)=18 bits ( because 32-bit =4 bytes).3. Cache Structure Design
- Organization: sets lines/set lines.
- Each line:
Valid(1) + Dirty(1) + Tag(6) + Data(64 bits = 4×16 bits). Optionally LRU bit per set (1 bit for 2-way). - Data RAM: bytes, divided into blocks of 8 bytes.
- Tag RAM: bits (or ).
- Size: Total tag storage bits.
CPU Address (17-bit word) ---> [Tag 6] [Set 9] [W 2] | | | +-------+ +-----+ +----+ | | | word mux 4:1 Tag compare (×2) --> set decoder 512 --> selected set's 2 tags | HIT if tag match & Valid=1 v Data out (selected 16-bit word or 32-bit word)Operation: Set field selects one of 512 sets (both ways read in parallel); Tag field compared associatively with 2 tags in set; if match, Word offset selects one of 4 words in block (or 1 of 2×32-bit words). Replacement uses LRU per set.
For exam diagram show set decoder, two comparators, MUX and valid/LRU bits. Numbers: 512 sets, 2 lines/set, 8 bytes/block, 9+2+6 split.
Check: Cache ratio .
Q4(b). Explain two techniques for enhancing the performance of computers with multiple execution pipelines.20227m
Module 3: Pipelining
View this question on its own page →Explain two techniques for enhancing the performance of computers with multiple execution pipelines.
Worked SolutionTwo Techniques for Enhancing Performance with Multiple Execution Pipelines
Multiple execution pipelines (superscalar / superpipelined architecture) allow Instruction Level Parallelism (ILP) by executing more than one instruction per clock. Two key techniques:
1. Superscalar Execution (Multiple Issue Pipeline)
- Concept: Processor contains parallel pipelines (e.g., Integer pipe, FP pipe, Load/Store pipe). In each cycle, issue logic fetches and issues instructions simultaneously (-way superscalar) if no dependencies.
- Hardware required:
- Multiple functional units: ALU1, ALU2, FPU, Branch unit, Load/Store unit
- Instruction Fetch & Decode capable of instructions/cycle
- Dependency checking / Scoreboarding / Tomasulo algorithm to detect data hazards (RAW, WAR, WAW)
- Register renaming to remove false dependencies
- Example: 2-way superscalar can issue
ADD R1,R2,R3andMUL R4,R5,R6together if independent. - Advantage: Increases throughput ideal CPI (e.g., CPI 0.5 for 2-way). Exploits ILP without compiler support (dynamic).
- Limitation: Complex issue logic, requires out-of-order execution and large window; limited by true dependencies and branches.
2. Superpipelining and Out-of-Order / Speculative Execution (Complementary techniques)
Often paired with superscalar; other major technique is VLIW-like / Superpipelined + Branch Prediction & Speculative Execution (can also be answered as Superpipelining or VLIW).
a) Superpipelining:
- Divides pipeline into many finer stages (e.g., 8-10 stages vs classic 5-stage: IF1, IF2, ID1, ID2, EX1, EX2, WB). Clock period = 1/m of base, so multiple instructions are in different sub-stages of same functional pipe - higher clock rate.
- Combination
Superscalar + Superpipelining= Super-speculative processor (e.g., Pentium 4).
b) Out-of-Order Execution + Register Renaming + Speculative/Branch Prediction (essential to keep multiple pipelines busy):
- Multiple pipelines stall on hazards/branches. Solution:
- Register Renaming: maps architectural registers to larger physical register file to eliminate WAR/WAW, allowing parallel execution.
- Out-of-Order Execution: Instructions wait in Reservation Stations; execute as soon as operands ready, not program order. ReOrder Buffer (ROB) commits in order.
- Branch Prediction + Speculative Execution: Predict branch direction (2-bit predictor, BTB) and speculatively execute down predicted path to keep pipelines filled. On mispredict, flush.
- Dynamic Scheduling: Tomasulo / Scoreboard.
Alternative valid answer - VLIW (Very Long Instruction Word):
Compiler packs independent operations into one very long instruction word (e.g., 128-256 bit). Hardware is simple (no dependency check), compiler does static scheduling. Example: IA-64/Itanium. Merits: simple hardware; Demerits: poor code density, compiler dependent, binary incompatibility.Performance gain summary: With pipelines ideal speedup if hazards avoided. Combination of ** Superscalar (space parallelism) + Superpipelining (time parallelism) + OOO/Speculation/Renaming** yields practical speedup 1.5x-3x per core.
Feature Superscalar Superpipeline/VLIW Parallelism Space - multiple pipes Time - finer clocks / compiler-packed Dependency check Hardware dynamic VLIW: Compiler static Complexity High hardware VLIW: simple HW, complex compiler Q5(a). Calculate (72530 - 13250) using ten's complement arithmetic. Assume rules similar to those for two's complement arithmetic.20227m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →Calculate using ten's complement arithmetic. Assume rules similar to those for two's complement arithmetic.
Worked SolutionTen's Complement Subtraction:
For digits, ten's complement of is .
Rule (like 2's complement): . If end carry =1, discard carry, result positive. If no carry, result negative and is the 10's complement of magnitude.
Step 1: 9's complement of B=13250
Step 2: 10's complement of B
Check:Step 3: Add to A
Step 4: Discard end carry
We have digits, the 6th digit1is end carry. Discard it .Verification: .
If the sum had no end carry, e.g., , result would be without carry, indicating negative. Then negate: , so answer .
Q5(b). List and briefly explain five important instruction set design issues.20227m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →List and briefly explain five important instruction set design issues.
Worked SolutionFive Important Instruction Set Design Issues
1. Operation Repertoire (Operations to Provide)
What operations - data movement (LOAD/STORE), arithmetic (ADD,SUB,MUL,DIV), logical (AND/OR/SHIFT), control (BRANCH,CALL), I/O. Need completeness (all uses) vs orthogonality. Too many ops -> complex decode; too few -> inefficient programs (e.g., no multiply must emulate). RISC keeps ~50-100 simple ops; CISC has >200 complex.
2. Data Types & Operand Representations
What types supported natively - integer (8/16/32/64b), floating (IEEE754), decimal/BCD, char/string, boolean. Affects ALU design and format. Choice of word length, endianness, signed (2's complement) vs unsigned.
3. Instruction Format & Length
Fixed vs variable length, number of fields: opcode + operands + addressing mode + immediate. Tradeoff: fixed (RISC, e.g., 32b, 3-reg) simple fetch/decode but code density low; variable (x86, 1-15B) dense but complex decoder. Number of addresses per instruction: 0 (stack),1 (accumulator),2,3-address.
4. Addressing Modes
How operand address specified:
- Immediate, Direct, Register, Register-Indirect, Indexed (), Autoincrement, PC-relative, Stack.
More modes -> flexibility but hardware complexity & CPI variance. Must balance for compilers (RISC favors Reg+Immediate+Displacement only).
5. Registers - Number, Use, Organization
How many visible registers? 8 (x86), 32 (MIPS/ARM). General Purpose vs specialized (accumulator, index). Affects operand fetching, procedure call convention, spill to memory, context switch cost. Also interacts with instruction format (3-bit vs 5-bit reg fields).
Bonus (mention any):
- Instruction Set Orthogonality & Completeness - all modes work with all ops vs irregular.
- Control Flow & Condition Codes - how branches/flags handled.
- Memory Alignment & Byte Ordering
Good design balances code density, CPI, decode simplicity, compiler target, backward compatibility.
- Immediate, Direct, Register, Register-Indirect, Indexed (), Autoincrement, PC-relative, Stack.
Q6. The x86 architecture includes an instruction called decimal adjust after addition (DAA). DAA performs the following sequence of instructions: ``plaintext if((AL AND 0FH) > 9) OR (AF = 1) then AL ← AL + 6; AF ← 1; else AF ← 0; endif; if(AL > 9FH) OR (CF = 1) then AL ← AL + 60H; CF ← 1; else CF ← 0; endif. `` "H" indicates hexadecimal. AL is an 8-bit register that holds the result of addition of two unsigned 8-bit integers. AF is a flag set if there is a carry from bit 3 to bit 4 in the result of an addition. CF is a flag set if there is a carry from bit 7 to bit 8. Explain the function performed by the DAA instruction.202214m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →The x86 architecture includes an instruction called decimal adjust after addition (DAA). DAA performs the following sequence of instructions:
if((AL AND 0FH) > 9) OR (AF = 1) then AL ← AL + 6; AF ← 1; else AF ← 0; endif; if(AL > 9FH) OR (CF = 1) then AL ← AL + 60H; CF ← 1; else CF ← 0; endif."H" indicates hexadecimal. AL is an 8-bit register that holds the result of addition of two unsigned 8-bit integers. AF is a flag set if there is a carry from bit 3 to bit 4 in the result of an addition. CF is a flag set if there is a carry from bit 7 to bit 8. Explain the function performed by the DAA instruction.
Worked SolutionFunction of DAA Instruction
1. Context
x86 AL holds two packed BCD digits (Binary Coded Decimal): high nibble = tens digit 0-9, low nibble = units digit 0-9, e.g.
0x27= decimal 27. BinaryADD AL, BLadds them as 8-bit binary and sets flags AF (auxiliary carry from bit3) and CF. Result may be invalid BCD (nibble >9 or unadjusted carry) and needs correction to remain valid packed BCD.DAA = Decimal Adjust after Addition converts the binary result in AL to correct packed BCD and sets CF/AF to represent decimal carry.
2. What the pseudo-code does
if (low_nibble >9) OR (AF=1) then AL+=6; AF=1 else AF=0; // correct low digit if (AL >9FH) OR (CF=1) then AL+=0x60; CF=1 else CF=0; // correct high digitAL AND 0FHisolates low nibble.+6=0000 0110: adds 6 to low nibble; causes carry to high nibble if needed, skipping the 6 invalid hex values A-F.+60H=0110 0000: adds 6 to high nibble (60H = 96 = 6*16).
AFandCFafter DAA represent decimal carries (not binary), for multi-byte BCD addition (propagate with ADC+DAA).3. Why +6 ?
In BCD, counting after 9 should go to 10 (0x10), but binary after 0x09 goes to 0x0A. Gap = 6 (0x0A - 0x0F are invalid). Adding 6 forces carry and wraps to correct BCD value:
9+1 = 0x0A -> +6 = 0x10(correct BCD for 10).4. Examples
Example 1:
AL=0x29 + 0x15 = 0x3E(binary). Low nibble E=14>9- First IF true:
AL=0x3E+0x06=0x44, AF=1 - Second IF:
AL=0x44 <=0x9Fand CF=0 -> CF=0 - Result
0x44= BCD 44 . Correct: 29+15=44 decimal.
Example 2:
AL=0x49+0x38=0x81. AF=0? 9+8=17 -> low nibble 1 with AF=1 (carry from bit3)- First IF: (1>9? No) but AF=1 ->
AL=0x81+0x06=0x87, AF=1 - Second:
0x87 <=9Fand CF=0 -> CF=0 - Result
0x87= 87 . Correct: 49+38=87.
Example 3:
AL=0x99+0x99=0x32binary (0x132 truncated) with CF=1, AF=1- First IF:
0x2>9?Nobut AF=1 ->AL=0x32+0x06=0x38, AF=1 - Second IF: CF=1 ->
AL=0x38+0x60=0x98, CF=1 - Result
0x98with CF=1 => BCD 198 (CF is hundreds carry). Correct: 99+99=198.
5. Summary of Function
DAA performs binary-to-BCD correction after an 8-bit ADD of two packed BCD numbers:
- Makes each 4-bit nibble a valid decimal digit 0-9
- Propagates decimal carry correctly between digits
- Leaves
AL= low two decimal digits of sum (00-99) andCF= high decimal carry (0 or 1) for extended BCD arithmetic (e.g.,ADC+DAAchain for multi-byte BCD such as 4-digit BCD with AL+AH).
Without DAA, binary addition would yield hex digits A-F which have no BCD meaning. With DAA, x86 can do decimal arithmetic directly used in financial/cobol applications where binary rounding errors unacceptable.
Q7. A non-pipelined processor has a clock rate of 2.5 GHz and an average CPI (cycles per instruction) of 4. An upgrade to the processor introduces a five-stage pipeline. However, due to internal pipeline delays, such as latch delay, the clock rate of the new processor has to be reduced to 2 GHz. (a) What is the speedup achieved for a typical program? (b) What is the MIPS rate for each processor?202214m
Module 3: Pipelining
View this question on its own page →A non-pipelined processor has a clock rate of GHz and an average CPI (cycles per instruction) of . An upgrade to the processor introduces a five-stage pipeline. However, due to internal pipeline delays, such as latch delay, the clock rate of the new processor has to be reduced to GHz.
(a) What is the speedup achieved for a typical program?
(b) What is the MIPS rate for each processor?
Worked Solution(a) Speedup
Let = no. of instructions.
Non-pipelined:
- Clock
Time per instruction .
Pipelined (5-stage, ideal, no hazards):
- Ideal (one instruction completes per cycle in steady state). Ignoring fill/drain overhead for large : .
With fill overhead: where , for .
So speedup in the ideal hazard-free case. If pipeline stalls/hazards raise to e.g. 1.2 then .
Maximum theoretical speedup ignoring clock reduction: ; with clock penalty , net .
(b) MIPS rate
Non-pipelined:
Pipelined (ideal ):
If hazards included, e.g. , . In general .
Throughput gain same as speedup.
Q8(a). Briefly explain the two basic approaches used to minimize register-memory operations on RISC machines.202216m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Briefly explain the two basic approaches used to minimize register-memory operations on RISC machines.
Worked SolutionRISC instruction set keeps only load/store accessing memory to simplify pipeline. Yet stack frames, parameter passing and spills cause many register↔memory moves. Two approaches to minimize:
1. Hardware Approach - Large Register File with Register Windows (Berkeley RISC I)
Provide very large register file (e.g., 32-128 registers) and partition into overlapping windows per procedure.
- Registers divided into:
Global (G0-Gn)- shared by all procedures,Local,In,Out. - On call, CPU switches to new window: Out registers of caller become In registers of callee (overlap) - parameters passed without memory store/load.
- Only window pointer changes, no memory traffic for save/restore on call/return unless window overflows/underflows.
- Example: RISC I has 8 windows ×16 registers + 10 globals = 138 registers, but only 32 visible at a time. Sun SPARC implements this.
- Effectively caches procedure context in registers, cutting memory operations by 50%+.
Alternative hardware: Register Stack with renaming.
2. Software/Compiler Approach - Optimized Register Allocation
- Efficient graph-coloring register allocator keeps most-used variables (loop indices, temporaries) in registers for entire lifetime, minimizing loads/stores.
- Compiler optimizations: keep variables in registers across basic blocks, common subexpression elimination, loop invariant movement, leaf-procedure optimization.
- Instruction scheduling and delayed load handling: compiler inserts independent instructions after load to avoid stall, reducing load interlocks.
- Stanford MIPS approach: Use compiler rather than hardware windows - relies on large but flat register file (32 registers) and smart allocation.
Both aim to exploit locality: hardware caches context via windows; software keeps working set in registers. Combined, RISC achieves CPI ≈1 while CISC spends many cycles on register-memory traffic.
- Registers divided into:
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q8(b). A computer has 16 registers, an ALU with 32 operations, and a shifter with 8 operations, all connected to a common bus system. (i) Formulate a control word for micro-operation. (ii) Show the bits of the control word that specify the micro-operation R4 \leftarrow R5 + R6.20227m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →A computer has 16 registers, an ALU with 32 operations, and a shifter with 8 operations, all connected to a common bus system.
(i) Formulate a control word for micro-operation.
(ii) Show the bits of the control word that specify the micro-operation R4 R5 + R6.
Worked SolutionGiven: 16 registers → bits to address, 32 ALU ops → bits, 8 shifter ops → bits. Common bus system: any register can drive bus (SEL A, SEL B), any register can be destination.
(i) Control Word Format
For register-to-register micro-operation via two bus passes or one ALU+shifter path:
Field Bits Function SELA 4 Select source register A to bus → ALU A input SELB 4 Select source register B to bus → ALU B input SELD 4 Select destination register to receive result ALUF 5 ALU operation select SHF 3 Shifter operation select Total 20 Format:
SELA (4) | SELB (4) | SELD (4) | ALUF (5) | SHF (3)= 20-bit control word. If including control bits for bus enable, memory, etc., additional bits may be added, but core is 20 bits.Encoding: Registers: .
ALU ops example: , , etc. Shifter: , , etc.(ii) Bits for
- SELA =
- SELB =
- SELD =
- ALUF = (assuming code 00010 for ADD)
- SHF =
Control word =
0101 0110 0100 00010 000In hex grouping:
0x5 6 4 02 0→ binary01010110010000010000=0x56410(20 bits).If shifter field considered at LSB side, full 20-bit word:
SELA SELB SELD ALUF SHF = 0101 0110 0100 00010 000.Micro-operation execution: Bus: , , ALU performs , result through shifter (unshifted) → bus → latch via SELD decode.
If microinstruction also contains SEQ bits for next-address, additional bits for carry-in etc. would extend word, but core operation bits as above.
Q9. Let a be the percentage of a program code that can be executed simultaneously by n processors in a computer system. Assume that the remaining code must be executed sequentially by a single processor. Each processor has an execution rate of x MIPS. (a) Derive an expression for the effective MIPS rate when using the system for exclusive execution of this program, in terms of n, \alpha, and x. (b) If n=16 and x=4 MIPS, determine the value of that will yield a system performance of 40 MIPS.202214m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Let a be the percentage of a program code that can be executed simultaneously by processors in a computer system. Assume that the remaining code must be executed sequentially by a single processor. Each processor has an execution rate of MIPS.
(a) Derive an expression for the effective MIPS rate when using the system for exclusive execution of this program, in terms of , , and .
(b) If and MIPS, determine the value of that will yield a system performance of 40 MIPS.
Worked SolutionAmdahl's Law – Effective MIPS with n Processors (14 Marks)
Let = fraction of code parallelizable (executable on processors simultaneously), so is strictly sequential. Each processor rate = MIPS.
Let total instructions = .
(a) Derivation:
Time if executed on single processor: (in if in MIPS, i.e., instr/sec)
With processors:
- Sequential part: instructions at rate →
- Parallel part: instructions shared among processors, effective rate →
Total parallel time:
Effective MIPS
So
This is Amdahl's law: Speedup , and .
Checks: If → (no gain). If → (linear). If → (bottleneck by sequential part).
(b) Numerical:
Given , MIPS, MIPS. Find .
Interpretation: 96% of code must be parallelizable to achieve 40 MIPS (≈10× speedup) with 16×4 MIPS processors. If lower, cannot reach 40 MIPS even with infinite processors (max would be ).
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.