Commit eb4c3d25 authored by Oran Garrity's avatar Oran Garrity
Browse files

LAB#10 Step 1

parent 8536a5e8
......@@ -43,6 +43,7 @@ architecture rtl of play is
type state_t is (start_s,one_s,chance_s,four_s,last_s,hit0_s,hit1_s);
signal current_state,next_state : state_t;
signal key_press : std_ulogic;
begin
......@@ -66,8 +67,12 @@ begin
when chance_s =>
led_o <= "00100";
if key_i = '1' then
next_state <= hit0_s;
elsif onesec_i = '1' then
key_press <= '1';
end if;
if key_press = '1' AND onesec_i = '1' then
key_press <= '0';
next_state <= hit0_s;
elsif onesec_i = '1' then
next_state <= four_s;
end if;
when four_s =>
......@@ -83,14 +88,22 @@ begin
when hit0_s =>
led_o <= "10000";
if key_i = '1' then
next_state <= chance_s;
key_press <= '1';
end if;
if onesec_i = '1' AND key_press = '1' then
key_press <= '0';
next_state <= chance_s;
elsif onesec_i = '1' then
next_state <= hit1_s;
end if;
when hit1_s =>
led_o <= "00001";
if key_i = '1' then
next_state <= chance_s;
key_press <= '1';
end if;
if onesec_i = '1' AND key_press = '1' then
key_press <= '0';
next_state <= chance_s;
elsif onesec_i = '1' then
next_state <= hit0_s;
end if;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment