Title: FSM Structures
1FSM Structures
- Mealy, Moore and Combined Mealy/Moore outputs
- Figure 8.3
2(No Transcript)
3Bad FSM Model
4VHDL Code
5Contd
6Problems of FSM1 BAD
- no reset, no next state value defined for the
unused state. - 2bits FFs 3 states used, one unused state.
- Read and Write output assignment infer extra two
FFs. - To avoid extra FFs, use separate combinational
process. - variable initialization
- Ignored by the synthesis tools.
7FSM1_GOOD
8(No Transcript)
9Synthesized Circuit
10FSM 2
11VHDL Code (Bad)
12Contd
- Output Y
- Assigned under clockevent statement.
- Extra FFs are inferred.
13Good Model 1 (1 sequential process, 1 combination
process, selected signal assignment for Y)
14Contd
15Sequential process Combinational process
- Sequential process
- Description with respect to the edge point
- Input sampled just before the edge
- Output
- Combinational process
input
output
input
output
16FSM 2_GOOD2
- Combined current state and next state logic
- Separate output logic
17Separate output logic
18Contd
19Synthesized Circuit
20FSM 2_GOOD3
- Combined next state and output logic
- Separate current state logic
21VHDL Code
22(No Transcript)
23FSM 2_GOOD4
- Combined current state, next state and output
logic
24VHDL Code
25(No Transcript)
26Car Speed Controller FSM
27Input primary branch directives
28(No Transcript)
29State value primary branch directives
30(No Transcript)
31Contd
32Angular Position FSM using Gray and Johnson state
encoding
33Contd
- Input
- Physical Position asynchronous input(loaded when
reset 1) - MOVE CW 45 clock wise move
- MOVE CCW 45 counter clock wise move
- Two ways of representing state encoding
- Use a signal of an enumerated type for which a
single synthesis specific attribute is applied.
Attribute name is specific to the synthesis tool,
not portable, needs to be changed.
34VHDL Code
35Contd
- 2. Use constants to represent the individual
state values. It is directly portable to other
synthesis tools.
36(No Transcript)
37Angular position FSM
38 Contd
39Contd
40Contd
41Contd
42Black Jack Game Machine
- Blackjack Game
- Blackjack is the most popular of the card games
played at the tables in casinos. It is played
with a standard deck of 52 cards. The four suits
spades, hearts, diamonds and clubs have no
significance and are ignored. The Jack, Queen and
King all have a value of 10. The ace is the most
powerful card having a value of 1 or 11 depending
upon what the player chooses. - Blackjack is also known as pontoon or 21
because 21 is the highest rated total card value
a player can hold. Blackjack is the name given to
the strongest hand consisting of an ace and a 10
valued card. - The object of the game is to beat the dealer. The
dealer has no object other than to follow the
rules of the casino, which is to stand(hold) on
hands of 17 or more, and to draw another card on
hands of 16 or less. - A player looses if his or her total card value is
less than the dealers total, or, he or she has
over 21 and so has bust. If a player wants to
improve his hand he can ask the dealer for
another card. This is called drawing or hitting.
If satisfied with the total card value he can
stand(hold).
43(No Transcript)
44(No Transcript)
45(No Transcript)
46VHDL package defining four enumerated state
encoding data types
47(No Transcript)
48FSM with selectable state encoding Blackjack
game machine
49Contd
50Contd
51Contd
52Contd
53Contd
54Contd
55Contd
56Contd
57Contd
58Contd
59Contd
60Contd
61FSMs with a Mealy or Moore output
- State Diagram for FSMs with a Mealy and Moore
output
62(No Transcript)
63FSM modeled with NewColor as a Mealy type output
64Contd
65Contd
66Contd
67FSM modeled with NewColor as a Moore type output
68Contd
69Contd
70FSM modeled with a Mealy and a Moore Output
71Contd
72Contd
73Contd
- Moore Output
- Dependent only on the current state, early output.
74FSM with sequential next state logic
- Extra FF in the next state logic.
- State Diagram
- BeenlnState3B (extra FF)
75(No Transcript)
76FSM with sequential next state logic
77Contd
78Contd
79Contd
80Contd
- Inferred FSM Structure with an additional FF in
the next state logic
81FSM with sequential output logic
- FSM with sequential output logic
- State machine with an embedded counter
- Counter parts of the state machines output
logic. - State diagram implying sequential output logic
82State diagram implying sequential output logic
83FSM with sequential output logic
84Contd
85Contd
Tried to use a synchronized value ?? ??
86Inferred FSM Structure with embedded counter
87FSM with sequential next state and output logic -
Blackjack
- Figure 8.12 State Diagram
- VHDL coded with one single process statement.
88VHDL Code
89Contd
90Contd
91Contd
92Contd
93Contd
94Contd
95Interactive State Machine
- Unidirectional
96(No Transcript)
97Interactive State Machine
98(No Transcript)
99Unidirectional interactive FSMs
- Three different ways of controlling data path
with unidirectional interactive FSMs
100(No Transcript)
101Data Path
- Data Path
- Accepts three or four 4-bits values on the input.
- Processes them, to provide sequences of either
two or three, 9-bits values on the output. - Input data A, B, C, D
- Output data Y1, Y2, Y3, (Y4)
- When ThreeOnly 0
- Y1 A.B A.C
- Y2 A.D B.C
- Y3 B.D C.D
- When ThreeOnly 1
- Y1 A.B A.C
- Y4 B.C
- Data Path controlled from Control Path 1, 2, 3
102(No Transcript)
103Control Path 1
- Control Path
- FSM master
- send Start FSM1, Start FSM2, Start FSM3
- FSM 1
- Dedicated to provide four enable signals used to
clock the serial input data into the appropriate
holding register. - FSM 2
- Send select signals which of the two held inputs
to multiply together. - Provide enable signals used to clock the
multiplied result into the appropriate state
register. - FSM 3
- Simply provide the select lines used to select
which result to output.
104Contd
- Control Signals in control path 1
105Contd
- Master FSM state diagram and FSM1, FSM2, FSM3
state diagram
106Contd
107Control Path 2
108Contd
- Control Path state diagram
1091. Data path(VHDL Code)
110Contd
111Contd
112Contd
1132. Control Path 1(VHDL Code)
114Contd
115Contd
116Contd
117Contd
118Contd
119Contd
120Contd
121Contd
122Contd
123Contd
124Contd
125Contd
1263. Control Path 2 (VHDL Code)
127Contd
128Contd
129Contd
130Contd
131Contd
132Contd
133Contd
134Contd
135Contd
1364. Control Path 3 (VHDL Code)
137Contd
138Contd
139Contd
140Contd
141Contd
142Contd
143Contd
144Two Interactive FSM Controlling rotors
- Two Interactive FSM Controlling rotors
- To control two mechanical interlocking rotors,
which rotate in 90 increments in a clockwise or
counter clockwise.
145(No Transcript)
146Contd
- Two Interactive FSM Controlling rotors
- FSM1(FSM2) controls the rotor R1(R2)
- Four states(Ang0, Ang90, Ang180, Ang270)
- Inputs CW-R1, CCW-R1, CW-R2, CCW-R2
- Two rotors should not be in the same position
- Primary drive, Secondary drive
- Cannot be in or moved to some where if it is not
occupied by the primary drive - R1_R2b 1 R1 is drive
- R1_R2b 0 R2 is drive
147(No Transcript)
148VHDL Code
149Contd
150Contd
151Contd
152Contd
153Contd
154Contd
155Contd
156Contd
157Contd
158Contd