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 address bits and outputs holds words of bits. A decoder produces 1-hot lines feeding ORs with programmable connections. Since it is a truth table, a ROM is a combinational circuit (no state).
RAM
Interface: -bit data in, -bit data out, -bit address, read and write controls.
Formula (RAM capacity). bits: words of bits; addresses run from to . The number of address bits is independent of .
Example. 16-bit data lines and a 10-bit address: words of bits, bits bits 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 ns. A write cycle of ns takes 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 ns also takes 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 the content does not change; with it is set by the input , and the outputs are enabled by Select too. Cells joined in a bit slice share the read/write logic: word select keeps the value; with word select and bit select , writes the input data and reads the bit. Only one word select can be 1 at a time.
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 matrix: instead of one 4-to-16 decoder, two 2-to-4 decoders are used, one for rows () and one for columns (); the selected cell lies at the intersection (coincident selection). This improves chip shape and access times and needs smaller decoders. An chip with a 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 (18 address bits) from four 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 two chips are joined with the same addresses: the address bits stay 16, the output bits double.
Example. from chips: chips and bits for the chip-select decoder.
Useful counts: bits KB; words ; chips ; address bits ; chip decoder bits .
Common mistakes
- Tying the number of address bits to the word width: 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 : address bits independent of , data bits, read, write, CS. : 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, ns write and ns read both take 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 and writes, reads; one word select at a time. chip: 4-to-16 decoder, three-state output controlled by CS (Hi-Z when unselected).
- Coincident selection: matrix with two 2-to-4 decoders (rows , columns ); chip has two bit slices per column select.
- Arrays: from four : 2 extra address bits on a 2-to-4 chip-select decoder, others in Hi-Z; from two with the same addresses. Chips capacity ratio; address bits .
- Mistakes: address bits tied to word width; refresh misassigned; ROM taken as sequential; unselected outputs read as 0.