# Memory

a.k.a. Random Access Memory (RAM)

1. memory is a huge storage component that stores:
1. Instructions of computer programs
2. Variables (= data) used in the computer programs
﻿

Computer memory is a very fast memory device used to store . . .

• Program instructions
• Program variables (= data) used by program instructions

• Computer memory consists of sequence memory cells
• Each memory cell has 8 bits and it’s called a byte of memory
• A bit can “remember” (store) either the value 0 (= “off” state) or the value 1 (= “on” state)
• (I.e.: bit = one electronical switch – can be on or off)
• Each byte in the memory is uniquely identified by an address
• Each memory byte can store a 8 bit pattern (= a pattern consisting of 8 binary bits)
• Each byte of memory can contain one of the following 256 possible binary patterns (= binary numbers)
• Bytes at address 0 and 1 can form a 16 bits memory cell (with the address 0)
• Bytes at address 0,1,2 and 3 can form a 32 bits memory cell (with the address 0)
• The memory (RAM) has the capability to combine a number of adjacent memory bytes to represent larger values with some limitations
• A memory byte at an even address can be combined with the subsequence memory byte to form a 16 bits memory cell
• A memory byte at an address divisible by 4 can be combined with 3 subsequence memory bytes to form a 32 bits memory cell
• Each quartet of memory cells can store 232 = 4294967296 different patterns
• Each pattern is used to represent a unique value

• Each wire of the data bus can transfer 1 bit of information between the CPU and memory
• The computer will always transfer 16 bits when the computer read or write to the memory
• The memory can activate adjacent consecutive memory cells to perform read/write operations
• So to transfer 16 bits simulatanously, the computer will activate 2 (adjacent consecutive) memory cells (because each memory cells has 8 bits)
• The first byte is located at an even address N
• The second byte is located at the odd address (N+1)
• memory cell 0 + memory cell 1
• memory cell 2 + memory cell 3
• memory cell 4 + memory cell 5
• That’s why only bytes that is located at an even address can be combined with the byte at the next address

## Reference

1. Structure of the computer memory (RAM). (n.d.). Retrieved August 4, 2021, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syl-ARM/4-intro/memory1.html
2. Data transfer between CPU and memory. (n.d.). Retrieved August 4, 2021, from http://www.mathcs.emory.edu/~cheung/Courses/255/Syl-ARM/4-intro/mem-access.html