EC311_Fall2024_Lecture21(1)
EC311_Fall2024_Lecture21(1)
Lecture 21
Finite State Machines
Memory
11/20/2024
N N
(a) (b)
clk clk
Inputs: enough Inputs: enough
State: I W W D I State: I W W I
Digital Design 2e
Copyright © 2010
Frank Vahid
Mealy vs. Moore
Inputs: b; Outputs: s1, s0, p Inputs: b; Outputs: s1, s0, p
• Q: Which is Moore, b’
Time b’/s1s0=00, p=0 Time
and which is Mealy? b/s1s0=00, p=1 b
s1s0=00, p=0
• A: Mealy on left, Moore on
Alarm S2 s1s0=00, p=1
right b’/s1s0=01, p=0
b
– Mealy outputs on b/s1s0=01, p=1
Alarm
b’
clk clk
Digital Design 2e
Copyright © 2010
Frank Vahid
Basic Register
• Typically, we store multi-bit items
– e.g., storing a 4-bit binary number
• Register: multiple flip-flops sharing clock signal
– From this point, we’ll use registers for bit storage
• No need to think of latches or flip-flops
• But now you know what’s inside a register
I3 I2 I1 I0
4-bit register
D D D D I3 I2 I1 I0
Q Q Q Q reg(4)
clk Q3 Q2 Q1 Q0
Q3 Q2 Q1 Q0
Digital Design 2e
Copyright © 2010
Frank Vahid
Register Examples
Random Access Memory (RAM)
• RAM – Readable and writable memory 32 32
W_data R_data
– “Random access memory” 4 4
• Strange name—Created several decades ago to contrast W_addr R_addr
with sequentially-accessed storage like tape drives W_en R_en
– Logically same as register file—Memory with address ×
16 32
register file
inputs, data inputs/outputs, and control
• RAM usually one port; RF usually two or more Register file from Chpt. 4
– RAM vs. RF
• RAM typically larger than about 512 or 1024 words
32
• RAM typically stores bits using a bit storage approach data
that is more efficient than a flip-flop 10
addr
• RAM typically implemented on a chip in a square rather 1024× 32
rw RAM
than rectangular shape—keeps longest wires (hence
delay) short en
Digital Design 2e
Copyright © 2010
Frank Vahid
RAM Internal Structure
Let A = log2M wdata(N-1)wdata(N-2)
wdata0
32
data
10 word bit storage
addr block
1024x32 enable
rw RAM d0 (aka “cell”)
en
addr0 a0 word
addr1 a1 AxM
d1
decoder
addr(A-1) a(A-1) data cell
word word
e d(M-1) enableenable
clk
Combining rd and wr rw data
en
data lines rw to all cells
wdata
rdata0
wdata0
rdata
(N-1)
(N-1)
rdata(N-1)rdata(N-2)rdata0
RAM cell
rw
addr
decoder
en addr(A-1) a(A-1) data cell
word 0
enable
Digital Design 2e
Copyright © 2010
Frank Vahid
Static RAM (SRAM)
wdata(N-1) wdata(N-2) wdata0
32 Let A =log2 M
data word bit storage
10 enable block ,, ,,
addr d0 (aka cell )
1024x32 addr0 a0 word
rw RAM addr1 a1 A × M
d1
addr
decoder
en addr(A-1) a(A-1) data cell
word word
e d(M-1) enable enable
clk
rw data
en
rw to all cells
Digital Design 2e
Copyright © 2010
Frank Vahid