Algorithmic State Machines (Asms) : Control and Datapath Interaction
Algorithmic State Machines (Asms) : Control and Datapath Interaction
Control
Provides command signals that
coordinate the execution of various
operations in data section to
accomplish desired task
What Control Path Implements? Flowcharts and Algorithmic State Machines (ASM)
Many representations
Algorithmic State Machine (ASM)
Lamp doesn’t Flowchart defined specifically for digital hardware algorithms
Ingredients work int fib(int n)
1/3 cup unsweetened cocoa {
1/4 cup cornstarch if (n < 2)
2 tablespoons butter
return n; Flowchart vs. ASM
2 2/3 cups skim milk
Lamp plugged
No Plug in lamp
in?
else Conventional flowchart
Steps return fib(n-1) + fib(n-2);
Yes } Sequential way of representing procedural steps and decision paths for algorithm
1. Combine all ingredients in a small saucepan.
2. Heat over low heat, stirring constantly, until Yes No time relations incorporated
mixture boils. Boil gently, stirring constantly, Bulb burned Replace bulb
for one minute. out? ASM chart
3. Pour into serving dishes and chill until No Representation of sequence of events together with timing relations between states of
thickened.
sequential controller and events occurring while moving between steps
Buy new lamp
1
ASM Chart State box
Condition to be tested inside Exit path box generated during given state
Two or more outputs represent exit paths Generated as Mealy-type signals
dependant on value tested Associated with the state transition
In binary case one path represents true the
other false, represented by 1 and 0 Example
respectively
B
Status of input B checked B
1 0 1 0
Conditional operation executed depending
Example on result coming from decision box
Check B If B = 1, assert Incr_Reg signal Incr_Reg
2
ASM Block Interpretation of Timing Operations
Reset_b Reset_b
Structure consisting of Conventional flowchart, evaluation of
One state box S_0 001 each follows one another S_0 001
3
ASM – Mux ASM – Full Adder
Describe a 4x1 MUX using a ASM Describe a 1-bit full adder using
S_0 001
an ASM chart
x1 x2 x3 x4 s1 s0 f
A B S_0 001
0 0 x1
1
s0 0 1 2 3 0 1 x2 s1
cout FA cin
s1
1 0 x3 1
a
1 1 x4 1 1
F
s0 s0
f 1 1
b b
4x1 mux a b cin f cout
F = x4 F = x3 F = x2 F = x1
0 0 0 0 0 1 1 1 1
cin cin cin cin
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
f=1 f=0 f=0 f=1 f=0 f=1 f=1 f=0
1 0 0 1 0
cout = 1 cout = 1 cout = 1 cout = 0 cout = 1 cout = 0 cout = 0 cout = 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
b2
+ (5-bit)
00 a
b3
+ (6-bit)
0 00
p7..p0
ECE 474a/575a 15 of 21 ECE 474a/575a 16 of 21
4
Smaller Multiplier -- Sequential (Add-and-Shift) Style Smaller Multiplier -- Sequential (Add-and-Shift) Style
multiplier multiplicand
multiplier multiplicand Step 0
Design circuit that computes one • Set running sum to 0 start
start
partial product at a time, adds to multiplicand • Load values
multiplicand
mdld register (4)
running sum mdld
load
register (4) load 0110
Note that shifting running sum
right (relative to partial product) Step 1
after each step ensures partial • Check multiplier bit 0 (mr0)
• mr0=1, add multiplicand to running sum
product added to correct running • Shift running sum right 1 position
sum bits multiplier
controller
multiplier
controller
mrld register (4) mrld
load 0011
register (4)
load Step 2
mr3 4-bit adder
mr3 4-bit adder • Check multiplier bit 1 (mr1)
• mr0=1, add multiplicand to running sum mr2
mr2
mr1
mr1 • Shift running sum right 1 position
mr0
mr0
rsload
rsload Step 3 load
load rsclear running sum
rsclear running sum • Check multiplier bit 2 (mr2) clear
clear rsshr
rsshr shr register (8) • Shift running sum right 1 position
shr 00000000
00010010
00100100
01001000
10010000
00110000
01100000
register (8)
1 R←0
mr1 mrld register (4) A←A+1
1 load Start_OP
rsload = 1 mr3 4-bit adder
S_1 mr2 1 B 0
S_4 mr1 0 E 1
mdld = 1 mr0
rsshr = 1 F
mrld = 1 Incr_Reg 0 1 Clear_B
rsclear = 1 rsload load
1 rsclear clear running sum S_1 010 S_2 011 S_3 100
mr2 rsshr shr register (8)
S_2
rsload = 1
S_5
1 rsshr = 1
mr0
rsload = 1 product
1
mr3 S_0 A=A+1
S_3
rsload = 1 S_pause A1 E’F’
rsshr = 1 E / Clear_B = 1
R=0 E’F
S_6 B B’ / Incr_Reg = 1
Start_OP = 1
rsshr = 1
S_1 S_2 S_3
5
Not Used Much, But …
ECE 474a/575a 21 of 21