Let's start with a simple question!
There is a 1 MB memory with 32 characters in length. Q: By byte addressing, addressing range of the word addressing and their respective addressing range size?
If the address is encoded by byte
1 MB = 2 ^ 20b
1 byte = 1B = 8bit
2 ^ 20b/1B = 2 ^ 20
The address range is 0 ~ 2 ^ 20-1, that is, 20 IP address lines are required to complete the encoding of 1 MB space. Therefore, the address register is 20 bits and the addressing range is 2 ^ 20 = 1 m.
If the address is edited by words
1 MB =2 ^ 20B
1 word = 32bit = 4B
2 ^ 20B/4B = 2 ^ 18
The address range is 0 ~ 2 ^ 18-1, that is, we must use at least 18 address lines to complete the encoding of 1 MB space. Therefore, the addressing range by word address is 2 ^ 18.
Notes for the above questions:
1. distinguish two different concepts: addressing space and addressing range. The addressing range is only a digital range, not a unit.
The size of the addressing range is obviously a number, which refers to the size of the addressing range.
Addressing Space refers to the maximum capacity that can be addressed. The unit is generally expressed in MB and B. The addressing range in this question is 0 ~ 2 ^ 20-1, addressing space is 1 MB.
2. byte addressing refers to the smallest unit of addressing a bucket in bytes and the word-based addressing refers to the smallest unit of addressing a bucket in words. For example, the total memory capacity is certain, and the number of encodings required by word addressing and byte addressing is different. Because the address unit is large (1 word = 32bit = 4B ), therefore, the number of encodings is relatively small, while the byte encoding unit is small (1 byte = 1B = 8 bit), resulting in a large number of encodings.
3. Differences between M and MB.
M is the unit of quantity. 1024 = 1 K, 1024 K = 1 M
MB refers to the capacity. 1024B = 1KB, 1024KB = 1 MB.