edited by
9,221 views
7 7 votes

Assume that $16$-bit CPU is trying to access a double word stating at an odd address. How many memory operations are required to access the data?

  1. $1$
  2. $2$
  3. $3$
  4. $4$

5 Answers

Best answer
18 18 votes

3 for double word beginning at odd address.

2 for double word beginning at even address.

1 for single word beginning at even address.

2 for single word beginning at odd address.

Must read: https://courses.engr.illinois.edu/ece390/books/artofasm/CH03/CH03-1.html

selected by
7 7 votes

16-bit CPU ka funda yeh hai ki woh ek baar mein 2 bytes (word) ko access kar sakta hai. Ab, agar data odd address pe start ho raha hai, toh problem hoti hai kyunki CPU ka memory alignment even address pe hota hai.

Situation:

  • Double Word = 4 bytes (32 bits).
  • CPU ek baar mein 2 bytes access kar sakta hai.
  • Double word odd address (let's say address A = 1) pe start ho raha hai.

Steps to Access Data:

  1. Pehla Operation:

    • CPU ko odd address A = 1 se data lena hai.
    • Par problem hai ki CPU sirf even address ka word access karta hai.
    • Toh pehle operation mein, CPU address 0 aur address 1 ko access karega.
    • Ismein odd address ka ek byte mil jayega. (1 byte mil gaya)
  2. Dusra Operation:

    • Ab CPU address 2 aur address 3 ka word access karega.
    • Is operation mein double word ka 2 bytes mil jayega. (2 aur bytes mil gaye, total 3 bytes)
  3. Teesra Operation:

    • Finally, CPU ko address 4 aur address 5 ko access karna padega.
    • Is operation se last byte mil jayega. (4th byte mil gaya)

Result:

Total 3 memory operations lagenge pure 4 bytes (double word) ko access karne ke liye.

 

Learn this : 

Memory Access Rules for a 16-bit CPU:

  1. Double Word (4 bytes) starting at an Odd Address:

    • CPU needs 3 memory operations due to alignment issues.
  2. Double Word (4 bytes) starting at an Even Address:

    • CPU can fetch it in 2 memory operations, as there’s no misalignment.
  3. Single Word (2 bytes) starting at an Even Address:

    • CPU fetches it in 1 memory operation directly.
  4. Single Word (2 bytes) starting at an Odd Address:

    • CPU needs 2 memory operations because it spans across two aligned boundaries.
 
1 1 vote

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

0 0 votes
for QNo: 40. Ans: (c) 3 memory operations : for Double word starting at Odd address 2 memory operations : for Double word starting at Even address and 1 memory operations : for Single word starting at Odd address. This Qtn had already been answered by Arjun Sir.. This is the take away content from that.
0 0 votes

the question mentioned 16-bit CPU, meaning data bus of CPU is 16 bits which is one word

by default memory is byte addressable ( 8 bits ) 

now as CPU can access 16 bits of data in one memory access

the question says "double word" meaning 2 * one word ( i.e 32 bits ) of data trying to access

with these understanding, 


at the end of the representation we can see that CPU access memory 3 times to get the 32 bits of data starting from the odd address

hope this helps

Answer:
Position:
Show:

Related questions

12 12 votes
5 answers 5 answers
10.5k
10.5k views
ajit asked Sep 8, 2015
10,504 views
Consider a $33$ MHz cpu based system. What is the number of wait states required if it is interfaced with a $60$ ns memory? Assume a maximum of $10$ ns delay for addition...
11 11 votes
7 answers 7 answers
13.9k
13.9k views
ajit asked Aug 15, 2015
13,924 views
If each address space represents one byte of storage space, how many address lines are needed to access RAM chips arranged in a $4 \times 6$ array, where each chip is $8\...
10 10 votes
2 2 answers
8.9k
8.9k views
ajit asked Aug 15, 2015
8,918 views
Suppose you want to build a memory with $4$ byte words and a capacity of $2^{21}$ bits. What is type of decoder required if the memory is built using $2K \times$ $8$ $\te...
6 6 votes
1 answers 1 answer
6.4k
6.4k views
ajit asked Sep 8, 2015
6,378 views
The number of logical CPUs in a computer having two physical quad-core chips with hyper threading enabled is ______$1$$2$$8$$16$