Algorithmic State Machines in Computer-Aided Logic Design - Prof. Susan Lysecky, Study notes of Electrical and Electronics Engineering

The concept of algorithmic state machines (asms) in the context of computer-aided logic design. It explains how asms are used to represent the sequential behavior of digital systems, and how they differ from conventional flowcharts. The document also covers the three basic elements of asm charts: state boxes, decision boxes, and conditional boxes. Examples of asm charts for a 4x1 mux and a 1-bit full adder are provided.

Typology: Study notes

Pre 2010

Uploaded on 08/31/2009

koofers-user-7fn
koofers-user-7fn 🇺🇸

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
ECE 474a/575a
Susan Lysecky
1of 21
ECE 474A/57A
Computer-Aided Logic Design
Lecture 6
Algorithmic State Machines (ASMs)
ECE 474a/575a
Susan Lysecky
2of 21
Control and Datapath Interaction
Binary information in digital system
can be classified into two categories
Data
Discrete elements of information
manipulated by arithmetic, logic,
shift, and other data processing
Operations implemented via digital
components such as adders,
decoders, muxes, etc.
Control
Provides command signals that
coordinate the execution of various
operations in data section to
accomplish desired task
Controller
(FSM)
Datapath
Input signal
(external)
Input data
Control
Signals
Status
Signals
Output
data
ECE 474a/575a
Susan Lysecky
3of 21
What Control Path Implements?
Sequencing of control signals to execute algorithm implemented by circuit
Algorithm
Finite set of instructions/steps to solve a pro blem
Terminates in finite time at a known end state
Many representations
Recipe Flowchart Computer Program
Ingredients
1/3 cup unsweetened cocoa
1/4 cup cornstarch
2 tablespoons butter
2 2/3 cups skim milk
Steps
1. Combine all ingredients in a small saucepan.
2. Heat over low heat, stirring cons tantly, until
mixture boils. Boil gently, stirring con stantly,
for one minute.
3. Pour into serving dishes and chill until
thickened.
intfib(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
pf3
pf4
pf5

Partial preview of the text

Download Algorithmic State Machines in Computer-Aided Logic Design - Prof. Susan Lysecky and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 474a/575a Susan Lysecky

1 of 21

ECE 474A/57A

Computer-Aided Logic Design

Lecture 6

Algorithmic State Machines (ASMs)

ECE 474a/575a Susan Lysecky

2 of 21

Control and Datapath Interaction

ƒ Binary information in digital system

can be classified into two categories

ƒ Data

ƒ Discrete elements of information

manipulated by arithmetic, logic,

shift, and other data processing

ƒ Operations implemented via digital

components such as adders,

decoders, muxes, etc.

ƒ Control

ƒ Provides command signals that

coordinate the execution of various

operations in data section to

accomplish desired task

Controller
(FSM)
Input signal Datapath

(external)

Input data

Control Signals

Status Signals

Output data

ECE 474a/575a Susan Lysecky

3 of 21

What Control Path Implements?

ƒ Sequencing of control signals to execute algorithm implemented by circuit

ƒ Algorithm

ƒ Finite set of instructions/steps to solve a problem

ƒ Terminates in finite time at a known end state

ƒ Many representations

Recipe Flowchart Computer Program

Ingredients

ƒ 1/3 cup unsweetened cocoa
ƒ 1/4 cup cornstarch
ƒ 2 tablespoons butter
ƒ 2 2/3 cups skim milk

Steps

  1. Combine all ingredients in a small saucepan.
  2. Heat over low heat, stirring constantly, until mixture boils. Boil gently, stirring constantly, for one minute.
  3. Pour into serving dishes and chill until thickened.

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)

ƒ Flowchart

ƒ Convenient way to graphically specify sequence of procedural steps and decision

paths for algorithm

ƒ Enumerates sequence of operations and conditions necessary for execution

ƒ Algorithmic State Machine (ASM)

ƒ Flowchart defined specifically for digital hardware algorithms

ƒ Flowchart vs. ASM

ƒ Conventional flowchart

ƒ Sequential way of representing procedural steps and decision paths for algorithm
ƒ No time relations incorporated

ƒ ASM chart

ƒ Representation of sequence of events together with timing relations between states of
sequential controller and events occurring while moving between steps

ECE 474a/575a Susan Lysecky

5 of 21

ASM Chart

ƒ Three basic elements

ƒ State box

ƒ Decision box

ƒ Conditional box

ƒ State and decision boxes used in conventional flowcharts

ƒ Conditional box characteristic to ASM

State name Binary code

Register operations Moore-type output signals

State Box

Exit path

Condition

Exit path

Exit path

Decision Box Conditional Box

From exit path of decision box

Register operations Mealy-type output signals

ECE 474a/575a Susan Lysecky

6 of 21

State box

ƒ Used to indicate states in control sequence

ƒ State name and binary code placed on top

of box

ƒ Register operations and names of output

signals generated in state placed inside box

ƒ Example

ƒ State name: S_pause

ƒ Binary encoding: 0101

ƒ Register operation: R ← 0

ƒ Register R is to be cleared to 0

ƒ Output signal asserted: Start_OP = 1

ƒ Launches some operation in datapath

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

ƒ Conventional flowchart, evaluation of

each follows one another

ƒ Reg A incremented

ƒ Condition E evaluated

ƒ If E= 1

ƒ clear B

ƒ Go to state S_

ƒ In ASM the entire block considered as

one unit

ƒ All operations within block occurring

during single edge transition

ƒ The next state evaluated during the

same clock

ƒ System enters next state S_1, S_2, or

S_3 during transition of next clock

S_0 001
A ← A + 1

Reset_b

Clear_B

E
F
S_1 010 S_2 011 S_3 100

ECE 474a/575a Susan Lysecky

11 of 21

ASM Example

ƒ Convert pseudo code to ASM chart

ƒ Example

ƒ Want to detect the number of 1’s in a 2-

bit register calledInput

ƒ start input indicates when to begin

comparison

ƒ busy output indicates when comparison in

progress

ƒ ones hold count value

ƒ F outputs result

S0:
busy = 0;
ones = 0;
if(start == 1)
goto S
else
goto S
S1:
busy = 1;
if(Input[1] == 1)
ones ++;
goto S
S2:
busy = 1;
if(Input[0] == 1)
ones ++;
goto S
S3:
busy = 0;
F = ones;
goto S

ECE 474a/575a Susan Lysecky

12 of 21

ASM Example Continued

S0:
busy = 0;
ones = 0;
if(start == 1)
goto S
else
goto S
S1:
busy = 1;
if(Input[1] == 1)
ones ++;
goto S
S2:
busy = 1;
if(Input[0] == 1)
ones ++;
goto S
S3:
busy = 0;
F = ones;
goto S
S_0 001

busy = 0 ones = 0

Reset_b

start == 1 1

S_1 010 busy = 1

ones++

Input[1] == 1

ones++

Input[0] == 1

S_2 011

busy = 1 S_3 111 busy = 0 F = ones

ECE 474a/575a Susan Lysecky

13 of 21

ASM – Mux

ƒ Describe a 4x1 MUX using a ASM

s1 s0 f
x
x
x
x
4x1 mux
f
x1 x
x3 x
s
s
S_0 001

s

s

s

F = x4 F = x3 F = x2 F = x

ECE 474a/575a Susan Lysecky

14 of 21

ASM – Full Adder

ƒ Describe a 1-bit full adder using

an ASM chart

cin

A B

cout FA

F

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

S_0 001

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

pp

pp

pp

pp

ƒ Multiplier in array style

ƒ Fast, reasonable size for 4-bit: 4*4 = 16 partial product AND terms, 3 adders

ƒ Rather big for 32-bit: 32*32 = 1024 AND terms, and 31 adders

a

a

32-bit adder would have 1024 gates here
... and 31 adders here (big adders)

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

S_

Reset_b

start 1 S_ mdld = 1 mrld = 1 rsclear = 1

S_

rsload = 1

mr

S_

rsshr = 1

rsload = 1

mr

S_

rsshr = 1

rsload = 1

mr2^1

S_

rsshr = 1

rsload = 1

mr3^1

S_

rsshr = 1

ECE 474a/575a Susan Lysecky

20 of 21

ASMs to FSMDs

ƒ Able to convert between formats

ƒ Once we have a FSMD, we’ve already seen how to implement in hardware

S_pause 0101 R ← 0 Start_OP

S_pause R = 0 Start_OP = 1

S_0 001
A ← A + 1

Reset_b

Clear_B

0 E^ 1
F
S_1 010 S_2 011 S_3 100
S_
S_1 S_2 S_
A = A + 1
E’F’
E’F

E / Clear_B = 1

Incr_Reg

1 B^ 0
A1 0101
A

B B’ / Incr_Reg = 1

ECE 474a/575a Susan Lysecky

21 of 21

Not Used Much, But …

ƒ There are commerical ASM Editors

ƒ Mentor Graphics

ƒ Summit Design, Inc.

ƒ Others…