Basic RAM Memory System
RAM memory with program loader and clock control. Introduction to random access memory operation and addressing.
学べること
- Recognize a RAM as addressable storage with read and write ports.
- Use address inputs to select a memory word.
- Use write-enable to strobe data into the addressed word.
- Read back stored data from any address.
- Connect this to CPU caches, microcontroller scratchpads, and FPGA BRAMs.
仕組み
A basic RAM memory system stores data at addressable locations. The fundamental operations are write (store data at an address) and read (retrieve data from an address). This circuit demonstrates the simplest functional RAM — typically 4 to 16 words, each a few bits wide, with explicit address, data-in, write-enable, and data-out lines.
Write cycle: 1. Address inputs select a word location. 2. Data inputs present the value to store. 3. Write-enable strobes; on the active edge, the addressed word's flip-flops capture the data.
Read cycle: 1. Address inputs select a word. 2. The output MUX routes the addressed word's flip-flops to the data-out lines.
Real RAM uses much denser storage cells (DRAM uses one transistor + capacitor per bit; SRAM uses 6 transistors per bit). The conceptual structure — addressable storage, decoder for address-to-word selection, output MUX — is the same as this simplified model.
Key insight: a RAM is essentially a register file with address-decoded write-enable and address-controlled output MUX. Each "word" is a small register; the decoder picks which one to write; the MUX picks which one to read.
順を追って試す
上の埋め込み回路で入力を設定し、期待される結果と一致するか確認しましょう。
- 1Address = 00 Data In = 1010 Write-Enable = 1 Clock = rising期待値:
RAM[0] = 1010観察ポイント: Write 1010 to address 0. Read it back by setting address=00 and removing write-enable. - 2Address = 01 Data In = 0101 Write-Enable = 1 Clock = rising期待値:
RAM[1] = 0101観察ポイント: Write 0101 to address 1. Each address holds independent data. - 3Address = 00 Write-Enable = 0期待値:
Data Out = 1010観察ポイント: Read address 0 — data port reflects the previously stored 1010. Read is asynchronous (no clock needed) in this simple model. - 4Address = 10 Data In = 1111 Write-Enable = 0期待値:
RAM[2] unchanged観察ポイント: Write-enable low — even though Data In is presented, RAM doesn't capture. Reads of address 2 return whatever was previously written there (or 0 at power-on).
使用コンポーネント
実世界での応用
CPU L1 / L2 / L3 caches. Caches are SRAMs with set-associative organization. The base storage is the same address-decoded register array.
Microcontroller scratchpad RAM. On-chip SRAM for variables and stack — typically 1 KB to 1 MB, accessed in single cycles.
FPGA block RAMs. Dedicated RAM blocks in FPGAs (e.g., Xilinx BRAM, Intel M9K) are SRAM cells with the same address/data/we structure exposed to user logic.
Frame buffers in graphics chips. Display frame buffers are RAMs with x/y coordinates as the address; pixel data flows through the data port.
Lookup tables (LUTs) in instruments. Function generators store waveform samples in RAM; address increments through samples to produce the analog output.