0
$\begingroup$

Question:

If a system has $32k$ bytes and each such byte has unique address(so $32k$ addresses), what is the smallest possible bits that can be use by every byte for the address ? All the bytes use the same number of bits for the address.

I thought the answer can be found by finding the value to which $2$ can be raised such that it equals $32,000$. I got $2$ raised to $ \sim 14.96$ gives $32,000$. But a byte only has $8$ bits so this can't make any sense.

Can anyone give any pointer on how to solve this problem ?

$\endgroup$
4
  • 1
    $\begingroup$ 8 bits only gives you 256 distinct values, to address distinct 32.000 locations you do need more than 8 bits. In fact, your answer is (nearly) correct. Why do you reject your current approach? $\endgroup$ – Tom van der Zanden Feb 4 '15 at 8:37
  • $\begingroup$ @TomvanderZanden I thought a byte must have only 8 bits. How is it possible that 15 bits per byte is used for address ? Please clarify. $\endgroup$ – Jenna Maiz Feb 4 '15 at 14:28
  • $\begingroup$ Even if you'd like to keep your addresses byte-aligned then simply take the ceiling of the necessary number of bits and round that to the next highest multiple of 8 (and pad whatever portion of the remaining byte you would not need). In your case, you would need at least 15 bits so if you were to have to answer in bytes then you'd need 2 bytes per address. $\endgroup$ – Francesco Gramano Mar 7 '15 at 2:46
  • 1
    $\begingroup$ "32k bytes" usually means "32x1024 bytes" (which is 32768 = 2^15), not "32000 bytes". $\endgroup$ – David Richerby May 5 '15 at 16:58
1
$\begingroup$

The system has 32.000 bytes and each byte must have its own unique address:

32.000 unique addresses

How many bits to represent these?

$2^{15} = 32768$, so if we let addresses be 15 bit we have the address space $[0,32767]$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.