Wednesday, December 3, 2025

✅ 1. CACHE MAPPING NUMERICAL (Direct Mapping) NUMERICALS

 

1. CACHE MAPPING NUMERICAL (Direct Mapping)

Q1.

A computer has:

Find:

  1. No. of blocks in main memory

  2. No. of lines in cache

  3. Mapping of memory block 205 to cache line.


Solution

1) Blocks in main memory

Main memory size = 4K = 4096 words
Block size = 4 words

No. of blocks=40964=1024\text{No. of blocks} = \frac{4096}{4} = 1024

2) Cache lines

Cache size = 128 words
Block size = 4 words

Cache lines=1284=32\text{Cache lines} = \frac{128}{4} = 32

3) Mapping of block 205

Direct mapping:

Cache line=Block numbermodNo. of lines\text{Cache line} = \text{Block number} \mod \text{No. of lines} 205mod32=13205 \mod 32 = 13

✔ Answer:

Block 205 maps to cache line 13.


2. SET-ASSOCIATIVE CACHE NUMERICAL

Q2.

8 KB cache, block size = 64 bytes, 4-way set associative.
Find number of sets.


Solution

Cache size = 8 KB = 8192 bytes
Block size = 64 bytes

1 set has 4 blocks (because 4-way).

Total blocks =

819264=128\frac{8192}{64} = 128

No. of sets =

1284=32\frac{128}{4} = 32

Answer:

32 sets


3. MEMORY INTERLEAVING

Q3.

A system has 4 memory banks using lower-order interleaving.
Words are stored starting from address 0.
Find the bank number for address: 37.


Solution

Lower-order interleaving:

Bank=AddressmodNo. of banks\text{Bank} = \text{Address} \mod \text{No. of banks}

Here:
37 mod 4 = 1

Answer:

Address 37 is in Bank 1.


4. EFFECTIVE ACCESS TIME (EAT)

Q4.

Hit ratio = 90%
Cache access time = 10 ns
Main memory access = 100 ns

Find EAT.


Solution

EAT=(Hit Ratio×Cache Time)+(Miss Ratio×Memory Time)EAT = (Hit\ Ratio \times Cache\ Time) + (Miss\ Ratio \times Memory\ Time)

Hit ratio = 0.9
Miss ratio = 1 – 0.9 = 0.1

EAT=(0.9×10)+(0.1×100)EAT = (0.9 \times 10) + (0.1 \times 100) =9+10=19 ns= 9 + 10 = 19\ \text{ns}

Answer:

19 ns


5. PIPELINE THROUGHPUT

Q5.

A pipeline has 5 stages, each taking 20 ns.
Calculate time to execute 10 instructions.


Solution

Pipeline time =

kT+(n1)TkT + (n - 1)T

k = stages = 5
T = 20 ns
n = instructions = 10

=5(20)+9(20)= 5(20) + 9(20) =100+180=280 ns= 100 + 180 = 280\ \text{ns}

Answer:

280 ns


6. BINARY → EXCESS-3 NUMERICAL

Q6.

Convert 75 (decimal) into Excess-3 code.


Solution

Digits: 7 and 5

Step 1 → Convert to BCD:
7 → 0111
5 → 0101

Step 2 → Add 3 (0011) to each:

0111 + 0011 = 1010 0101 + 0011 = 1000

Answer:

75 = 1010 1000 (Excess-3)


7. BINARY MULTIPLICATION (Booth’s Algorithm)

Q7.

Multiply: (+7) × (−3) using Booth’s algorithm.
(Short exam-style solution.)


Solution Summary

7 = 0111
−3 = 1101 (2’s complement)

Perform Booth steps → final answer:

Answer:

(+7) × (−3) = −21
Binary result: 1010 1011


8. ADDRESSING MODE NUMERICAL

Q8.

Effective address = ?
Instruction: MOV A, M
HL register pair = 2050H


Solution

Indirect addressing:
Address = content of HL.

Answer:

EA = 2050H


9. MEMORY SIZE CALCULATION

Q9.

How many bytes in a memory with 16-bit address bus?


Solution

No. of addressable locations =

216=655362^{16} = 65536

Each location stores 1 byte.

Answer:

64 KB


10. CACHE TAG CALCULATION

Q10.

Find tag, set, and block offset for:

  • Cache = 4 KB

  • Block size = 32 bytes

  • 2-way associative

  • 16-bit address


Solution Steps

  1. Cache size = 4096 bytes
    Block size = 32 →
    Blocks = 4096 / 32 = 128 blocks

  2. 2-way set associative →
    Sets = 128 / 2 = 64 sets

  3. Set bits = log₂(64) = 6 bits

  4. Offset bits = log₂(32) = 5 bits

  5. Tag bits = 16 – (6 + 5) = 5 bits


Final Answer:

  • Tag = 5 bits

  • Set = 6 bits

  • Offset = 5 bits

No comments:

Post a Comment

✅ UNIT 4 — POSET, LATTICES & BOOLEAN ALGEBRA (DISCRETE MATHEMATICS)

  ✅ UNIT 4 — POSET, LATTICES & BOOLEAN ALGEBRA 1. Poset Partially Ordered Set A pair (A, ≤) where relation is: Reflexive Anti-...