# Memory --- CS 130 // 2022-10-20 # Review ## Sequential Logic - **Sequential** logic circuits do have memory + Output depends on both the input and current state of memory + Behavior can change **over time** ### Sequential Logic Components - **Clock**: a signal that oscillates between 0 and 1 - **Latch**: 1-bit memory element that is updated when the clock is 1 - **Flip Flop**: 1-bit memory element that is updated when the clock transitions from a 1 to a 0 - **Register**: multi-bit memory unit (32 or 64 bits) that consists of an array of flip flops or latches - **Register Files**: An array of registers ## S-R Latch
- A "set reset" latch is implemented with
$S$
$R$
$Q_\text{next}$
0
0
$Q$
0
1
0
1
0
1
## D Latch
- A "data" latch is implemented with
$C$
$D$
$Q_\text{next}$
0
0
$Q$
0
1
$Q$
1
0
0
1
1
1
# ROM ## ROM: Read-Only Memory - Intended only to be read from (though it may be possible to change it in some circumstances) - **Non-volatile**: keeps its value without power - Game Cartidges, CD-ROM, DVD - Firmware for PCs and other devices + contains boot-up instructions   # RAM ## RAM: Random Access Memory - It takes the same amount of time to access data regardless of where it is  ## Static Random Access Memory - Memory where data is stored *statically* with flip-flops - Faster than DRAM but less dense (lower capacity) and more expensive per bit - As long as it has power, SRAM will keep its value - Usually used for cache memory ## Dynamic Random Access Memory - DRAM is the most dense of RAM * Implemented with capacitors instead of latches - stores energy in an electrical field - Must be occasionally "refreshed" because the capacitors slowly lose their stored values * This is why it is called "dynamic" - Usually used for large capacity RAM ## Instruction Memory on the CPU  ## Demo: Make it in Logisim - We will use a ROM to simulate our instruction memory  ## Exercise - Write a MIPS program, load it into your ROM   ## Exercise - You can set your splitter to have custom fan-out ranges - Make a separate pin for each instruction field (opcode, rs, rt, etc.)

 