Title: Design a state machine to display a character of string HELLO using a seven segment display
1Another Example
- Design a state machine to display a character of
string HELLO using a seven segment display - How many state we need?
- Five, one for each character
- In state S0 (000) we display H
- In state S1 (001) we display E
- In state S2 (010) we display L
- In state S3 (011) we display L
- In state S4 (100) we display O
- State transitions are
- S0 -gt S1
- S1 -gt S2
- S2 -gt S3
- S3 -gt S4
- S4 -gt S5
2Example (contd.)
- Next State and Output logic tables are
- Cur Next State Output
- 0 0 0 0 0 1 0 0 0 0 1 1 0 1 1 1
- 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1
- 0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 0
- 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0
- 1 0 0 0 0 0 1 0 0 1 1 1 1 1 1 0
3Moore State Machine Diagram
4Moore machine in AHDL
- SUBDESIGN moore1 (
- clk, reset, y INPUT
- z OUTPUT
- )
- VARIABLE current current
- state output
- ss MACHINE OF BITS (z)
- WITH STATES ( s0 0,
- s1 1,
- s2 1,
- s3 0)
- BEGIN
- ss.clk clk
- ss.reset reset
- TABLE
- current current next
- state input state
- ss, y gt ss
5Mealy State Machine Diagram
0/0
6Mealy Machine in AHDL
SUBDESIGN mealy ( clk, reset, y INPUT z
OUTPUT ) VARIABLE ss MACHINE WITH STATES (s0,
s1, s2, s3) zd NODE BEGIN ss.clk
clk ss.reset reset TABLE current current
current next state input output state
ss, y gt z, ss s0, 0 gt 0, s0 s0, 1 gt 1, s
1 s1, 0 gt 1, s1 s1, 1 gt 0, s2 s2, 0 gt
0, s2 s2, 1 gt 1, s3 s3, 0 gt 0, s3 s3, 1
gt 1, s0 END TABLE END