MCQ Section
1 questionsMCQ Section
Q1: Multiple Choice Questions (Any Seven) [2 × 7 = 14]
Choose the correct option of the following (any seven only):
Q1(a): Pipeline Stage
A pipeline stage:
- (i) Is sequential circuit
- (ii) Is combination circuit
- (iii) Consists of both sequential and combinational circuit ✓
- (iv) None of these
Answer: (iii) Consists of both sequential and combinational circuit
Solution: A pipeline stage consists of both sequential and combinational circuits. The combinational logic performs the actual computation, while sequential elements (registers/latches) hold the intermediate results between stages.
Q1(b): Direct Mapped Cache Memory
A direct mapped cache memory with n blocks is nothing but which of the following set associative cache memory organizations:
- (i) 0-way set associative
- (ii) 1-way set associative ✓
- (iii) 2-way set associative
- (iv) n-way set associative
Answer: (ii) 1-way set associative
Solution: A direct mapped cache is equivalent to a 1-way set associative cache. In direct mapping, each memory block can only go to one specific cache line, meaning each set has only one block (1-way).
Q1(c): Pipeline Performance
The performance of a pipelined processor suffers if:
- (i) The pipeline stages have different delays
- (ii) Consecutive instructions are dependent on each other
- (iii) The pipeline stages share hardware resources
- (iv) All of these ✓
Answer: (iv) All of these
Solution: Pipeline performance suffers due to: (i) Different stage delays cause the slowest stage to become the bottleneck, (ii) Data dependencies cause pipeline stalls (hazards), (iii) Shared resources cause structural hazards when multiple stages need the same resource simultaneously.
Q1(d): Average Access Time
A computer with cache access time of 100 ns, a main memory access time of 1000 ns, and a hit ratio of 0.9 produces an average access time of:
- (i) 250 ns
- (ii) 200 ns ✓
- (iii) 190 ns
- (iv) None of these
Answer: (ii) 200 ns
Solution: Average Access Time = Hit Ratio × Cache Time + (1 - Hit Ratio) × (Cache Time + Memory Time) = 0.9 × 100 + 0.1 × (100 + 1000) = 90 + 0.1 × 1100 = 90 + 110 = 200 ns
Q1(e): Practical Usage
Which of the following has no practical usage?
- (i) SISD
- (ii) SIMD
- (iii) MISD ✓
- (iv) MIMD
Answer: (iii) MISD
Solution: MISD (Multiple Instruction, Single Data) has no practical usage as it's difficult to find applications where multiple different instructions need to operate on the same data simultaneously. SISD (single processor), SIMD (vector processors), and MIMD (multiprocessors) all have practical applications.
Q1(f): Micro Programmed Control Unit
A micro programmed control unit:
- (i) Is faster than a hardwired control unit
- (ii) Facilitates easy implementation of new instructions ✓
- (iii) Is useful when every small program is to be run
- (iv) Usually refers to the control unit of the microprocessor
Answer: (ii) Facilitates easy implementation of new instructions
Solution: Microprogrammed control units store control signals in a control memory (microprogram), making it easy to modify or add new instructions by simply updating the microprogram. While slower than hardwired control, they offer greater flexibility.
Q1(g): Memory-Mapped I/O
In memory-mapped I/O:
- (i) The I/O devices and the memory share the same address space ✓
- (ii) The I/O device have a separate address space
- (iii) The memory and I/O device have an associated address space
- (iv) A part of the memory is specifically set aside for the I/O operation
Answer: (i) The I/O devices and the memory share the same address space
Solution: In memory-mapped I/O, I/O devices are assigned addresses within the same address space as memory. This allows the processor to use the same instructions for both memory and I/O operations.
Q1(h): RAM Design
How many 128×8 bit RAMs are required to design 32 k × 32 bit RAM?
- (i) 512
- (ii) 128
- (iii) 1024 ✓
- (iv) 32
Answer: (iii) 1024
Solution: Required memory: 32K × 32 bits = 32768 × 32 bits Available chip: 128 × 8 bits
For width: 32/8 = 4 chips needed in parallel For depth: 32768/128 = 256 chips needed
Total chips = 4 × 256 = 1024 RAMs
Q1(i): Processor Stalling
The stalling of the processor due to the unavailability of the instruction is called as:
- (i) Control hazard
- (ii) Structural hazard ✓
- (iii) Input hazard
- (iv) None of the above
Answer: (ii) Structural hazard
Solution: When the processor stalls because a required hardware resource (like instruction memory or ALU) is not available, it's called a structural hazard. This occurs when multiple instructions need the same resource at the same time.
Q1(j): Addressing Mode
The addressing mode, where you directly specify the operand value is:
- (i) Immediate ✓
- (ii) Direct
- (iii) Definite
- (iv) Relative
Answer: (i) Immediate
Solution: In immediate addressing mode, the operand value itself is specified directly in the instruction. For example, ADD R1, #5 adds the immediate value 5 to register R1.
Long Answer Questions
8 questionsLong Answer Questions
Q2: Pipeline Hazards and Addressing Modes [7 + 7 = 14]
(a) What are the hazards in pipeline architecture? Explain its types with suitable example.
Answer:
Pipeline Hazards:
Pipeline hazards are situations that prevent the next instruction from executing during its designated clock cycle. There are three types:
1. Structural Hazards: Occur when hardware cannot support all possible combinations of instructions in simultaneous execution.
Example: Single memory for both instruction fetch and data access causes conflict when both stages need memory access.
2. Data Hazards: Occur when an instruction depends on the result of a previous instruction still in the pipeline.
Example:
ADD R1, R2, R3
SUB R4, R1, R5 // SUB needs R1's value before ADD completes
Types: RAW (Read After Write), WAR (Write After Read), WAW (Write After Write)
3. Control Hazards: Occur due to branch instructions that change the program counter.
Example: A conditional branch instruction - the pipeline doesn't know which instruction to fetch next until the branch condition is evaluated.
(b) What is addressing mode? Why do computers use addressing mode techniques? Explain two modes with example, which do not use address fields.
Answer:
Addressing Modes:
Addressing mode specifies how to interpret the address field of an instruction to get the effective operand address.
Why computers use addressing modes:
- Provide flexibility in accessing operands
- Support different data structures (arrays, stacks)
- Reduce program size
- Enable position-independent code
Modes without address fields:
1. Implied/Implicit Mode: The operand is implicitly specified by the opcode itself. Example: CMA (Complement Accumulator) - operand is always the accumulator
2. Register Mode: The operand is in a processor register specified by the instruction. Example: ADD R1, R2 - operands are in registers R1 and R2
Q3: Cache Memory and Virtual Memory [7 + 7 = 14]
(a) A 4-way set associative cache memory unit with a capacity of 16 KB is built using a block size of 8 words. The word length is 32 bits. The size of the physical address space is 4GB. Find the number of bits for TAG, SET, and WORD fields in the address generated by CPU.
Answer:
Given:
- Cache capacity = 16 KB = 16 × 1024 = 16384 bytes
- Block size = 8 words = 8 × 4 = 32 bytes (since word = 32 bits = 4 bytes)
- Physical address space = 4 GB = 2³² bytes
- 4-way set associative
Calculations:
Number of blocks in cache = 16384 / 32 = 512 blocks
Number of sets = Number of blocks / Associativity = 512 / 4 = 128 sets
Address breakdown (32 bits total for 4GB space):
- WORD/Block Offset bits = log₂(Block size in bytes) = log₂(32) = 5 bits
- SET/Index bits = log₂(Number of sets) = log₂(128) = 7 bits
- TAG bits = Total address bits - SET bits - WORD bits = 32 - 7 - 5 = 20 bits
(b) How is the virtual address mapped into physical address? What are the different methods of writing into cache?
Answer:
Virtual to Physical Address Mapping:
Virtual addresses are mapped to physical addresses using a Page Table:
- Virtual address is divided into Virtual Page Number (VPN) and Page Offset
- VPN is used as an index into the page table
- Page table entry contains the Physical Frame Number (PFN)
- Physical address = PFN concatenated with Page Offset
The TLB (Translation Lookaside Buffer) caches recent translations for faster access.
Methods of Writing into Cache:
1. Write-Through: Data is written to both cache and main memory simultaneously.
- Advantage: Memory always has consistent data
- Disadvantage: Slower write operations
2. Write-Back: Data is written only to cache. Memory is updated when the block is replaced.
- Advantage: Faster writes
- Disadvantage: Memory may have stale data; requires dirty bit
3. Write-Around: Data is written directly to memory, bypassing cache.
- Used when data won't be read again soon
Q4: Instruction Formats and Cache Mapping [7 + 7 = 14]
(a) What are the different types of instruction formats?
Answer:
Types of Instruction Formats:
1. Three-Address Format:
- Format: OP A, B, C (Result ← A op B, store in C)
- Example: ADD R1, R2, R3
- Advantage: Flexible, preserves operands
- Disadvantage: Longer instructions
2. Two-Address Format:
- Format: OP A, B (A ← A op B)
- Example: ADD R1, R2 (R1 = R1 + R2)
- Advantage: Shorter than 3-address
- Disadvantage: One operand is overwritten
3. One-Address Format:
- Format: OP A (ACC ← ACC op A)
- Uses accumulator implicitly
- Example: ADD X (ACC = ACC + X)
- Advantage: Short instructions
- Disadvantage: Limited flexibility
4. Zero-Address Format:
- Format: OP (uses stack)
- Example: ADD (pops two operands, pushes result)
- Used in stack-based architectures
- Advantage: Very short instructions
- Disadvantage: Stack management overhead
(b) Discuss the different mapping techniques used in cache memories and their relative merits and demerits.
Answer:
Cache Mapping Techniques:
| Technique | Description | Merits | Demerits |
|---|---|---|---|
| Direct Mapping | Each memory block maps to exactly one cache line | Simple, fast lookup | High conflict misses |
| Fully Associative | Any memory block can be placed in any cache line | Lowest miss rate, no conflict misses | Expensive hardware, slow lookup |
| Set Associative | Cache divided into sets; block maps to a specific set | Balance between direct and fully associative | More complex than direct mapping |
Q5: Carry Look-ahead Adder and Cache Simulation [7 + 7 = 14]
(a) Design a 4-bit carry look-ahead adder and explain its operation with an example.
Answer:
The CLA adder eliminates the ripple carry delay by computing all carries in parallel.
Define Generate (G) and Propagate (P):
- Gᵢ = Aᵢ · Bᵢ (Generate: carry is generated if both inputs are 1)
- Pᵢ = Aᵢ ⊕ Bᵢ (Propagate: carry is propagated if exactly one input is 1)
Carry equations:
- C₁ = G₀ + P₀·C₀
- C₂ = G₁ + P₁·G₀ + P₁·P₀·C₀
- C₃ = G₂ + P₂·G₁ + P₂·P₁·G₀ + P₂·P₁·P₀·C₀
- C₄ = G₃ + P₃·G₂ + P₃·P₂·G₁ + P₃·P₂·P₁·G₀ + P₃·P₂·P₁·P₀·C₀
Sum: Sᵢ = Pᵢ ⊕ Cᵢ
Example: Add A = 1011 and B = 0110 with C₀ = 0
| i | Aᵢ | Bᵢ | Gᵢ | Pᵢ |
|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 |
| 2 | 0 | 1 | 0 | 1 |
| 3 | 1 | 0 | 0 | 1 |
C₁ = 0 + 1·0 = 0 C₂ = 1 + 0·0 + 0·1·0 = 1 C₃ = 0 + 1·1 + 1·0·0 + 1·0·1·0 = 1 C₄ = 0 + 1·0 + 1·1·1 + 1·1·0·0 + 1·1·0·1·0 = 1
Sum = 10001 ✓
(b) Consider a direct mapped cache with 8 cache blocks (numbered 0-7). If the memory block requests are in the following order 3, 5, 2, 8, 0, 63, 9, 16, 20, 17, 25, 18, 30, 24, 2, 63, 5, 82, 17, 24. What would be the status of cache blocks (block numbers residing in cache) at the end of the sequence.
Answer:
Cache block number = Memory block mod 8
| Request | Block mod 8 | Cache Status |
|---|---|---|
| 3 | 3 | [,,,3,,,,_] |
| 5 | 5 | [,,,3,,5,,] |
| 2 | 2 | [,,2,3,,5,,_] |
| 8 | 0 | [8,,2,3,,5,,] |
| 0 | 0 | [0,,2,3,,5,,] |
| 63 | 7 | [0,,2,3,,5,_,63] |
| 9 | 1 | [0,9,2,3,,5,,63] |
| 16 | 0 | [16,9,2,3,,5,,63] |
| 20 | 4 | [16,9,2,3,20,5,_,63] |
| 17 | 1 | [16,17,2,3,20,5,_,63] |
| 25 | 1 | [16,25,2,3,20,5,_,63] |
| 18 | 2 | [16,25,18,3,20,5,_,63] |
| 30 | 6 | [16,25,18,3,20,5,30,63] |
| 24 | 0 | [24,25,18,3,20,5,30,63] |
| 2 | 2 | [24,25,2,3,20,5,30,63] |
| 63 | 7 | [24,25,2,3,20,5,30,63] |
| 5 | 5 | [24,25,2,3,20,5,30,63] |
| 82 | 2 | [24,25,82,3,20,5,30,63] |
| 17 | 1 | [24,17,82,3,20,5,30,63] |
| 24 | 0 | [24,17,82,3,20,5,30,63] |
Final Cache Status: [24, 17, 82, 3, 20, 5, 30, 63]
Q6: DMA and Control Units [7 + 7 = 14]
(a) What is DMA? Describe how DMA is used to transfer data from peripherals.
Answer:
DMA (Direct Memory Access):
DMA is a technique that allows peripheral devices to transfer data directly to/from memory without CPU intervention.
DMA Transfer Process:
-
Initialization: CPU programs the DMA controller with:
- Starting memory address
- Number of bytes to transfer
- Direction (read/write)
- I/O device address
-
Request: When device is ready, it sends DMA request (DRQ) to DMA controller.
-
Bus Request: DMA controller sends bus request (BR) to CPU.
-
Bus Grant: CPU completes current operation and sends bus grant (BG), releasing the bus.
-
Transfer: DMA controller takes control of bus and transfers data directly between device and memory.
-
Completion: After transfer, DMA controller releases bus and sends interrupt to CPU.
DMA Modes:
- Burst Mode: Entire block transferred at once
- Cycle Stealing: One word at a time between CPU operations
- Transparent Mode: Transfer when CPU not using bus
(b) Differentiate between hardwired and micro programmed control unit. Explain each component of hardwired control unit organization.
Answer:
| Feature | Hardwired | Microprogrammed |
|---|---|---|
| Speed | Faster | Slower |
| Flexibility | Difficult to modify | Easy to modify |
| Cost | More expensive for complex instructions | Less expensive |
| Design | Complex, fixed logic | Simpler, uses control memory |
| Applications | RISC processors | CISC processors |
Hardwired Control Unit Components:
-
Instruction Register (IR): Holds the current instruction being executed.
-
Instruction Decoder: Decodes opcode and generates signals indicating operation type.
-
Timing Generator/Sequencer: Generates timing signals (T0, T1, T2...) for sequential control.
-
Control Logic (Combinational Circuit): Generates control signals based on:
- Decoded instruction
- Current timing state
- Status flags
-
Control Signals: Output signals that control ALU, registers, memory, buses.
Control Signal = f(Opcode, Timing State, Flags)
Q7: Asynchronous Data Transfer and Booth's Algorithm [7 + 7 = 14]
(a) What do you mean by asynchronous data transfer? Explain strobe control and hand shaking mechanism.
Answer:
Asynchronous Data Transfer:
In asynchronous transfer, data transfer occurs without a common clock. The sender and receiver coordinate using control signals.
Strobe Control:
A single control line (strobe) indicates data validity.
Source-initiated strobe:
- Source places data on bus
- Source activates strobe signal
- Destination reads data
- Source deactivates strobe
Destination-initiated strobe:
- Destination activates strobe (requesting data)
- Source places data on bus
- Destination reads data
- Destination deactivates strobe
Handshaking Mechanism:
Uses two control lines for reliable transfer:
- Data Valid (from source)
- Data Accepted (from destination)
Process:
- Source places data, asserts Data Valid
- Destination reads data, asserts Data Accepted
- Source sees acknowledgment, removes data, deasserts Data Valid
- Destination deasserts Data Accepted
- Ready for next transfer
Advantage: More reliable, handles speed differences between devices.
(b) Show the systematic multiplication process of (20) × (-19) using Booth's algorithm.
Answer:
Multiplicand M = 20 = 00010100 (8 bits) Multiplier Q = -19 = 11101101 (8 bits, 2's complement)
After completing Booth's algorithm iterations:
Result: -380 in 2's complement
Verification: 20 × (-19) = -380 ✓
Q8: Pipeline Throughput and IEEE 754 [7 + 7 = 14]
(a) The stage delays in a four stages pipeline are 800, 500, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. What would be the throughput increase (in percentage) of the pipeline?
Answer:
Original 4-stage pipeline:
- Stage delays: 800, 500, 400, 300 ps
- Clock period = max(800, 500, 400, 300) = 800 ps
- Throughput₁ = 1/800 ps
New 5-stage pipeline:
- Stage delays: 600, 350, 500, 400, 300 ps
- Clock period = max(600, 350, 500, 400, 300) = 600 ps
- Throughput₂ = 1/600 ps
Throughput Increase: = ((1/600 - 1/800) / (1/800)) × 100 = ((800 - 600) / 600) × 100 = (200/600) × 100 = 33.33%
(b) Explain IEEE standard for floating point representation with example.
Answer:
IEEE 754 Floating Point Standard:
Single Precision (32 bits):
| Sign | Exponent | Mantissa |
|---|---|---|
| 1 bit | 8 bits | 23 bits |
Format: (-1)^S × 1.M × 2^(E-Bias)
- S = Sign bit (0 = positive, 1 = negative)
- E = Biased exponent (Bias = 127 for single precision)
- M = Mantissa (fractional part, leading 1 is implicit)
Example: Represent -13.625 in IEEE 754 single precision
-
Sign: S = 1 (negative)
-
Convert to binary:
- 13 = 1101₂
- 0.625 = 0.101₂ (0.5 + 0.125)
- 13.625 = 1101.101₂
-
Normalize: 1.101101 × 2³
-
Exponent: E = 3 + 127 = 130 = 10000010₂
-
Mantissa: 10110100000000000000000 (23 bits)
Result: 1 10000010 10110100000000000000000
Q9: Short Notes (Any Two) [7 × 2 = 14]
(a) Paging
Answer:
Paging is a memory management scheme that eliminates the need for contiguous memory allocation.
Key Concepts:
- Physical memory divided into fixed-size frames
- Logical memory divided into same-size pages
- Page size = Frame size (typically 4KB)
Page Table:
- Maps logical page numbers to physical frame numbers
- Each process has its own page table
- Page table entry contains: Frame number, Valid bit, Protection bits
Advantages:
- Eliminates external fragmentation
- Simplifies memory allocation
- Enables virtual memory
(b) Memory Interleaving
Answer:
Technique to increase memory bandwidth by dividing memory into multiple banks that can be accessed simultaneously.
Types:
- High-Order Interleaving: Most significant bits select bank
- Low-Order Interleaving: Least significant bits select bank
Advantage: Effective memory bandwidth = Number of banks × Single bank bandwidth
(c) Privileged and Non-Privileged Instructions
Answer:
Privileged Instructions:
- Can only be executed in kernel/supervisor mode
- Direct hardware control
- Examples: I/O instructions, halt, interrupt control
Non-Privileged Instructions:
- Can be executed in user mode
- Normal computational operations
- Examples: ADD, SUB, LOAD, STORE
(d) Locality of Reference
Answer:
Principle that programs tend to access a relatively small portion of their address space at any time.
Types:
- Temporal Locality: Recently accessed items likely to be accessed again soon
- Spatial Locality: Items near recently accessed items likely to be accessed soon
Applications:
- Cache Design
- Virtual Memory
- Prefetching
- Branch Prediction