Title: ?? ?? ?? (State Machine Design)
1?? ?? ??(State Machine Design)
2????
- 1. ?? ??
- 2. ????? ?? ?? ?? ??
- 3. ????? ?? ?? ??
- 4. Normal Open ????? ?? ??? ????
- 5. ?? ????? ??? ??(Unused States)
- 6. ?? ??? ??
3?? ?? ??
- ?? ??(State Machine) ?? ???? ?? ???? ???? ???
????. - ??? ?? ????? ???? ?? ????? ?? ?? ??? ????? ????.
- ????(State Variable) ???? ????? ????
????(????)? ????. - ???? ??????(FSM)? ??? ???? ?? ??? ?? ???
??(????)? ??? ????? ???? ????(??, ??, ????)? ???.
4?? ?? ??
- ????(Moore Machine) ??? ?? FSM? ????(FF)? ??? ?
???? ??. - ????(Mealy Machine) ??? FSM? ????? ???? ???
???? ??. - ???? FSM? ?? ??? ????.
- MPU ??? ???? ????? FSM? ? ??? ???.
5?? ??(Moore Machine)
- ??? ?? ?? ????? ????? ???? ????.
- ?? ??? ??? ??? ??? ??? ??.
6?? ??(Mealy Machine)
- ??? ?? ??? ?? ???, ?? ??? ???? ????.
- ?? ??? ??? ??? ??? ?????? ?? ? ??.
7FSM ?? ??
- ??? ??
- ????? ??????? ???? ??? ???, ???? ???, ??? ? ??
????. - VHDL ??
- Case? ?? IF THEN ELSE?, ???? ?? ????.
8??? ?? ??
- ?? ??? ????.
- ??? ???? ?? ???? ???.
- ???? ????. ????? ?? ????? ????? ??? ????, ????
?? ????? ??? ????. - ?????? ?????? ??? ???? ???? ??? ???? ?? ????
???? ????. - ? ????? ????? ?? ?? ?? ???.
- ???? ??? ?? ???? ??? ?? ? ????? ??? ??.
9FSM ?? ?(Gray code counter)
Gray code encoder
State diagram
Based on state table
10- FF Input equations gt
- D0 !Q2 !Q1 Q2 Q1, D1 Q1 !Q0 !Q2 Q0, D2
Q1 !Q0 Q2 Q0
11??? ?? ???? FSM VHDL
Enumerated type User-defined type in VHDL
Enumerated State (type STATE_TYPE)
12???(Enumerated Type) ?
- TYPE DIRECTION IS (up, down, left, right)
- ???? type DIRECTION? position(??? ??)????
signal? ?? ? ? ??. - SIGNAL position DIRECTION
- gt IF? ?? ?? ???? signal position? type
DIRECTION? 4?? ? ??? ?? ? ? ??. - IF (x0 and y0) THEN
- position lt down
- ELSIF (x0 and y1) THEN
- position lt left
- ELSIF (x1 and y0) THEN
- position lt up
- ELSE
- position lt right
- END IF
13Note the Output Assignments are made outside of
the Process Concurrently
14??? ?? ???? ? ?? FSM VHDL
15(No Transcript)
16????? ?? FSM
17- Flip-flop excitation table
J /Q/in1 Q/in1 /in1 K 1 Out1
/Q/in1 Out2 Q/in1 Qin1 Q
18Synchronized with system clock
Asynchronized with system clock
19- Modified circuit and Simulation results
Synchronized with system clock
20?? ?? ??(SM Pulser) VHDL
21?? ?? ?? VHDL (??)
22?? ?? ??? ?????
23?? ?? ???(Single Pulse Generator)
present state input next state sync. input
output Q(t) sync Q(t1)
D pulse 0 0
1 1 1
0 1 0 0
0 1 0
1 1 0 1
1 0 0
0
D /sync Pulse /Q/sync
Asynchronized with system clock
24 25??? ?? ?? ???
Synchronized with system clock
26?? ?? ??? VHDL
27?? ?? ???? ?????
28??? ????
- ??? ??????? ???? ??(???)? ???? ?? ???? ??? ??.
- ???? ?? ?, ?? ???? ??? ??? ?? ???.
29??? ???? ????
- ??? ????? ?? ??(T 2.6mS)?? ???(???)? ????? ??
??? ? ??. - ??? ???? ??? ???? ????, ? ??? 4-?? ????? ?? ???
??. - ??? ????? ??? ??? ??? ?, ?? ???? ?? ????? ??
????. - ???? ???? ?, ??? ????? ??? ??? ?? ????, ?????
??? ???? ?? ??? ????. - ??? ????? ??? ???? ?? ??? XNOR ???? ?? ????.
- FSM? pb_in ? pb_out? ????? ?? ????.
- ??? ??? ???? ?, pb_in pb_out? ????? 4?? ???
?????.(S0, S1, S2, S3, S0). - ?? ???? ???? ?, pb_in ? pb_out? ????? S0? ?? ???.
30??? ???? ???? ??
pb_in
active-high synchronous load
10ms
??? ?? arbitrary value ?(??)
31LPM? ??? ??? ???? ???? VHDL
32??? ???? ???? VHDL(??)
33??? ???? ???? VHDL(??)
34??? ???? ???? ?????
35??? ???? ???? ???(Behavioral) VHDL
- ?? pb_in pb_out ??,
- ??? ????? ????.
- ???, ??? ?? S3????
- ????? ???.
- ?? pb_in ? pb_out ??,
- ??? ????? ????.
36??? ???? ???? ??? VHDL(??)
37??? ???? ???? ??? VHDL(??)
38Switch debouncer
39??? ??(Unused States)
- ?? ???? ???(MOD-10? ??)? ??? ?? ? ???? ?? ???
???. - MOD-10 ????4-bit? ???? 6?? unused states (1010,
1011.1111)? ???. - FSM ?? ????? 5?? ???? ?? ?????? ??? ??? ?? ? ??.
??? FSM? ??? ?? 5?? ??? ???? ?? 3 ??? ????, 3???
??? ??? ??? ???. - ?? ??? ??? dont cares (X) ?? ??? ?? ??? ??? ?
??.
40??? ?? ?(Two Pulse Generator)
Two-pulse generator
- States (111), (110),
- (101), (100), (011)
- gt
- Unconditional
- transition
?10.6, Fig. 10.34 ??
D2 /Q2Q1Q0 D1 /Q2 Q1 /Q0 /Q2 /Q1
/in1 D0 /Q2 /Q0 in1 /Q2 /Q1in1 Out1
/Q2 Q1 Q0 Out2 Q2 /Q1 /Q0
41Two pulse generator
???? ??
42???? ??(? 1-clk ? ?? ??)
Buried node
43??? ?? VHDL (Two Pulse Generator)
44?? gt
45GDF
VHDL
46?? ??? FSM
- FSM? ?-? ??? ?-? ??? ????.
- ? ??? ?? ?? ?, ?, ?? 3?? ??? ????(nsr, nsy, nsg
? ewr, ewy, ewg). ?, Low ON. - Timer ??? ??? ???? ????? ????(timer 1? S0??
S1?? ?? S2?? S3?? ??). - ???? ??? ?(S0(EW) ?? S2(NS)), ?? ???? ????.
- ???? ??, ???? ????? ??? ??? ??.
- ?? ???? 4-Clocks Green, 1-Clock Yellow, 5-Clocks
Red ??.
N-S E-W
N-S E-W
N-S E-W
N-S E-W
470.75Hz
N-S E-W
Altera UP-1 25.175MHz
N-S E-W
N-S E-W
N-S E-W
Timer
R
G
Y
R
G
Y
(s0)
(s2)
(s0)
(s1)
(s3)
48MOD-5 ???
TIMER
49Summary
- State machine? ????? ???? ????? ?????? ???
- ???? ???? ??? ??? ??????.
- State machine ?? ????? ?????(s0, s1, s2, ) ??
?????(start, - idle, read, write,) ??? ? ??. ????? ????? ???
????. - ????? ?? enumerated type definition ?? ?? ? ?
??. - State machine? VHDL ???? ??? unused state ??
CASE ??? others - ?? ??? ? ??.