Professional Documents
Culture Documents
'Lab 12 Fpga' With You' With You
'Lab 12 Fpga' With You' With You
SID:8878
Lab 12
Question) Design a FSM to Detect Negative Edge.
CODE:
library IEEE;
waqar_12 is
port(
);
mc_state_type is
-- r_reg
process(clk, reset)
begin
end if;
end process;
-- r_nxt
process(r_reg,stobe)
begin case
r_reg is when
idle =>
if (stobe = '0') then
r_nxt<= s1;
else
r_nxt<= s2;
end if;
when s1 =>
r_nxt<= s1;
else
r_nxt<= s2;
end if;
when s2 =>
r_nxt<= s3;
else
r_nxt<= s2;
end if;
when s3 =>
r_nxt<= idle;
else
r_nxt<= s2;
end if;
end case;
end process;
-- moore output
process(r_reg)
begin
case r_reg is
when s1 =>
when s2 =>
when s3 =>
end case;
end process;
end Behavioral;
TEST BENCH:
-- Stimulus process
stim_proc: process
begin
reset<='0' ;wait for 200 ns; stobe<='0' ;wait for 30 ns; stobe<= '0';wait for 50 ns;
stobe<='1';wait for 30 ns; stobe<='1' ;wait for 30 ns; stobe<= '1';wait for 50 ns;
stobe<='0';wait for 30 ns; stobe<='0' ;wait for 30 ns; stobe<= '1';wait for 50 ns;
UCF FILE:
# Switch
NET "stobe" LOC = "G18";
NET "reset" LOC = "H18";
NET "clk" LOC = "B8";
# output
NET "output" LOC = "J14;