Last active
August 29, 2015 14:27
-
-
Save shaunhess/60a9ceedf9c0707c44bf to your computer and use it in GitHub Desktop.
A Brief Introduction to Memory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAM, random access memory, is the ability to store/read values based on address inputs | |
(versus say sequentially). It is also commonly referred to as voltile memory because it | |
requires a constant supply of electricity to retain its contents. | |
The number of values that a RAM array can store is based on the number of address inputs. | |
With 1 address input we can store 2 values (0 or 1). | |
2 addresses = 4 values (00, 01, 10, 11) | |
3 addresses = 8 values (000, 001, 010, 100, 011, 101, 110, 111) | |
4 addresses = 16 values | |
num of values in RAM array = 2^num address inputs | |
An example RAM array: | |
10 addresses = 8196 bits organized as 1024(2^10) values of 8 bits each (1024x8) | |
Imagine this as a post office that has 1024 mailboxes that can store 1 byte | |
(8 bits [00000000]) in each mail box. | |
1024(2^10) bytes is also known as a kilobyte (K or KB). In everyday life we typically | |
deal with numbers based on the power of 10 where kilo would be a 1000 (10^3). Remember | |
binary is based on powers of 2. | |
So for each address we add we double the amount of memory: | |
1 kilobyte = 1024 bytes = 2^10 bytes | |
2 kilobytes = 2048 bytes = 2^11 bytes | |
4 kilobytes = 4096 bytes = 2^12 bytes | |
8 kilobytes = 8192 bytes = 2^13 bytes | |
16 kilobytes = 16,384 bytes = 2^14 bytes | |
32 kilobytes = 32,768 bytes = 2^15 bytes | |
64 kilobytes = 65,536 bytes = 2^16 bytes | |
128 kilobytes = 131,072 bytes = 2^17 bytes | |
256 kilobytes = 262,144 bytes = 2^18 bytes | |
512 kilobytes = 524,288 bytes = 2^19 bytes | |
1024 kilobytes = 1,048,576 bytes = 2^20 bytes | |
1024 kilobytes (KB) = 1 megabyte (MB) | |
1 megabytes = 1,048,576 bytes = 2^20 bytes | |
2 megabytes = 2,097,152 bytes = 2^21 bytes | |
4 megabytes = 4,194,304 bytes = 2^22 bytes | |
8 megabytes = 8,388,608 bytes = 2^23 bytes | |
16 megabytes = 16,777,216 bytes = 2^24 bytes | |
32 megabytes = 33,554,432 bytes = 2^25 bytes | |
64 megabytes = 67,108,864 bytes = 2^26 bytes | |
128 megabytes = 134,217,728 bytes = 2^27 bytes | |
256 megabytes = 268,435,456 bytes = 2^28 bytes | |
512 megabytes = 536,870,912 bytes = 2^29 bytes | |
1024 megabytes = 1,073,741,824 bytes = 2^30 bytes | |
1024 megabytes (MB) = 1 gigabyte (GB) | |
1024 gigabytes (GB) [2^40] = 1 terabyte (TB) | |
1024 terabytes (TB) [2^50] = 1 petabyte (PB) | |
1024 petabytes (PB) [2^60] = 1 exabyte | |
Note: Sometimes you will hear referenced kilobits or megabits. This is not common when | |
talking about memory. This usually occurs in the discussion of data transmission over | |
some medium like a wire "megabits per second". | |
Now for another example. For this example we have to remember that hexadecimal is base 16. | |
So a hexadecimal digit (0-9,A-F) is equivilant to 4 bits. So a byte can be represented | |
by 2 hexadecimal digits. | |
Binary(base 2) Hexadecimal(base 16) Decimal(base 10) | |
0000 0 0 | |
0001 1 1 | |
0010 2 2 | |
0011 3 3 | |
0100 4 4 | |
0101 5 5 | |
0110 6 6 | |
0111 7 7 | |
1000 8 8 | |
1001 9 9 | |
1010 A 10 | |
1011 B 11 | |
1100 C 12 | |
1101 D 13 | |
1110 E 14 | |
1111 F 15 | |
Since 2 hexadecimal digits can represent a byte we can use B6 to represent 10110110 | |
(1011 = B, 0110 = 6). | |
Lets take a quick look at converting hexadecimal to binary and then to decimal: | |
B6h | |
B = 1011, 6 = 0110 | |
To convert 10110110 to decimal 1x128 + 0x64 + 1x32 + 1x16 + 0x8 + 1x4 + 1x2 + 0x1 = 182 | |
So back to our memory example. Say we have a chip with: | |
16 addresses (2^16) = 65,536 bytes | |
Since the address is 2 bytes exactly we can address this with a hexadecimal range of | |
0000h through FFFFh. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment