How do I add DFFs to FSM outputs? (cont)
begin state <= pstate; -- look at present state for debugging purposes
stateff:process(clk) -- process has state transistions ONLY
if (reset = '1') then pstate <= S0;
elsif (clk'event and clk='1') then -- rising edge of clock
WHEN S0 => if (zero = '1') then ld_cnt <= 1; pstate <= S1; end if;
WHEN S2 => if (cnt_eq = '1') then pstate <= S0 ; end if;
WHEN others => pstate <= S0;
set_busy <= '1' when (pstate = S0 and zero = ‘1’) else '0';
addr_sel <= '1' when (pstate = S2) else '0';
zero_we <= '1' when (pstate = S2) else '0';
cnt_en <= '1' when (pstate = S2) else '0';
clr_busy <= '1' when (pstate = S2 and cnt_eq = '1') else '0';
In one process model, put ld_cnt inside of state process!