Академический Документы
Профессиональный Документы
Культура Документы
Circuit inputs
Combinational Circuits
Storage elements
clock
Each CLB contains two edge-triggered D flip-flops. They can be configured as positive-edge-triggered or negative-edge-triggered. Each D flip-flop has clock enable signal E, which is active high. Each D flip-flop can be set or reset by SR signal. A global reset or reset signal is also available for set or reset all D flip-flops once the device is powered up.
8-3
Enable Clock
D Q E
8-4
S3
0x
S1 S2 S1 S2 S3 S3
S1
S2 S2 S2
0 1 0 1
1
0 0
S0
10 11 xx 10
0x
S2 S3
S1
S2
11
State Table Note: this is a Moore-type machine. The design procedure for mealy-type machine is similar.
8-5
State Encoding
Binary encoding: minimum number of D flip-flops
Q1 Q0
S0 : S1 : S2 : S3 :
0 0 1 1
0 1 0 1
S0 : S1 : S2 : S3 :
0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0
8-6
Next States D1 1 1 1 1 0 1 0 1 1 1 1 1 D0 1 0 1 1 1 0 1 1 0 0 0 1
Q1 0 0 1 1 0 0 1 1 0 0 1 1
Q0 0 1 0 1 0 1 0 1 0 1 0 1
Outputs a b c 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0
d 1 1 1 0 1 1 1 0 1 1 1 0
e 1 1 0 0 1 1 0 0 1 1 0 0
8-7
(F1)
(F2) (F3)
b = Q1Q0
c = Q1Q0 d = Q0 + Q1 e = Q1
(F4)
(F5) (F6) (F7)
8-8
CLB
Q1 1 y x LUT F1 D Q F3, F4 e Q0 y x LUT F2 F5, F6 D Q CLB c CLB
a b
Clk
Di Q j ( I j ,1 I j ,2 I j ,n )
Di is the input of the D flip-flop that represents state Si Qj is the output of the D flip-flop that represent state Sj Ij,1, Ij,2, .. and Ij,n denote all input combinations that cause a state transition from Sj to Si
Output function
z k Qk ,1 Qk , 2 Qk ,m
zi is an FSM output Qk,1, Qk,2, .. and Qk,m denote all states (D flip-flip outputs) that cause output zk to be 1
8-10
Q0
CLB
0 D Q
c b
Q0 x y Q2
LUT F2
D Q
Q1
d
F5, F6 Q2
D Q
e
CLB
Q0 x y Q1 Q2 Q0 x Q2 Q3
LUT
F3
LUT
Q3
D Q
a
It needs three CLBs
LUT F4
CLB
Clock
8-12
One-hot encoding
More flip-flops It normally has simple combinational logic for next state transitions and output signals. It is suitable for high performance system design. It is unlikely to have glitches.
FPGAs have plenty of flip-flops. Thus, it is preferred to use one-hot encoding in FPGA FSM implementations.
8-13
11
Glitch
Q1
Q0
CLK
delay
8-14
01
10
Lock-up state
00
01
10
11
Used states
11 Used states
00
Unused state
Unused state
To avoid lock-up states, make sure the FSM will eventually move from any
unused state to an used state. Another method is to use reset (or set) signals to reset (or set) FSM to an used state (initial state) after power-up.
8-15
DFF
Previous states clock