Semiconductor memories
SRAM, DRAM, ROM, EPROM, EEPROM and flash: organisation, capacity, timing, refresh and memory expansion with decoders, with worked numericals.
Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
A data logger stores readings in RAM, keeps its calibration constants in EEPROM and runs its program from flash. Choosing the right memory, sizing it and wiring several chips into one address space are routine tasks in instrument design, and memory capacity and expansion questions appear in almost every GATE paper on digital systems.
Key ideas
Organisation. A memory chip is an array of 2ⁿ locations (words), each m bits wide, written 2ⁿ × m. n address lines select a location through an internal decoder; m data lines carry the word. Control pins: chip select (CS′ or CE′), output enable (OE′) and write enable (WE′), usually active-low. With CS′ HIGH the data pins are high-impedance, so many chips can share a bus.
Volatile memories (RAM).
- SRAM: each bit is a cross-coupled latch (six transistors). Holds data as long as power is on, needs no refresh, fast (a few ns to tens of ns), but large per bit and costly. Used for processor registers, caches and microcontroller data memory.
- DRAM: each bit is one transistor and one capacitor (1T1C). Dense and cheap, but the charge leaks away, so every row must be refreshed periodically (typically every 64 ms) and reading is destructive (the row is rewritten after each read). The address is multiplexed into a row address (strobed by RAS′) and a column address (CAS′) to halve the address pins. Used for main memory.
Non-volatile memories.
- Mask ROM: contents fixed at manufacture; cheapest in volume.
- PROM: one-time programmable by blowing fuses (or antifuses).
- EPROM: floating-gate cells programmed electrically and erased by UV light through a quartz window, whole chip at once.
- EEPROM: electrically erasable byte by byte, in circuit; slower writes (ms) and limited endurance (roughly 10⁵–10⁶ cycles). Used for calibration data and settings.
- Flash: a floating-gate memory erased electrically in blocks or sectors, giving much higher density than EEPROM. NOR flash allows random-access reads (code execution); NAND flash is denser, read in pages (SD cards, SSDs). Endurance typically 10³–10⁵ erase cycles per block.
- Newer: FRAM and MRAM give fast non-volatile writes with very high endurance.
Memory as logic. A ROM with n address inputs and m outputs implements any m functions of n variables (a lookup table): the address decoder generates all minterms and the programmed array ORs them. PLAs and PALs are related programmable arrays with only the needed product terms.
Timing. Access time is the delay from a valid address (or chip select) to valid data out. Cycle time is the minimum time between successive accesses; for DRAM it exceeds the access time because of precharge and restore.
Memory expansion.
- Word-width (bit) expansion: chips in parallel share address and control lines, each supplies part of the data word. For an m-bit word from k-bit chips, use m/k chips per bank.
- Word-count (depth) expansion: banks share data lines; extra high-order address lines go to a decoder whose outputs drive the chip selects, so only one bank is enabled at a time.
- Total chips = (required words / chip words) × (required width / chip width).
Formulas
Capacity = 2ⁿ × m bits
- n: address lines; m: data lines (bits per word). Divide by 8 for bytes; 1 K = 1024.
n = log₂(number of locations)
Chips needed = (W_req / W_chip) × (m_req / m_chip)
- W: number of words; m: word width.
Decoder inputs = log₂(number of banks)
t_row = T_refresh / N_rows
- Interval between row refreshes when refreshes are spread evenly (s).
Refresh overhead = N_rows · t_RC / T_refresh
- t_RC: time for one row refresh (s).
Worked examples
Example 1 (standard). A memory chip has 11 address lines and 8 data lines. Find its organisation and capacity.
- Locations = 2¹¹ = 2048 = 2 K.
- Organisation: 2K × 8.
- Capacity = 2048 × 8 = 16 384 bits = 16 Kbit = 2 KB.
Answer: 2K × 8, 16 Kbit (2 KB)
Example 2 (GATE level). A 16K × 16 memory is to be built from 4K × 4 RAM chips. Find the number of chips, the total address lines, how they are used and the decoder size.
- Chips per bank (width): 16 / 4 = 4.
- Banks (depth): 16K / 4K = 4.
- Total chips = 4 × 4 = 16.
- Address lines for 16K words: log₂(16 384) = 14.
- Each chip has 4K words, so the 12 low-order lines A₁₁–A₀ go to every chip.
- The 2 high-order lines A₁₃–A₁₂ drive a 2-to-4 decoder; each decoder output selects one bank of 4 chips.
Answer: 16 chips, 14 address lines, 12 to all chips and 2 to a 2-to-4 decoder
Example 3 (DRAM refresh). A DRAM has 8192 rows that must all be refreshed every 64 ms; one row refresh takes 50 ns. Find the row refresh interval for distributed refresh and the fraction of time spent refreshing.
- t_row = 64 ms / 8192 = 7.8125 µs.
- Overhead = 8192 × 50 ns / 64 ms = 409.6 µs / 64 ms = 0.0064.
Answer: one row every 7.81 µs; 0.64 % of the time
Common mistakes
- Forgetting to divide by 8 for bytes, or using 1 K = 1000 instead of 1024.
- Counting data lines as part of the address (capacity is 2ⁿ × m, not 2ⁿ⁺ᵐ).
- Connecting high-order address lines to every chip and leaving the decoder short of inputs.
- Calling EEPROM and flash the same: flash erases in blocks, EEPROM by byte.
- Saying DRAM is "slow because of refresh": it is slower mainly because sensing a tiny capacitor charge takes time, and refresh steals only a small fraction of cycles.
For GATE IN
Expect capacity and address-line calculations, chip counts and decoder sizes for memory expansion, address ranges of a chip selected by a given decoder, ROM implementation of functions, and properties of SRAM, DRAM, EPROM, EEPROM and flash. Practise writing the address map (start and end addresses in hex) of each chip in an expanded system.
Quick check
- Capacity in bytes of a memory with 12 address and 16 data lines?
- How many 1K × 8 chips make an 8K × 16 memory?
- Which memory needs refresh?
- How many address lines does a 64 KB byte-wide memory need?
Answers: 1. 8192 bytes 2. 16 3. DRAM 4. 16
See it move
All Instrumentation animationsAdjust the number of address and data lines to see how the memory size changes. Observe how the memory size increases exponentially with more address lines.
Equations used
- Memory Size = 2^n * m — n: Number of address lines, m: Number of data lines
Interview questions
All Digital Electronics and Microcontrollers interview questionsTry answering each one aloud before you open it.
1.What is a semiconductor memory and how is it used in digital electronics?Concept
Semiconductor memory is a type of memory made from semiconductor-based integrated circuits to store data. It is used in digital electronics to store binary information, which can be accessed quickly by the processor. Common types include RAM (Random Access Memory) and ROM (Read-Only Memory). RAM is volatile, meaning it loses data when power is off, while ROM is non-volatile and retains data without power.
2.Explain the difference between volatile and non-volatile memory.Concept
Volatile memory requires power to maintain the stored information, meaning it loses data when the power is turned off. Examples include RAM. Non-volatile memory retains data even when the power is off, making it suitable for long-term data storage. Examples include ROM, flash memory, and EEPROM.
3.What are the main types of ROM and their applications?Concept
The main types of ROM are Mask ROM, PROM, EPROM, and EEPROM. Mask ROM is programmed during manufacturing and is used in applications where the data does not change. PROM can be programmed once after manufacturing. EPROM can be erased by exposure to UV light and reprogrammed, making it useful for development. EEPROM can be electrically erased and reprogrammed, allowing for updates and changes in the field.
4.Why is SRAM faster than DRAM?Application
SRAM (Static RAM) is faster than DRAM (Dynamic RAM) because it uses bistable latching circuitry to store each bit, which allows for quicker access times. DRAM stores bits in capacitors, which need to be refreshed periodically, slowing down access times. SRAM is used in applications requiring high-speed access, such as CPU caches.
5.What happens if a microcontroller's EEPROM is repeatedly written to?Application
EEPROM has a limited number of write cycles, typically ranging from 10,000 to 1,000,000 cycles. Repeatedly writing to EEPROM can wear it out, leading to data corruption or failure to store data. It's important to manage write operations carefully to extend the EEPROM's lifespan.
6.How does flash memory differ from EEPROM?Concept
Flash memory is a type of EEPROM but is designed for high-speed read and write operations. Unlike EEPROM, which can be erased and rewritten at the byte level, flash memory is erased and rewritten in blocks or sectors. This makes flash memory faster for large data operations but less flexible for small data changes.
7.Why is DRAM commonly used for main memory in computers?Application
DRAM is commonly used for main memory because it offers a good balance between cost, capacity, and speed. It is cheaper to produce than SRAM, allowing for larger memory capacities at a lower cost. Although slower than SRAM, its speed is sufficient for main memory applications in most computers.
8.Calculate the total storage capacity of a memory chip with 16 address lines and 8 data lines.Numerical
The total storage capacity can be calculated by multiplying the number of addressable locations by the number of bits per location. With 16 address lines, there are 2^16 = 65,536 addressable locations. With 8 data lines, each location stores 8 bits. Therefore, the total storage capacity is 65,536 × 8 = 524,288 bits or 65,536 bytes.
9.If every DRAM row must be refreshed once every 64 ms, how many times is each row refreshed in one second?Numerical
Refreshes per second = 1 s / 64 ms = 1000/64 = 15.625, so each row is refreshed about 15.6 times per second. With, say, 8192 rows refreshed evenly, the controller issues one row refresh every 64 ms / 8192 = 7.8 µs.
10.Explain the role of cache memory in a processor or microcontroller.Concept
A cache is a small, fast SRAM between the CPU and slower main memory (or flash) that keeps copies of recently and frequently used instructions and data. Because programs tend to reuse nearby addresses (locality of reference), most accesses hit in the cache and run at full CPU speed, while misses fetch a block from the slower memory. Small 8-bit microcontrollers usually have no cache because their on-chip flash and SRAM already keep up with the CPU; faster 32-bit parts (e.g. Cortex-M7) add instruction and data caches or flash accelerators.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?