Ders 5
Ders 5
EHB326E
Lectures
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 1 / 23
Describing the desired behaviour :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 in corporated
ASM chart
Representation of sequence of events together with timing relations
between states of sequential controller and events occurring while
moving between steps
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 2 / 23
Algorithmic State Machines (ASM)
State box Decision box Conditional box
The chart must define a unique next state for each state and set of
condition.
Every path defined by the network of conditions boxes must lead to
another state.
- Block has one entrance and any number of exits paths
- Each block in ASM dedicated to state of system during one clock cycle
- Can label just the “1” and omit the “0”
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 3 / 23
One’s counter: State and Input-based charts
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 5 / 23
Timing
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 6 / 23
FSM to ASM
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 7 / 23
FSM & ASM
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 8 / 23
FSM & ASM
ASM Representation of a Moore Machine (State-based):
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 9 / 23
ASMs to FSMDs
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 10 / 23
ASMs to FSMDs
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 11 / 23
Example : ASM to Application-specific processor
Designers must spend much time and effort simply understanding and
describing the desired behaviour of a system, and some studies have found
that most system bugs come from mistakes made describing the desired
behaviour rather than from mistakes in implementing that behaviour.
D. Gajski, F. Vahid, S. Narayan and J. Gong, ”Specification an Design of embedded systems,” page 10 - 13.
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 13 / 23
Program to FSMD
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 14 / 23
Templates for Program statement to FSMD
Assignment statement Loop statement Branch statement
a = b while (cond) { if (c1)
next statement loop-body- c1 stmts
statements else if c2
} c2 stmts
next statement else
other stmts
next statement
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 15 / 23
Algorithm→ Templates → FSMD
0: int x, y;
1: while (1) {
2: while (!go i);
3: x = x i;
4: y = y i;
5: while (x !=
y) {
6: if (x < y)
7: y = y - x;
else
8: x = x - y;
}
9: d o = x;
}
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 16 / 23
Register Transfer Level (RTL) specification (Step2 )
Define I/O and Create a register for any declared variable
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 17 / 23
Register Transfer Level (RTL) specification (Step2 )
Create a functional unit for each arithmetic operation
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 18 / 23
Register Transfer Level (RTL) specification (Step2 )
Connect the ports, registers and functional units
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 19 / 23
Step3
Create unique identifier
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 20 / 23
Step4
Creating the controller’s FSM: Replace complex actions/conditions with
datapath configurations
Prof. Dr. Müştak E. Yalçın (İTÜ) EHB326E (V: 0.1) September, 2018 21 / 23
Creating the controller’s FSM:
Github:uart tx.v