Salta al contenuto
Note per Studenti Main Memory - RAM, ROM and Chip Organisation Report

Main Memory - RAM, ROM and Chip Organisation

In questa pagina 5

A memory is a set of cells storing bits, with the circuitry to move information to and from the cells. In a computer it holds instructions and data (input, output, intermediate). Moving new data in is a write, moving stored data out is a read. Information is grouped in words (usually multiples of 8 bits, e.g. 16-bit words).

Classification

  • Read/write capability: read-only (ROM; programmable variants PROM, EPROM, EEPROM, Flash) and read/write.
  • Access:
    • RAM (Random Access Memory): every bit is reached with the same effort whatever the access order (SRAM, DRAM);
    • SAM (Serial Access Memory): the time depends on position (tape, CD); consecutive locations are faster than arbitrary addresses;
    • hybrid: whole portions (blocks, sectors, pages) are accessed, as in Flash.
  • Volatility: volatile (SRAM, DRAM lose data without power) and non-volatile (Flash, ROM).

Characteristics: capacity (density); speed (random access time in ns, or throughput in Mbit/s for serial access); power consumption; retention (how long data last); endurance (erase/program cycles sustained).

ROM

A ROM with kk address bits and nn outputs holds 2k2^k words of nn bits. A k→2kk\to2^k decoder produces 1-hot lines feeding nn ORs with programmable connections. Since it is a truth table, a ROM is a combinational circuit (no state).

RAM

Interface: nn-bit data in, nn-bit data out, kk-bit address, read and write controls.

Formula (RAM capacity). size=2k×n\text{size}=2^k\times n bits: 2k2^k words of nn bits; addresses run from 00 to 2k−12^k-1. The number of address bits kk is independent of nn.

Example. 16-bit data lines and a 10-bit address: 10241024 words of 1616 bits, 1K×161\mathrm K\times16 bits =214=2^{14} bits =2=2 KB. A word is read or written in parallel on all bits, as a unit (the smallest addressable quantity).

Operations. Write: apply the address, apply the data, activate write. Read: apply the address, activate read. A Chip Select (CS) signal enables the chip for read and write. Signals come from an external unit, usually the CPU.

Timing example. CPU clock period 2020 ns. A write cycle of 7575 ns takes ⌈75/20⌉=4\lceil75/20\rceil=4 clock cycles: at the first edge address and memory enable are given; at the second write is activated and the data supplied (activating write before the address is stable would write other locations by mistake); address and data must stay stable beyond the write edge. A read cycle of 6565 ns also takes ⌈65/20⌉=4\lceil65/20\rceil=4 cycles: at the first edge address, enable and read; after the access time the memory presents the data; at a later edge the CPU latches it into a register and address and controls may change.

SRAM and DRAM

  • SRAM (Static RAM): bits are held in bistable elements (latches): data stay valid while powered, with no external action.
  • DRAM (Dynamic RAM): the information is the charge of a capacitor, accessed through an n-channel MOSFET; the capacitor discharges, so periodic refresh (rewriting the cell) is needed.

SRAM is simpler to use (no refresh) and faster; DRAM consumes less, takes less area and so costs less per bit. Typical use: SRAM for the cache, DRAM for main memory (Memory Hierarchy and Cache MemoryMemories form a hierarchy (small fast SRAM, larger slower DRAM, huge slow disks) which works because programs reuse data close in time and in space (locality). A cache hit or miss gives an average access time t_hit plus miss rate times miss penalty; placement can be direct mapped (index = low address bits, tag = high bits), fully associative (tag = whole address, compared in parallel by an associative memory) or k-way set associative (a block can sit in k locations of one set).Memory Hierarchy and Cache Memory →).

SRAM cell and bit slice

The cell is modelled by an SR latch whose state is the stored bit; Set and Reset are enabled by Select: with Select=0Select=0 the content does not change; with Select=1Select=1 it is set by the input BB, and the outputs are enabled by Select too. Cells joined in a bit slice share the read/write logic: word select =0=0 keeps the value; with word select =1=1 and bit select =1=1, Read/Write‾=0Read/\overline{Write}=0 writes the input data and Read/Write‾=1Read/\overline{Write}=1 reads the bit. Only one word select can be 1 at a time.

16×116\times1 SRAM chip and coincident selection

A 4-to-16 decoder generates the word select signals from the address bits (only one active). A three-state buffer driven by Chip Select connects the output to the data line or leaves it in high impedance (Hi-Z).

The same 16 cells can be laid out as a 4×44\times4 matrix: instead of one 4-to-16 decoder, two 2-to-4 decoders are used, one for rows (A3,A2A_3,A_2) and one for columns (A1,A0A_1,A_0); the selected cell lies at the intersection (coincident selection). This improves chip shape and access times and needs smaller decoders. An 8×28\times2 chip with a 4×44\times4 array connects the column decoder outputs to the bit select of two bit slices: one address bit fewer, and 2 bits are read or written together.

Arrays of chips

Property. When the required memory is larger than a chip, an array is built.

  • More words: for 256K×8256\mathrm K\times8 (18 address bits) from four 64K×864\mathrm K\times8 chips (16 address bits), 2 extra address bits drive a 2-to-4 decoder that enables (Chip Select) one of the 4 chips. On read the 8-bit bus carries the selected chip's data, the unselected outputs being in high impedance; on write the data go to the chip with CS active.
  • More bits per word: for 64K×1664\mathrm K\times16 two 64K×864\mathrm K\times8 chips are joined with the same addresses: the address bits stay 16, the output bits double.

Example. 256K×8256\mathrm K\times8 from 64K×864\mathrm K\times8 chips: 256/64=4256/64=4 chips and 18−16=218-16=2 bits for the chip-select decoder.

Useful counts: 216×82^{16}\times8 bits =64=64 KB; 2182^{18} words =256K=256\mathrm K; chips =required capacitychip capacity=\dfrac{\text{required capacity}}{\text{chip capacity}}; address bits =log⁡2(#words)=\log_2(\#\text{words}); chip decoder bits =log⁡2(#chips in vertical)=\log_2(\#\text{chips in vertical}).

Common mistakes

  • Tying the number of address bits to the word width: kk depends only on the number of words.
  • Forgetting DRAM refresh, or saying SRAM needs it.
  • Thinking a ROM is sequential: it is combinational.
  • Believing unselected chips output 0: they are in high impedance.
  • Confusing RAM (random access) with volatile memory: Flash is non-volatile but not a pure random-access RAM.

Versione ripasso

  • Classes: read-only (ROM and programmable variants) or read/write; RAM (random), SAM (serial, consecutive locations faster), hybrid (Flash, by blocks); volatile (SRAM, DRAM) or non-volatile (Flash, ROM). Parameters: capacity, access time or throughput, power, retention, endurance. A ROM is combinational.
  • RAM 2k×n2^k\times n: kk address bits independent of nn, nn data bits, read, write, CS. 1K×161\mathrm K\times16: 10 address bits, 2 KB.
  • Operations: write = address, data, then write; read = address, then read, data after the access time. With a 20 ns clock, 7575 ns write and 6565 ns read both take ⌈⋅/20⌉=4\lceil\cdot/20\rceil=4 cycles; address and data must stay stable beyond the write edge.
  • SRAM: latch cell, fast, no refresh, cache. DRAM: capacitor plus MOSFET, refresh, dense and cheap, main memory.
  • Cell and slice: SR latch enabled by Select; word select =1=1 and Read/Write‾=0Read/\overline{Write}=0 writes, =1=1 reads; one word select at a time. 16×116\times1 chip: 4-to-16 decoder, three-state output controlled by CS (Hi-Z when unselected).
  • Coincident selection: 4×44\times4 matrix with two 2-to-4 decoders (rows A3A2A_3A_2, columns A1A0A_1A_0); 8×28\times2 chip has two bit slices per column select.
  • Arrays: 256K×8256\mathrm K\times8 from four 64K×864\mathrm K\times8: 2 extra address bits on a 2-to-4 chip-select decoder, others in Hi-Z; 64K×1664\mathrm K\times16 from two 64K×864\mathrm K\times8 with the same addresses. Chips == capacity ratio; address bits =log⁡2(#words)=\log_2(\#\text{words}).
  • Mistakes: address bits tied to word width; refresh misassigned; ROM taken as sequential; unselected outputs read as 0.

Teoria collegata