Asm and Asmd
Asm and Asmd
2
Datapath (Execution Unit)
• Manipulates and processes data
• Performs arithmetic and logic operations,
shifting, and other data-processing tasks
• Is composed of registers, gates, multiplexers,
decoders, adders, comparators, ALUs, etc.
• Provides all necessary resources and
interconnects among them to perform specified
task
• Interprets control signals from the Controller
and generates status signals for the Controller
3
Controller (Control Unit)
4
Controller
• Controller can be programmable or non-programmable
• Programmable
• Has a program counter which points to next instruction
• Instructions are held in a RAM or ROM externally
• Microprocessor is an example of programmable
controller
• Non-Programmable
• Once designed, implements the same functionality
• Another term is a “hardwired state machine” or
“hardwired instructions”
• In the following several lectures we will be
focusing on non-programmable controllers.
5
Finite State Machines
• Digital Systems and especially their Controllers
can be described as Finite State Machines
(FSMs)
• Finite State Machines can be represented using
• State Diagrams and State Tables - suitable
for simple digital systems with a relatively few
inputs and outputs
• Algorithmic State Machine (ASM) Charts -
suitable for complex digital systems with a
large number of inputs and outputs
• All these descriptions can be easily translated to
the corresponding synthesizable VHDL code
6
State Diagrams
7
Moore Machine
transition
condition 1
state 1 / state 2 /
output 1 output 2
transition
condition 2
8
Mealy Machine
transition condition 1 /
output 1
state 1 state 2
transition condition 2 /
output 2
9
Moore vs. Mealy FSM (1)
10
Moore vs. Mealy FSM (2)
11
Algorithmic State Machine (ASM)
Charts
12
Algorithmic State Machine
13
Elements used in ASM charts (1)
State name
Conditional outputs
or actions (Mealy type)
14
State Box
• State box – represents a state. State name
• Equivalent to a node in a state diagram or
a row in a state table. Output signals
or actions
• Contains register transfer actions or (Moore type)
output signals
• Moore-type outputs are listed inside of
the box.
• It is customary to write only the name of
the signal that has to be asserted in the
given state, e.g., z instead of z<=1.
• Also, it might be useful to write an action
to be taken, e.g., count <= count + 1, and
only later translate it to asserting a control
signal that causes a given action to take
place (e.g., enable signal of a counter).
15
Decision Box
• Decision box –
indicates that a 0 (False) 1 (True)
Condition
given condition is to expression
16
Conditional Output Box
• Conditional
output box
Conditional outputs
• Denotes output or actions (Mealy type)
signals that are of
the Mealy type.
• The condition that
determines
whether such
outputs are
generated is
specified in the
decision box.
17
ASMs representing simple FSMs
18
Moore FSM – Example 2: State diagram
Reset
w = 1
w = 0 A z = 0 B z = 0
w = 0
w = 0 w = 1
C z = 1
w = 1
19
Moore FSM – Example 2: State table
A A B 0
B A C 0
C A C 1
20
ASM Chart for Moore FSM – Example 2
Reset
0
w
1
0
w
1
0 1
w
21
• ASM (algorithmic state machine) chart
– Flowchart-like diagram
– Provide the same info as an FSM
– More descriptive, better for complex
description
– ASM block
• One state box
• One ore more optional decision boxes: with T or F
exit path
• One or more conditional output boxes: for Mealy
output
4/22/2015 22
4/22/2015 23
• E.g. 1.
4/22/2015 24
• E.g. 2.
4/22/2015 25
• E.g. 3.
4/22/2015 26
• E.g. 4.
4/22/2015 27
• Difference between a regular flowchart
and ASM chart:
– Transition governed by clock
– Transition done between ASM blocks
• Basic rules:
– For a given input combination, there is one
unique exit path from the current ASM block
– The exit path of an ASM block must always
lead to a state box. The state box can be the
state box of the current ASM block or a state
box of another ASM block.
4/22/2015 28
• Incorrect ASM charts:
4/22/2015 29
Some More
Examples from your Course Book
4/22/2015 31
4/22/2015 32
4/22/2015 33
4/22/2015 34
4/22/2015 35
4/22/2015 36
4/22/2015 37
4/22/2015 38
Verilog Code of all the above
examples is given in your Book.
Read 5.14,5.15 and 5.16.
4/22/2015 39