Given:
16-bit CPU
→ This means the CPU reads 16 bits = 2 bytes = 1 word at a time.
→ It expects word-aligned addresses (even addresses like 0, 2, 4, ...).
You need to access a double word
→ A double word = 4 bytes of data.
The starting address is odd
→ Let’s say it’s address 101.
🎯 Goal:
Access 4 bytes starting at address 101.
So you want to read bytes at addresses:
101, 102, 103, 104
⚠️ Challenge: CPU is 16-bit and aligned
Since the CPU reads 2 bytes at a time, and expects them to start at even addresses (like 100, 102, 104...), reading starting from odd address 101 causes problems.
🔄 Memory Access Breakdown:
✅ Step 1: Access byte at 101
CPU can’t read directly from an odd address.
To get byte at 101, it reads word starting at 100 → gets bytes 100 & 101.
So 1st memory operation = read from 100 → gives 101 indirectly.
✅ Step 2: Access bytes at 102 and 103
These are 2 bytes starting at even address 102 → perfect alignment.
CPU reads word at 102 → gives bytes 102 & 103 directly.
So 2nd memory operation = read from 102.
✅ Step 3: Access byte at 104
Just 1 byte remains (104).
CPU must read 2 bytes, so it reads word at 104 → gets bytes 104 & 105.
So 3rd memory operation = read from 104 → only 104 is needed.
✅ Final Count:
Read from address 100 → bytes 100 & 101 → get byte 101 ✅
Read from address 102 → bytes 102 & 103 ✅
Read from address 104 → bytes 104 & 105 → get byte 104 ✅
🔢 Total = 3 memory operations