# Finding the length of a memory address in bits?

Thanks.

depends on the memory range you are using.
If your memory is only 128 items then you can provide a unique address for each location: 0, 1, 2, . 127 there that is 128 different addresses. This fits into a 7 bit number, so we can say this address space is addressable with a 7-bit address.

To make this more formal we can try this:

log(128)/log(2) = 7

For the number 163, this works as follows:
1. Let D=163
2. b) D is odd, put a 1 in the 2^0 column.
Subtract 1 from D to get 162.
c) Divide D=162 by 2.
Temporary Result: 01 New D=81
D does not equal 0, so we repeat step 2.

2. b) D is odd, put a 1 in the 2^1 column.
Subtract 1 from D to get 80.
c) Divide D=80 by 2.
Temporary Result: 11 New D=40
D does not equal 0, so we repeat step 2.

2. b) D is even, put a 0 in the 2^2 column.
c) Divide D by 2.
Temporary Result:011 New D=20

2. b) D is even, put a 0 in the 2^3 column.
c) Divide D by 2.
Temporary Result: 0011 New D=10

2. b) D is even, put a 0 in the 2^4 column.
c) Divide D by 2.
Temporary Result: 00011 New D=5

2. a) D is odd, put a 1 in the 2^5 column.
Subtract 1 from D to get 4.
c) Divide D by 2.
Temporary Result: 100011 New D=2

2. b) D is even, put a 0 in the 2^6 column.
c) Divide D by 2.
Temporary Result: 0100011 New D=1

2. a) D is odd, put a 1 in the 27 column.
Subtract 1 from D to get D=0.
c) Divide D by 2.
Temporary Result: 10100011 New D=0

D=0, so we are done, and the decimal number 163 is equivalent to the binary number 10100011.
Since we already knew how to convert from binary to decimal, we can easily verify our result. 10100011=(1*2^0)+(1*2^1)+(1*2^... 163

***** The number 10100011 is 8 Bits **************

Look here for Decimal to Binary
http://www.math.grin.edu/~rebelsky/cours...
Our present crop of home computers mostly have 32-bit addresses.
If you're old enough to remember the Commodore 64, Atari 800, and Apple II+, those computers had 16-bit addresses.
...and the original 8088 IBM PC and its 8086 clones had 24-bit addresses.

The answers post by the user, for information only, FunQA.com does not guarantee the right.