Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Chapter 5:
Register-Transfer Level
(RTL) Design
Slides to accompany the textbook Digital Design, with RTL Design, VHDL,
and Verilog, 2nd Edition,
by Frank Vahid, John Wiley and Sons Publishers, 2010.
http://www.ddvahid.com
2010
1
Instructors may make printouts of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. Instructors
Frank Vahid
may obtain PowerPoint
source or obtain special use permissions from Wiley see http://www.ddvahid.com for information.
5.1
Chpt 2
Capture Comb. behavior: Equations, truth tables
Convert to circuit: AND + OR + NOT Comb. logic
Chpt 3
Higher levels
Introduction
Registertransfer
level (RTL)
Logic level
Chpt 4
Datapath components, simple datapaths
Transistor level
Levels of digital
design abstraction
Chpt 5
Capture behavior: High-level state machine
Convert to circuit: Controller + Datapath Processor
Known as RTL (register-transfer level) design
Digital Design 2e
Copyright 2010
Frank Vahid
Processors:
Programmable
(microprocessor)
Custom
2
Note: Slides with animation are denoted with a small red "a" near the animated items
5.2
c
d
8-bit input/output
Storage of current total
Addition (e.g., 25 + 10)
0 1 0 1 0
c
d
0 1 0
Digital Design 2e
Copyright 2010
Frank Vahid
Soda
dispenser
processor
50
a 25
25
Soda tot:
tot:
dispenser
25
processor 50
HLSMs
s
8
c
d
Numbers:
Single-bit: '0' (single quotes)
Integer: 0 (no quotes)
Multi-bit: 0000 (double quotes)
a
Soda
dispenser
processor
Multi-bit input/output
Local storage
Arithmetic operations
Conventions
Wait
d:='0'
tot:=0
c*(tot<s)
tot:=tot+a
c'*(tot<s)
Disp
SodaDispenser
d:='1'
4
Preg
32
m
clk
CountHigh
CountHigh
Inputs: m (bit)
Outputs: P (32 bits)
Local storage: Preg
CountHigh
Inputs: m (bit)
Outputs: P (32 bits)
Local storage: Preg
S_Clr
// Clear Preg to 0s
Preg := 0
a
m'
S_Wt
m'
m'
(a)
Digital Design 2e
Copyright 2010
Frank Vahid
(b)
S_Wt
m
// Increment Preg
S_Inc Preg := Preg + 1
(c)
Note: Could have designed directly using an up-counter. But, that methodology
5
is ad hoc, and won't work for more complex examples, like the next one. a
D
Object of
interest
sensor
Digital Design 2e
Copyright 2010
Frank Vahid
sensor
from button
D
to display
16
Laser-based
distance
measurer
to laser
S
from sensor
Inputs/outputs
Digital Design 2e
Copyright 2010
Frank Vahid
DistanceMeasurer
Inputs: B (bit), S (bit)
Outputs : L (bit), D (16 bits)
Local storage: Dreg(16)
to display
16
Laserbased
distance
measurer
to laser
from sensor
(required)
a
S0
Digital Design 2e
Copyright 2010
Frank Vahid
DistanceMeasurer
...
B' // button not pressed
to display
S0
S1
L := '0'
Dreg := 0
B
// button
pressed
16
Laserbased
distance
measurer
to laser
from sensor
Digital Design 2e
Copyright 2010
Frank Vahid
S0
L := '0'
Dreg := 0
B'
to display
S1
S2
S3
L := '1'
// laser on
L := '0'
// laser off
16
Laserbased
distance
measurer
to laser
from sensor
10
DistanceMeasurer
S0
S1
L := '0'
Dreg := 0
Dctr := 0
// reset cycle
count
D
to display
16
Laser-based
distance
measurer
to laser
from sensor
S // reflection
?
S2
S3
L := '1'
L := '0'
Dctr := Dctr + 1
// count cycles
11
DistanceMeasurer
B'
S'
S0
S1
L := '0'
Dreg := 0
Dctr := 0
S2
L := '1'
S3
Laserbased
16
distance
measurer
to laser
S
from sensor
S4
Dreg := Dctr/2
L := '0'
Dctr := Dctr+1 // calculate D
12
S3
S
Dctr := Dctr+1
S3
Example:
Inputs: B (bit)
Outputs: P (bit) // if B, 2 cycles high
Local storage: Jreg (8 bits)
B'
!(Jreg<2)
S0
P := '0'
Jreg := 1
Digital Design 2e
Copyright 2010
Frank Vahid
Jreg<2
S1
P := '1'
Jreg := Jreg + 1
(a)
clk
S0
S1
S1
S0
1
?
2
1
3
2
S/
Dctr := Dctr+1
B
Jreg
P
(b)
13
5.3
External
control
...
inputs
External ...
control
outputs
DP
control
inputs
...
External data
inputs
...
Datapath
Controller
...
DP
control
outputs
...
External data
outputs
Digital Design 2e
Copyright 2010
Frank Vahid
14
CountHigh
000...00001
A
B
add1
S
32
CountHigh
m
First clear Preg to 0s
Then increment Preg for each
clock cycle that m is 1
Preg
(a)
Preg_clr
Preg_ld
(c)
We
created
this
HLSM
earlier
m'
S_Wt
(b)
Digital Design 2e
Copyright 2010
Frank Vahid
Connect
with
controller
Derive
controller
32
CountHigh
m
//Preg := 0
S_Clr Preg_clr = 1
Preg_ld = 0
m'
m'
//Increment Preg
S_Inc Preg := Preg + 1
Create DP
DP
000...00001
m'
clr I
ld Preg
Q
A
B
add1
S
32
clr I
ld Preg
Q
Controller
(d)
32
15
Digital Design 2e
Copyright 2010
Frank Vahid
16
ld
clr
d:='0'
tot:=0
Wait
c*(tot<s)
Digital Design 2e
Copyright 2010
Frank Vahid
8-bit
adder
8-bit
<
tot_lt_s
tot:=tot+a
Step 2A
c'*(tot<s)
d:='1'
Step 1
Datapath
Disp
SodaDispenser
tot
c
Init
c
tot_ld
tot_clr
Controller
tot_lt_s
Datapath
Step 2B
17
c
tot_ld
tot_clr
Controller
tot_lt_s
Datapath
Step 2B
c
Init
d:='0'
tot:=0
Wait
c*(tot<s)
tot:=tot+a
c'*(tot<s)
Wait
d=0
tot_clr=1
c' *
tot_lt_s
Disp
SodaDispenser
d:='1'
Step 1
Digital Design 2e
Copyright 2010
Frank Vahid
tot_ld
c
Add
tot_clr
tot_ld=1
tot_lt_s
c*tot_lt_s
Disp
Controller
d=1
Step 2C
18
Wait
Add
Disp
c
0
0
1
0
0
0
0
1
1
tot_clr
s0
0
0
0
tot_ld
s1
0
0
0
tot_lt_s
Init
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
n1
0
0
0
n0
1
1
1
d
0
0
0
1
1
1
1
0
0
0
1
1
0
0
1
0
1
0
1
0
1
1
0
0
1
tot_ld
c
Add
tot_clr
tot_ld=1
tot_lt_s
d
Init
Wait
d=0
tot_clr=1
c *
tot_lt_s
c*tot_lt_s
Disp
d=1
Controller
Step 2C
Use controller design process
(Ch3) to complete the design
a
Digital Design 2e
Copyright 2010
Frank Vahid
19
clr I
ld reg
Q
A
B
add
S
A
B
cmp
lt eq gt
S = A+B
(unsigned)
A<B: lt=1
A=B: eq=1
A>B: gt=1
Digital Design 2e
Copyright 2010
Frank Vahid
I
shift<L/R>
Q
shiftL1: <<1
shiftL2: <<2
shiftR1: >>1
...
I1 I0
mux2x1
s0 Q
s0=0: Q=I0
s0=1: Q=I1
20
Preg = X + Y + Z
Preg = Preg + X
Preg
Preg
Preg
regQ
(a)
X
DP
DP
clr I
ld Preg
Q
P
Digital Design 2e
Copyright 2010
Frank Vahid
A B
add1
S
A
B
add2
S
0 clr I
1 ld Preg
Q
0 clr I
1 ld regQ
Q
A
B
add1
S
0
1
(d)
Y
A
B
add1
S
A
B
add2
S
DP
X+Y
0
1
(c)
A
B
add1
S
A
B
add2
S
X+Y+Z
(b)
k=0: Preg = Y + Z
k=1: Preg = X + Y
Preg
Preg=X+Y; regQ=Y+Z
clr I
ld Preg
Q
I1 I0
mux2x1
s0 Q
DP
0 clr I
1 ld Preg
Q
P
21
S'
S0
S1
L := '0'
Dreg := 0
Dctr := 0
S2
L := '1'
S3
S4
L := '0'
Dreg := Dctr/2
Dctr := Dctr+1 // calculate D
1
a
Dreg_clr
Dreg_ld
Dctr_clr
Dctr_ld
Datapath
16
A
B
Add1: add(16)
S
16
16
I
Shr1: shiftR1(16)
Q
16
I
clr
ld Dctr: reg(16)
clr
ld
I
Dreg: reg(16)
Q
16
D
Digital Design 2e
Copyright 2010
Frank Vahid
22
to laser
Controller
from sensor
Dreg_clr
Dreg_ld
Dctr_clr
Datapath
Dctr_ld
D
to display
16
300 MHz Clock
Digital Design 2e
Copyright 2010
Frank Vahid
23
DistanceMeasurer
Dreg_clr
Dreg_ld
S'
S0
S1
L := '0'
Dreg := 0
Dctr := 0
S2
Dctr_clr
Dctr_ld
S3
L := '1'
A
B
Add1: add(16)
S
16
16
I
clr
ld Dctr: reg(16)
S4
I
Shr1: shiftR1(16)
Q
16
clr
ld
I
Dreg: reg(16)
Q
16
L := '0'
Dreg := Dctr/2
Dctr := Dctr+1 // calculate D
Inputs: B, S
Controller
Datapath
16
S
a
S0
S1
L=0
Dreg_clr = 1
Dreg_ld = 0
Dctr_clr = 0
Dctr_ld = 0
(laser off)
(clear Dreg)
L=0
Dreg_clr = 0
Dreg_ld = 0
Dctr_clr = 1
Dctr_ld = 0
(clear count)
S2
S3
L=1
Dreg_clr = 0
Dreg_ld = 0
Dctr_clr = 0
Dctr_ld = 0
(laser on)
L=0
Dreg_clr = 0
Dreg_ld = 0
Dctr_clr = 0
Dctr_ld = 1
(laser off)
(count up)
S4
L=0
Dreg_clr = 0
Dreg_ld = 1
Dctr_clr = 0
Dctr_ld = 0
(load Dreg with Dctr/2)
(stop counting)
24
Inputs: B, S
S0
S1
L=0
Dreg_clr = 1
(laser off)
(clear Dreg)
Dctr_clr = 1
(clear count)
S2
S3
L=1
(laser on)
L=0
Dctr_ld = 1
(laser off)
(count up)
S4
Dreg_ld = 1
Dctr_ld = 0
(load Dreg with Dctr/2)
(stop counting)
5.4
S = A-B
(signed)
Digital Design 2e
Copyright 2010
Frank Vahid
A
B
mul
P
A
abs
Q
P = A*B
Q = |A|
(unsigned) (unsigned)
clr
inc upcnt
Q
W_d
W_a
clk^ and W_e=1:
W_e
RF[W_a]= W_d
RF R_e=1:
R_a
R_e
R_d = RF[R_a]
R_d
26
Digital Design 2e
Copyright 2010
Frank Vahid
27
(A[0] == 8)'
Init2 A[1] := 12
12
11
A[0] == 8
A_s
(a)
A_Wa0
A_Wa1
A_We
A_Ra0
A_Ra1
A_Re
Init1
Preg_clr = 1
A_s = 0
A_Wa1=0, A_Wa1=0
A_We = 1
Init2
A_eq_8
11
I1 I0
Amux
s0 Q
W_d
W_a
W_e
A
RF[4](11)
R_a
R_e
R_d
8
A
B
Acmp
lt eq gt
A_eq_8
(A_eq_8)'
Preg_clr
A_s = 1
A_Wa1=0, A_Wa0=1
A_We = 1
A_Ra1=0, A_Ra0=0
A_Re = 1
Preg_ld
DP
(b)
clr I
ld Preg
Q
11
Out1 Preg_ld = 1
Digital Design 2e
Copyright 2010
Frank Vahid
Controller
(c)
a
28
Differences
Frame 1
Frame 2
Frame 1
Frame 2
Digitized
Digitized
Digitized
Difference of
frame 1
frame 2
frame 1
2 from 1
1 Mbyte
1 Mbyte
1 Mbyte
0.01 Mbyte
(a)
(b )
Just send
difference
29
compare
Frame 1
Frame 2
30
A
RF[256](8)
B
RF[256](8)
S0
go
go
S1
sum := 0
i := 0
a
(i<256)
S2
i<256
sum:=sum+abs(A[i]-B[i])
S3
i := i + 1
S4
sadreg := sum
(b)
31
!go
go
S1
sum := 0
i := 0
!(i<256)
S2
i<256
sum:=sum+abs(A[i]-B[i])
S3
i := i + 1
S4
sadreg := sum
go
S0
go
(i<256) (i_lt_256)
S1
i_lt_256
go
sum=0 sum_clr=1
i=0 i_clr=1
A
cmp B
i_clr
sum_ld
i<256 i_lt_256
sum=sum+abs(A[i]-B[i])
S3
sum_ld=1; AB_rd=1
i=i+1 i_inc=1
sum_clr
sad_reg = sum
sadreg_ld=1
256
A_data B_data
8
a
S2
S4
lt
i_inc
Controller
Digital Design 2e
Copyright 2010
Frank Vahid
AB_addr
AB_rd
sum
32
abs
8
32 32
sadreg_ld
sadreg_clr
Datapath
sadreg
32
sad
32
(i<256)
S2
i<256
sum:=sum+abs(A[i]-B[i])
S3
i:=i+1
Digital Design 2e
Copyright 2010
Frank Vahid
33
R<100
A
R:=99
Q:=R
R:=R+1
Answers
Q is NOT 99 after state A
Q is 99 in state B, so final state is C
Storage update actions in state
occur simultaneously on next clock
edge
Thus, order actions are written is
irrelevant
A's actions same if:
Q:=R R:=99
R:=99 Q:=R
Digital Design 2e
Copyright 2010
Frank Vahid
(R<100)'
D
R<100
99
100
99
100
clk
C
a
or
34
R:=99
Q:=R
R:=R+1
Q:=R
B2
(R<100)'
R<100 (R<100)'
Digital Design 2e
Copyright 2010
Frank Vahid
clk
B2
99
?
100
99
100
100
99
99
35
BlinkLed
T_M
T_ld
T_en
load
enable
Outputs: L (bit)
32
T_Q'
M
32-bit
1-microsec
Q timer T
T_Q
L
Timer: T
T_Q'
T_Q
T_Q
Init
Off
On
L:='0'
T:=1000000
T_en:='0'
L:='0'
T_en:='1'
L:='1'
T_en:='1'
(a)
(b)
Pre-instantiated timer
Digital Design 2e
Copyright 2010
Frank Vahid
36
Button Debouncing
Press button
Ideally, output changes to 1
Actually, output bounces
button
B
Ideal: B
Actual: B
bounce
ButtonDebouncer
Bin'
T_Q'
Bin
Digital Design 2e
Copyright 2010
Frank Vahid
Bin
Bin'
T_Q
Init
WaitBin
Wait20
Bout :='0'
T:=20000
T_en:='0'
Bout:='0'
T_en:='0'
Bout:='1'
T_en:='1'
WhileBin
Bout:='1'
T_en:='0'
37
a
12
digital filter
12
clk
Digital Design 2e
Copyright 2010
Frank Vahid
38
X
12
12
clk
RTL design
Step 1: Create HLSM
Very simple states/transitions
FIR filter
Digital Design 2e
Copyright 2010
Frank Vahid
digital filter
Yreg := 0
xt0 := 0
xt1 := 0
xt2 := 0
c0 := 3
c1 := 2
c2 := 2
FC
Yreg :=
c0*xt0 +
c1*xt1 +
c2*xt2
xt0 := X
xt1 := xt0
xt2 := xt1
39
FIR
Filter
FIR filter
FC
Yreg := 0
xt0 := 0
xt1 := 0
xt2 := 0
c0 := 3
c1 := 2
c2 := 2
Yreg :=
c0*xt0 +
c1*xt1 +
c2*xt2
xt0 := X
xt1 := xt0
xt2 := xt1
3
xt0_clr
c0
xt0
c2_ld
c1
xt1
c2
...
c1_ld
...
xt0_ld
c0_ld
xt2
12
clk
x(t)
x(t-1)
x(t-2)
*
Yreg_clr
Yreg_ld
Y
Yreg
12
40
Circuit
Assume adder has 2 ns delay, multiplier has 20 ns delay
Longest path goes through one multiplier and two adders
20 + 2 + 2 = 24 ns delay
Digital Design 2e
Copyright 2010
Frank Vahid
41
5.5
clk
2 ns
delay
+
c
Digital Design 2e
Copyright 2010
Frank Vahid
42
Critical Path
Example shows four paths
Digital Design 2e
Copyright 2010
Frank Vahid
5 ns
delay
2 ns
1 / 7 ns = 142 MHz
Max
(2,7,7,5)
= 7 ns
7 ns
2 ns
delay
7 ns
a to c through +: 2 ns
a to d through + and *: 7 ns
b to d through + and *: 7 ns
b to d through *: 5 ns
2 ns
d
a
43
clk
0.5 ns
2 ns
a
0.5 ns
3 ns
0.5 ns
3 ns
Trend
44
Timing analysis
tools that evaluate
all possible paths
automatically very
helpful
Digital Design 2e
Copyright 2010
Frank Vahid
s
Combinational logic
tot_ld
ld
tot
t ot_clr
clr
(c )
tot_lt_s
n1
8-bit
<
n0
8-bit
adder
8
tot_lt_s
Datapath
s1
clk
s0
(b )
(a)
State register
45
!go
sum := 0
i := 0
(i<256)
S2
i<256
S3 sum:=sum+abs(A[i]-B[i])
i := i + 1
S4
sadreg := sum
5.6
C code
int SAD (byte A[256], byte B[256]) // not quite C syntax
{
uint sum; short uint I;
sum = 0;
i = 0;
while (i < 256) {
sum = sum + abs(A[i] B[i]);
i = i + 1;
}
return sum;
}
46
target :=
expression
target = expression;
If-then statement
Becomes state with condition
check, transitioning to then
statements if condition true,
otherwise to ending state
then statements would also
be converted to states
Digital Design 2e
Copyright 2010
Frank Vahid
cond
if (cond) {
// then stmts
}
cond
a
(then stmts)
(end)
47
cond
if (cond) {
// then stmts
}
else {
// else stmts
}
cond
(then stmts) (else stmts)
a
(end)
cond
while (cond) {
// while stmts
}
cond
(while stmts)
(end)
48
(X>Y)
(X>Y)
X>Y
X>Y
if (X > Y) {
Max = X;
(then stmts)
(else stmts)
Max:=X
Max:=Y
}
else {
Max = Y;
(end)
(end)
}
a
(a)
(b)
(c)
49
Example: SAD C
code to HLSM
Convert each construct
to states
Actually, subset of C
(not all C constructs
easily convertible)
Can use language
other than C
go'
go'
go'
go
sum:=0
i:=0
i=0
sum = 0;
i = 0;
go
sum:=0
while (!go);
(go')'
(c)
(b)
(d)
go
go'
go
(a)
sum:=0
i:=0
go'
sum:=0
i:=0
go
(i<256)'
sum:=0
i:=0
i<256
(i<256)'
sum:=sum
+ abs...
i := i + 1
i<256
while stmts
(i<256)'
i<256
sum:=sum
+ abs...
i := i + 1
sadreg :=
sum
(g)
Digital Design 2e
Copyright 2010
Frank Vahid
sadreg :=
sum
(e)
(f)
50
5.7
Memory Components
MxN memory
M words
N-bits
wide each
MN memory
Digital Design 2e
Copyright 2010
Frank Vahid
51
32
4
32
W_data
R_data
W_addr
R_addr
W_en
1632
register file
R_en
RAM vs. RF
RAM typically larger than about 512 or 1024 words
RAM typically stores bits using a bit storage
approach that is more efficient than a flip-flop
RAM typically implemented on a chip in a square
rather than rectangular shapekeeps longest
wires (hence delay) short
32
data
10
addr
rw
1024 32
RAM
en
52
Let A = log2M
data
addr
rw
1024x32
RAM
d0
en
a0
a1 AxM
d1
decoder
a(A-1)
addr0
addr1
addr(A-1)
clk
en
rw
w ord
data cell
word word
enable enable
rw data
d(M-1)
to all cells
wdata0
wdata
(N-1)
rdata
(N-1)
bit storage
block
(aka cell)
rdata0
Combining rd and wr
data lines
word
enable
data0
RAM cell
rw
data(N-1)
Digital Design 2e
Copyright 2010
Frank Vahid
SRAM cell
data
data
cell
data
addr
rw
1024x32
RAM
en
word
enable
SRAM cell
data
0
data
1
d
a
word
enable
Digital Design 2e
Copyright 2010
Frank Vahid
data
1
word
enable
data
cell
d
54
data
addr
rw
1024x32
RAM
en
SRAM cell
Somewhat trickier
When rw set to read, the RAM logic sets
both data and data to 1
The stored bit d will pull either the left line or
the right bit down slightly below 1
Sense amplifiers detect which side is
slightly pulled down
data
1
data
1
d
1
0
a
word
enable
<1
To sense amplifiers
55
data
addr
rw
1024x32
RAM
en
DRAM cell
data
cell
word
enable
capacitor
slowly
discharging
(a)
data
enable
d
Digital Design 2e
Copyright 2010
Frank Vahid
discharges
(b)
56
SRAM
Fast
More compact than register file
DRAM
MxN Memory
implemented as a:
register
file
SRAM
DRAM
Slowest
And refreshing takes time
57
1
addr
13
data
500
999
rw
3
9
Z
addr
500
1 means write
en
clk
data
rw
valid setup
time
valid
hold
time
setup
time
500
access
time
RAM[9]
RAM[13]
now equals 500 now equals 999
Writing
(b)
Put address on addr lines, data on data lines, set rw=1, en=1
Reading
Set addr and en lines, but put nothing (Z) on data lines, set rw=0
Data will appear on data lines
58
wire
microphone
en
rw
addr
data
4096x16
RAM
16
analog-todigital
conver ter
ad_buf
ad_ld
12
Ra RrwRen
processor
digital-toanalog
conver ter
wire
da_ld
Behavior
speaker
Record: Digitize sound, store as series of 4096 12-bit digital values in RAM
Well use a 4096x16 RAM (12-bit wide RAM not common)
59
16
analog-todigital
converter
ad_buf
ad_ld
12
digital-toanalog
converter
Ra Rw Ren
processor
da_ld
Record behavior
Local register: a, Rareg (12 bits)
a<4095
S
a:=0
T
ad_ld:=1
ad_buf:=1
Rareg:=a
Rrw:=1
Ren:=1
U
a:=a+1
(a<4095)
60
4096x16
RAM
data bus
16
analog-todigital
converter
ad_buf
ad_ld
12
digital-toanalog
converter
Ra Rw Ren
processor
da_ld
Play behavior
Local register: a,Rareg (12 bits)
a<4095
V
a:=0
W
ad_buf:=0
Rareg:=a
Rrw=0
Ren=1
X
da_ld:=1
a:=a+1
(a<4095)
61
32
data
10
addr
rw
1024 32
RAM
en
32
10
data
addr 1024x32
ROM
en
62
data
10
addr
1024x32
ROM
Let A = log2M
en
d0
addr0
addr1
addr(A-1)
addr
a0
a1 AxM
d1
decoder
a(A-1)
clk
word
enable
bit storage
block
(aka cell)
w ord
data
word word
enable enable
data
d(M-1)
en
rdata(N-1) rdata(N-2) rdata0
ROM cell
63
ROM Types
If a ROM can only be read, how
are the stored bits stored in the
first place?
Storing bits in a ROM known as
programming
Several methods
Mask-programmed ROM
Bits are hardwired as 0s or 1s
during chip manufacturing
2-bit word on right stores 10
word enable (from decoder) simply
passes the hardwired value
through transistor
data line
cell
data line
cell
word
enable
64
ROM Types
Fuse-Based Programmable
ROM
Each cell has a fuse
A special device, known as a
programmer, blows certain fuses
(using higher-than-normal voltage)
Those cells will be read as 0s
(involving some special electronics)
Cells with unblown fuses will be read
as 1s
2-bit word on right stores 10
Digital Design 2e
Copyright 2010
Frank Vahid
data line
cell
data line
cell
a
word
enable
fuse
blown fuse
65
ROM Types
Erasable Programmable ROM
(EPROM)
floating-gate
transistor
word
enable
data line
data line
cell
cell
a
1
0
1
e- e-
trapped electrons
66
ROM Types
Electronically-Erasable Programmable ROM
(EEPROM)
Similar to EPROM
Uses floating-gate transistor, electronic programming to
trap electrons in certain cells
Flash memory
Like EEPROM, but all words (or large blocks of
words) can be erased simultaneously
Became very common starting in late 1990s
32
data
10
addr
en
1024x32
EEPROM
write
busy
67
4096x16 ROM
16
speaker
Hello there!
a
digital-toanalog
Ra Ren
processor
converter
vibration
sensor
da_ld
v
Processor should wait for vibration (v=1), then read words 0 to 4095 from
the ROM, writing each to the d-to-a
Digital Design 2e
Copyright 2010
Frank Vahid
68
v
a:=0
16
digital-toanalog
converter
Ra Ren
processor
a<4095
T
Rareg:=a
Ren:=1
U
v
(a<4095)
da_ld
da_ld:=1
a:=a+1
HLSM
Create state machine that waits for v=1, and then counts from 0 to
4095 using a local storage a
For each a, read ROM, write to digital-to-analog converter
Digital Design 2e
Copyright 2010
Frank Vahid
69
analog-todigital
converter
busy
erase
en
rw
4096x16 Flash
data
16
ad_buf
ad_ld
12
Ra Rrw Ren er
processor
record
microphone
bu
digital-toanalog
converter
da_ld
rec
play
speaker
70
4096x16 Flash
analog-todigital
converter
ad_buf
12
ad_ld
Ra Rrw Ren er
processor
bu
digital-toanalog
converter
da_ld
rec
record
microphone
S
a:=0
er:=1
rec
Digital Design 2e
Copyright 2010
Frank Vahid
16
play
speaker
ad_ld:=1
ad_buf:=1
Rareg:=a
Rrw:=1
Ren:=1
a:=a+1
V
(a<4096)
71
ROM
Flash
EEPROM
RAM
a
NVRAM
New memory technologies evolving that merge RAM and ROM benefits
e.g., MRAM
Bottom line
Lot of choices available to designer, must find best fit with design goals
Digital Design 2e
Copyright 2010
Frank Vahid
72
5.8
Queues (FIFOs)
A queue is another component
sometimes used during RTL
design
Queue: A list written to at the
back, from read from the front
Like a list of waiting restaurant
customers
back
front
write items
read (and
to the back
of the queue
remove) items
from front of
the queue
73
Queues
7
rf
0
Push (write)
Item written to address pointed to
by rear
rear incremented
Pop (read)
Item read from address pointed
to by front
front incremented
r
2
r
1
f
0
f
0
B
r
f
74
Queues
Treat memory as a circle
5
4
75
Queue Implementation
16
wdata
wdata
rdata
waddr
raddr
wr
reset
inc
3-bit
up counter
rear
eq
rdata
clr
inc
rd
16
rd
clr
wr
Controller
3-bit
up counter
front
=
full
empty
8-word 16-bit queue
76
Digital Design 2e
Copyright 2010
Frank Vahid
77
Initially empt y
queue
6
rf
0
f
0
r
7
f
1
9
r
0
3
7
1. Aft er pushing
9, 5, 8, 5, 7, 2, 3
r
7
2. Aft er popping
3. Aft er pushing 6
4. Aft er pushing 3
f
1
data:
9
full
rf
Digital Design 2e
Copyright 2010
Frank Vahid
5. Aft er pushing 4
78
5.9
Multiple Processors
Using multiple processors
can ease design
Keeps distinct behaviors
separate
Ex: Laser-based distance
measurer with button
debounce
from ButtonDebouncer
button
Bin
Bout
16
Laser-based
distance
measurer
to display
L
to laser
S
from sensor
Star t
Red
Green
Blue
si
BPS
s
u
ri
gi
BPS
bi
ai
BPS
BPS
r
g
Code
detector
Door
lock
b
a
BPS
Digital Design 2e
Copyright 2010
Frank Vahid
79
Digital Design 2e
Copyright 2010
Frank Vahid
80
Keeping the
sampling and
averaging
behaviors
separate leads to
simple design
Digital Design 2e
Copyright 2010
Frank Vahid
TempStats
W_d
W_a
W_e
Tsample
W_d
W_a
R_a
W_e
R_e
TRF
RF[64](16)
R_d
R_a
R_e
Avg
R_d
81
Image sensor
8
Read
circuit
wdata
rdata
wr
rd
full Queue empty
[8](8)
8
Compress
circuit
Queue
[8](8)
Store
circuit
Memory
a
Digital Design 2e
Copyright 2010
Frank Vahid
82
5.10
CityG
Country A
Province 3
Digital Design 2e
Copyright 2010
Frank Vahid
CityF
Province 3
CityE
Province 2
CityC
Province 1
CityB
Province 2
Province 1
Hierarchy
CityD
CityA
Country A
Digital Design 2e
Copyright 2010
Frank Vahid
a7.. a0
b7.. b0
8-bit adder
co
ci
s7.. s0
84
i0
4x1
i0
i1
i1
i2
i2
i3
i3
P
ro
vin
c
e1
d
2x1
s1
s0
i0
d
i4
4x1
i0
i5
i1
i6
i2
i1
s0
d
i3
s1
s0
0
s1
Digital Design 2e
Copyright 2010
Frank Vahid
s0
s2
85
en
addr
addr
1024x8
ROM
en
data
addr
1024x8
ROM
en
data
addr
1024x8
ROM
en
data
addr
1024x8
ROM
en
data
data(31..0)
10
1024x32
ROM
data
Digital Design 2e
Copyright 2010
Frank Vahid
32
86
Digital Design 2e
Copyright 2010
Frank Vahid
0 1
0 1
P
1 1 1
ro
vin
1 1 1
1
1
P
r1 1
1o
vin
1 c1 1
1 0
1 1
1 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1 0
1 1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1
a9..a0
a10
addr
1x2 d0
dcd
i0
e d1
1024x8
ROM
en
data
8
addr
11
en
11
addr
en
addr
1024x8
ROM
2048x8
ROM
en
data
8
data
addr
1024x8
ROM
en data
addr
1024x8
ROM
en data
Chapter Summary
Modern digital design involves creating processor-level components
High-level state machines
RTL design process
1. Capture behavior: Use HLSM
2. Convert to circuit
A. Create datapath B. Connect DP to controller C. Derive controller FSM
Digital Design 2e
Copyright 2010
Frank Vahid
88