Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite State Machines Mano and Kime Sections 4-4, 4-5, 4-8.

Similar presentations


Presentation on theme: "Finite State Machines Mano and Kime Sections 4-4, 4-5, 4-8."— Presentation transcript:

1 Finite State Machines Mano and Kime Sections 4-4, 4-5, 4-8

2 Canonical Sequential Network State Register Combinational Network x(t) s(t+1) s(t) z(t) clk init present state present input next state present output

3 Mealy Machine State Register C1 x(t) s(t+1) s(t) z(t) clk init present state present input next state C2

4 Moore Machine State Register C1 x(t) s(t+1) s(t) z(t) clk init present state present input next state C2

5 VHDL Canonical Sequential Network State Register Combinational Network x(t) s(t+1) s(t) z(t) clk init present state present input next state present output process(clk, init) process(present_state, x)

6 VHDL Mealy Machine State Register C1 x(t) s(t+1) s(t) z(t) clk init present state present input next state C2 process(clk, init) process(present_state, x)

7 VHDL Moore Machine State Register C1 x(t) s(t+1) s(t) z(t) clk init present state present input next state C2 process(present_state, x) process(present_state) process(clk, init)

8 Example Detect input sequence 1101 fsm din dout clk clr din dout 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0

9 Easy Solution: Use Shift Register CLK DQ !QCLK DQ !QCLK DQ !QCLK DQ !Q CLK Q0Q1Q2Q3 1011 dout din

10 More General: Use State Diagram Detect input sequence 1101 S0 0 S1 0 S11 0 S110 0 S1101 1 1 1 0 1 0 1 0 0 1 0 CLR

11 fsm.vhd fsm din dout clk clr

12 fsm.vhd

13

14

15

16

17 fsmx.vhd fsm clk_pulse SW1 bn BTN4 LD1 LD8 din dout clr clk fsmx IBUFG clkdiv mclk

18 fsmx.vhd entity fsmx is port( mclk : in STD_LOGIC; bn : in STD_LOGIC; SW : in STD_LOGIC_VECTOR(1 to 8); BTN4 : in STD_LOGIC; led: out std_logic; ldg : out STD_LOGIC; LD : out STD_LOGIC_VECTOR(1 to 8) ); end fsmx;

19 fsmx.vhd

20 component clk_pulse port( BTN4 : in std_logic; cclk : in std_logic; clr : in std_logic; clk : out std_logic); end component; signal clr, clk, cclk, bnbuf: std_logic; signal clkdiv: std_logic_vector(23 downto 0);

21 fsmx.vhd U0: clk_pulse port map (BTN4 => BTN4, cclk => cclk, clr =>clr, clk => clk); U1: fsm port map (clr =>clr, clk => clk, din => SW(1), dout => LD(8)); LD(1) <= SW(1);

22 Detect input sequence 1101


Download ppt "Finite State Machines Mano and Kime Sections 4-4, 4-5, 4-8."

Similar presentations


Ads by Google