Chapter 4 - Memory
Chapter 4 - Memory
⚫ Introduction
Permanence
Chapter 4 ⚫ Common Memory Types
⚫ Composing Memory
1 2
m words
⚫ Storage ⚫ e.g. 4,096 x 8 memory:
…
⚫ memory ⚫ 32,768 bits
⚫ retention of data ⚫ 12 address input signals
⚫ buses
⚫ transfer of data
3 4
Write ability/ storage
… permanence
⚫ Memory access
⚫ Traditional ROM/RAM distinctions
⚫ r/w: selects read or write
⚫ ROM: Read only, bits stored without power
⚫ enable: read or write only when asserted
⚫ RAM: Read and write, lose stored bits without power
⚫ multiport: multiple accesses to different locations
⚫ Traditional distinctions blurred
simultaneously
⚫ Advanced ROMs can be written to: EEPROM
Memory External View
r/w ⚫ Advanced RAMs can hold bits without power: NVRAM
k
Enable 2 ×n ⚫ Write ability
read and write
A0 … memory ⚫ Manner and speed a memory can be written
⚫ processor writes to memory simply and quickly: RAM ⚫ essentially never loses bits: Mask-programmed ROM
In-system
⚫ Programmed offline
programmable SRAM/DRAM
Near
Write
⚫ Uses
zero
ability
During External External External External
⚫ Store software program for general-purpose processor
In-system, fast
fabrication programmer, programmer, programmer programmer
writes,
only one time only 1,000s OR in-system, OR in-system,
unlimited
⚫ Store constant data needed by system
of cycles 1,000s block-oriented
cycles
of cycles writes, 1,000s
of cycles
⚫ Implement combinational circuit
Implementing combinational
Example: 8 x 4 ROM function
⚫ Horizontal lines = words
⚫ Any combinational circuit of n functions of
⚫ Vertical lines = data Internal view
same k variables can be done with 2^k x n
⚫ Lines connected only at
8 × 4 ROM
enable 3×8
word 0
word 1
ROMTruth table
circles decoder word 2
Inputs (address) Outputs 8×2 ROM
A0 word line
a b c y z
⚫ Decoder sets word 2’s line to 1 A1
A2 0 0 0 0 0 0 0 word 0
0 0 1 0 1 0 1 word 1
if address input is 010 data line
0 1 0 0 1
0 1
0 1 1 1 0
⚫ Data lines Q3 and Q1 are set to
programmable
connection wired-OR 1 0 0 1 0 enable 1 0
1 0 1 1 1
Q 3 Q 2 Q 1 Q0 1 1 0 1 1 1 0
1 because there is a 1 1 1 1 1
c
1 1
b
“programmed” connection a 1 1
1 1 word 7
with word 2’s line
y z
⚫ Word 2 is not connected with
11 12
OTP ROM: One-time programmable
Mask-programmed ROM ROM
⚫ Connections “programmed” at fabrication ⚫ Connections “programmed” after manufacture by user
⚫ user provides file of desired contents of ROM
⚫ set of masks
⚫ file input to machine called ROM programmer
⚫ Lowest write ability
⚫ each programmable connection is a fuse
⚫ only once ⚫ ROM programmer blows fuses where connections should not exist
(c)
floating-gate causes negative charges to
return to channel from floating gate
(d)
restoring the logic 1
memory user
17 18
line connects to each cell in its Enable ⚫ Holds data as long as power supplied
2×4
column
A0 decoder
⚫ when
cell
row is enabled by rd/wr To every cell
decoder, each cell has logic Data' Data
Q3 Q2 Q1 Q0
that stores input data bit when
rd/wr indicates write or W
outputs stored bit when rd/wr
21 22
indicates read
… Ram variations
⚫ DRAM: Dynamic RAM
⚫ PSRAM: Pseudo-static RAM
⚫ Memory cell uses MOS transistor and capacitor to
⚫ DRAM with built-in memory refresh controller
store bit
⚫ Popular low-cost high-density alternative to SRAM
⚫ More compact than SRAM
⚫ NVRAM: Nonvolatile RAM
DRAM
⚫ “Refresh” required due to capacitor leak
⚫ Holds data after external power removed
Data
⚫ word’s cells refreshed when read
W
⚫ Battery-backed RAM
⚫ Typical refresh rate 15.625 microsec.
⚫ SRAM with EEPROM or flash
⚫ Slower to access than SRAM
23 24
Example:HM6264 & 27C256
… RAM/ROM devices
⚫ Battery-backed RAM ⚫ Low-cost,
11-13, 15-19 data<7…0> data<7…0>
11-13, 15-19
22 /OE 22 /OE
⚫ Commonly used in
20 /CS1
ROM-based memory 8-bit Device Access Time (ns) Standby Pwr. (mW) Active Pwr. (mW) Vcc Voltage (V)
HM6264 85-100 .01 15 5
27C256 90 .5 100 5
type
25 26 ⚫ RAM: 62, ROM: 27
⚫ Subsequent digits
indicate capacity in
Am
⚫ Connect top to bottom to increase number of words … …
…
27 28
… …
⚫ Increase number of words ⚫ Increase number and width of words
2m+1 × n ROM
2m × n ROM
A
A0
… …
Am-1
1×2
…
Am decoder
2m × n ROM
Enable
…
…
enable
… outputs
29 Qn- Q0 30
1
Main memory ⚫ faster access ( 1 cycle vs. several cycles for main memory)
Disk
Tape
31 32
… Cache mapping
⚫ Cache operation: ⚫ Far fewer number of available cache addresses
⚫ Request for main memory access (read or write)
⚫ Are address’ contents in cache?
⚫ First, check cache for copy
⚫ Cache mapping used to assign main memory
⚫ cache hit
⚫ copy is in cache, quick access address to cache address and determine hit or
⚫ cache miss
miss
⚫ copy not in cache, read address and possibly its neighbors into cache
⚫ cache mapping, replacement policies, and write techniques lines of adjacent memory addresses
⚫ usually 4 or 8 addresses per line
33 34
⚫ Valid bit …
⚫ Offset
35 36
⚫ used to find particular word in cache line
Set-associative mapping …
⚫ Compromise between direct mapping and fully
associative mapping Tag Index Offset
37 38
Cache-replacement policy …
⚫ Technique for choosing which block to replace ⚫ FIFO: first-in-first-out
⚫ when fully associative cache is full ⚫ push block onto queue when accessed
⚫ when set-associative cache’s line is full ⚫ choose block to replace by popping queue
times
⚫ replace block chosen at random
39 40
Cache impact on system
Cache write techniques performance
⚫ Write-through ⚫ Most important parameters in terms of
⚫ write to main memory whenever cache is written to
performance:
⚫ easiest to implement
⚫ Total size of cache
⚫ processor must wait for slower main memory write
⚫ total number of data bytes cache can hold
⚫ potential for unnecessary writes
⚫ tag, valid and other house keeping bits not included in total
⚫ Write-back
⚫ Degree of associativity
⚫ main memory only written when “dirty” block replaced
⚫ Data block size
⚫ extra dirty bit for each block set when cache block written to
41 42
⚫ 8 Kbyte cache: miss rate = 5.565%, hit cost = 4 cycles, miss cost
2
0
cache size
1 Kb 2 Kb 4 Kb 8 Kb 16 Kb 32 Kb 64 Kb 128 Kb
will not change
43 ⚫ avg. cost of memory access = (0.94435 * 4) + (0.05565 * 20) = 4.8904 44
Advanced RAM Basic DRAM
⚫ DRAMs commonly used as main memory in ⚫ Address bus multiplexed between row and column
components
processor based embedded systems
⚫ Row and column addresses are latched in, sequentially,
⚫ high capacity, low cost
by strobing ras and cas signals, respectively
⚫ Many variations of DRAMs proposed
⚫ Refresh circuitry can be external or internal to DRAM
⚫ FPM DRAM: Fast Page Mode DRAM
device
⚫ EDO DRAM: Extended Data Out DRAM
⚫ strobes consecutive memory address periodically causing
⚫ SDRAM/ESDRAM: Synchronous and Enhanced memory content to be refreshed
Synchronous DRAM ⚫ Refresh circuitry disabled during read or write operation
45 46
Sense
⚫ Timing diagram:
Amplifiers
Col Decoder
rd/wr cas
⚫ row (page) address sent
cas, ras, clock
Row Decoder
each
ras
address ⚫ Extra cycle eliminated
ras on each read/write of words
Bit storage array
from same pagecas
address row col col col
⚫ allows strobing of cas before data read operation completed active edge of clock to access consecutive memory locations
⚫ ESDRAM improves SDRAM
⚫ Reduces read/write latency by additional cycle
⚫ added buffers enable overlapping of column addressing
⚫ faster clocking and lower read/write latency possible
ras
cas
49 50
arbitration
⚫ Takes care of memory sharing among multiple
processors
⚫ Translates logical memory addresses from processor
53