Sometime ago I found a way to quickly know the size of a memory region from its address bus size, or anything that is about mapping bits to number of permutations, really. It's very, very stupid and simple, it's nothing ground breaking, and I'm pretty sure some smarty pants around here already know that "trick" since long ago, but I share this because 1) some people might find it handy, and 2) I want to know if someone already found it before or heard that somewhere else. Like I said, it's very simple, almost too obvious, but my colleagues, when I told them about that "trick", were like, "oh, that's interesting and useful actually, I didn't realize that before". So here is it:
How do you know, say, the number of bytes an N-bit address bus can address? Decompose N into tens and ones. The digit in the tens place corresponds to a SI suffix: 0 ⇒ (no suffix), 1 ⇒ kilo, 2 ⇒ mega, 3 ⇒ giga etc. and the digit in the ones place maps to a power of two from 1 to 512: 0 ⇒ 1, 1 ⇒ 2, 2 ⇒ 4, ..., 9 ⇒ 512; succinctly put, 2x, but you should know them by heart, which is long done for about all of you.
Example:
The x86_64 architecture has 64-bit registers which makes native integers and pointers 64 bits in size. However, in current implementations found in desktop computers, only 48 LSBs of the virtual address (and thus, of a pointer) are used. What it the size of this virtual addressing space? x86_64 can address bytes, so for 48 address bits, 8 ⇒ 256 and 4 ⇒ Tera, gives 256 TB.
Example:
How many address pins does a 8KB memory have (assuming a 8-bit data bus)? 13, because 10 is for kilo and log2(8) = 3.
Yeah, it feels a bit stupid to develop the reasoning of each example for something that simple, but it would otherwise looks kinda cheap of a post.
How do you know, say, the number of bytes an N-bit address bus can address? Decompose N into tens and ones. The digit in the tens place corresponds to a SI suffix: 0 ⇒ (no suffix), 1 ⇒ kilo, 2 ⇒ mega, 3 ⇒ giga etc. and the digit in the ones place maps to a power of two from 1 to 512: 0 ⇒ 1, 1 ⇒ 2, 2 ⇒ 4, ..., 9 ⇒ 512; succinctly put, 2x, but you should know them by heart, which is long done for about all of you.
Example:
The x86_64 architecture has 64-bit registers which makes native integers and pointers 64 bits in size. However, in current implementations found in desktop computers, only 48 LSBs of the virtual address (and thus, of a pointer) are used. What it the size of this virtual addressing space? x86_64 can address bytes, so for 48 address bits, 8 ⇒ 256 and 4 ⇒ Tera, gives 256 TB.
Example:
How many address pins does a 8KB memory have (assuming a 8-bit data bus)? 13, because 10 is for kilo and log2(8) = 3.
Yeah, it feels a bit stupid to develop the reasoning of each example for something that simple, but it would otherwise looks kinda cheap of a post.