This has to do with how memory is adressed.
To retrieve or store a word in memory, you needs to specify where to/from. This is called adressing.
Memory addresses are binary numbers: using an n-bit address, you can uniquely specify exactly2n memory locations. Thus, choosing a non-power of two as your memory size will result in either wasted space or invalid adresses.
For instance, say you choose to go for example
for a 43 byte RAM, and assume you address the locations 0 to 42. You can either choose a 5-bit adress, in which case locations 32-42 will go unused (5 bits can address only 32 locations); or a 6 bit address which covers the entire memory but leaves invalid memory addresses in the range 43-64 (6 bits address 64 locations).
Thus, since the address space by definition is always a power of two, memory is always rounded out at powers of two to avoid complications.
To retrieve or store a word in memory, you needs to specify where to/from. This is called adressing.
Memory addresses are binary numbers: using an n-bit address, you can uniquely specify exactly
For instance, say you choose to go for example
for a 43 byte RAM, and assume you address the locations 0 to 42. You can either choose a 5-bit adress, in which case locations 32-42 will go unused (5 bits can address only 32 locations); or a 6 bit address which covers the entire memory but leaves invalid memory addresses in the range 43-64 (6 bits address 64 locations).
Thus, since the address space by definition is always a power of two, memory is always rounded out at powers of two to avoid complications.
Comments
Post a Comment