



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ECE 474a/575a Susan Lysecky
1 of 21
Lecture 6
Algorithmic State Machines (ASMs)
ECE 474a/575a Susan Lysecky
2 of 21
Control and Datapath Interaction
(external)
Input data
Control Signals
Status Signals
Output data
ECE 474a/575a Susan Lysecky
3 of 21
What Control Path Implements?
Ingredients
Steps
int fib(int n) { if (n < 2) return n; else return fib(n-1) + fib(n-2); }
Lamp doesn’t work
Buy new lamp
Lamp plugged in?
Bulb burned out?
Plug in lamp
Replace bulb
Yes Yes
No
No
ECE 474a/575a Susan Lysecky
4 of 21
Flowcharts and Algorithmic State Machines (ASM)
ECE 474a/575a Susan Lysecky
5 of 21
ASM Chart
State name Binary code
Register operations Moore-type output signals
Exit path
Condition
Exit path
Exit path
From exit path of decision box
Register operations Mealy-type output signals
ECE 474a/575a Susan Lysecky
6 of 21
State box
State name Binary code
Register operations Moore-type output signals
S_pause 0101
R ← 0 Start_OP
ECE 474a/575a Susan Lysecky
10 of 21
Interpretation of Timing Operations
Reset_b
Clear_B
ECE 474a/575a Susan Lysecky
11 of 21
ASM Example
ECE 474a/575a Susan Lysecky
12 of 21
ASM Example Continued
busy = 0 ones = 0
Reset_b
start == 1 1
S_1 010 busy = 1
ones++
Input[1] == 1
ones++
Input[0] == 1
busy = 1 S_3 111 busy = 0 F = ones
ECE 474a/575a Susan Lysecky
13 of 21
ASM – Mux
s
s
s
F = x4 F = x3 F = x2 F = x
ECE 474a/575a Susan Lysecky
14 of 21
ASM – Full Adder
cin
cout FA
a bcinf cout 0 000 0 0 011 0 0 101 0 0 110 1 1 001 0 1 010 1 1 100 1 1 111 1
a
(^1) b (^1) b
cin
f = 0 cout = 1
f = 1 cout = 0
cin
f = 0 cout = 1
f = 1 cout = 0
cin
f = 1 cout = 1
f = 0 cout = 1
cin
f = 1 cout = 0
f = 0 cout = 0
ECE 474a/575a Susan Lysecky
15 of 21
Smaller Multiplier
(5-bit)
(6-bit)
(7-bit)
a3 a2 a1 a
b
b
b
b
p7..p
a
a
ECE 474a/575a Susan Lysecky
19 of 21
ASM – Sequential Multiplier
mr
mrld
mdld
mr mr mr rsload rsclear rsshr
start
load
load clear shr
product
running sum register (8)
multiplier register (4)
multiplier
multiplicand register (4)
multiplicand
load
controller 4-bit adder
Reset_b
start 1 S_ mdld = 1 mrld = 1 rsclear = 1
S_
rsload = 1
mr
rsshr = 1
rsload = 1
mr
rsshr = 1
rsload = 1
mr2^1
rsshr = 1
rsload = 1
mr3^1
rsshr = 1
ECE 474a/575a Susan Lysecky
20 of 21
ASMs to FSMDs
S_pause 0101 R ← 0 Start_OP
S_pause R = 0 Start_OP = 1
Reset_b
Clear_B
E / Clear_B = 1
Incr_Reg
B B’ / Incr_Reg = 1
ECE 474a/575a Susan Lysecky
21 of 21
Not Used Much, But …