Calculating memory size based on address bit-length and memory cell contents

扶醉桌前 提交于 2020-06-23 06:42:27

问题


I am trying to calculate the maximum memory size knowing the bit length of an address and the size of the memory cell.

It is my understanding that if the address is n bits then there are 2^n memory locations. But then to calculate the actual memory size of the machine, you would need to multiply the number of addresses by the size of the memory cell. Is that correct?

To put it another way,

Step 1: calculate the length of the address in bits (n bits) Step 2: calculate the number of memory locations 2^n(bits) Step 3: take the number of memory locations and multiply it by the Byte size of the memory cells.

If each cell was 2 bytes for example, would I multiply 2^n bits (for address length) by the 2 Bytes per memory cell.

So total memory would be 2^n bits (address size) * x bytes (cell size)?


回答1:


"actual memory size of the machine"

I will assume here that you mean the physical address space of the machine in question, ignoring virtual addressing, etc. Most modern machines are byte-addressable (8-bit) meaning that each address refers to 1 byte. In this case, assuming that you have an n-bit processor with a matching n-bit address bus (there are cases where these aren't the same, e.g. Pentium processors) the number of memory locations possible is 2^n bytes.

If you have more specialized hardware, (embedded microcontrollers, etc) that are word addressable (16-bit, 32-bit), then you are correct that you would multiply 2^n * (word-size in bits) / (8) = # of bytes.

That being said, when you take into consideration virtual addressing and physical bus sizes that might not be the same as the processor's address lines, you would have to take a look at that specific machine for the "theoretical limit".



来源:https://stackoverflow.com/questions/47187340/calculating-memory-size-based-on-address-bit-length-and-memory-cell-contents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!