From af23a43e34659e108e2afc8da8a6cd26d64622e3 Mon Sep 17 00:00:00 2001 From: LYAM Date: Sun, 18 May 2025 20:34:22 -0400 Subject: Test du reset fonctionnel. M8 is done. --- .../sim_1/imports/new/module_commande_tb.vhd | 11 ++- .../sources_1/imports/new/module_commande.vhd | 101 +++++++++++---------- 2 files changed, 62 insertions(+), 50 deletions(-) diff --git a/pb_logique_seq.srcs/sim_1/imports/new/module_commande_tb.vhd b/pb_logique_seq.srcs/sim_1/imports/new/module_commande_tb.vhd index 4950da1..b98eba5 100644 --- a/pb_logique_seq.srcs/sim_1/imports/new/module_commande_tb.vhd +++ b/pb_logique_seq.srcs/sim_1/imports/new/module_commande_tb.vhd @@ -135,7 +135,7 @@ tb : PROCESS assert (d_sel_fct = expected_status_code) report "L'etat n'est pas S0 après la reinitialisation" severity WARNING; - for index_btn in 0 to 7 loop + for index_btn in 0 to 8 loop wait for c_delai_commandes; -- attendre delai d_btn <= "0001"; wait for c_delai_commandes; -- attendre delai @@ -146,7 +146,7 @@ tb : PROCESS report "L'etat n'est pas celui attendu" severity WARNING; end loop; - for index_btn in 0 to 7 loop + for index_btn in 0 to 9 loop wait for c_delai_commandes; -- attendre delai d_btn <= "0010"; wait for c_delai_commandes; -- attendre delai @@ -164,9 +164,16 @@ tb : PROCESS -- Pas de assert ici - on explore le comportement d'une condition particuliere end loop; + -- Test de reset quand la sélection n'est pas 0. + wait for c_delai_commandes; + d_btn <= "1000"; + expected_status_code <= "00"; + wait for c_delai_commandes; + wait for c_delai_commandes; d_sw <= "0000"; d_btn <= "0000"; + expected_status_code <= "00"; WAIT; -- will wait forever END PROCESS; diff --git a/pb_logique_seq.srcs/sources_1/imports/new/module_commande.vhd b/pb_logique_seq.srcs/sources_1/imports/new/module_commande.vhd index 0e41ccd..f3f5833 100644 --- a/pb_logique_seq.srcs/sources_1/imports/new/module_commande.vhd +++ b/pb_logique_seq.srcs/sources_1/imports/new/module_commande.vhd @@ -70,55 +70,60 @@ BEGIN end if; end process; -state_manager : process(clk, current_distortion_effect, d_strobe_btn) +state_manager : process(clk, current_distortion_effect, d_strobe_btn, d_reset) begin - if rising_edge(clk) then - case current_distortion_effect is - when effect_a => - o_selection_fct <= "00"; - case d_strobe_btn(1 downto 0) is - when "01" => - wanted_distortion_effect <= effect_b; - when "10" => - wanted_distortion_effect <= effect_d; - when others => - -- Do nothing. It's not specified. - end case; - - when effect_b => - o_selection_fct <= "01"; - case d_strobe_btn(1 downto 0) is - when "01" => - wanted_distortion_effect <= effect_c; - when "10" => - wanted_distortion_effect <= effect_a; - when others => - -- Do nothing. It's not specified. - end case; - - when effect_c => - o_selection_fct <= "10"; - case d_strobe_btn(1 downto 0) is - when "01" => - wanted_distortion_effect <= effect_d; - when "10" => - wanted_distortion_effect <= effect_b; - when others => - -- Do nothing. It's not specified. - end case; - - when effect_d => - o_selection_fct <= "11"; - case d_strobe_btn(1 downto 0) is - when "01" => - wanted_distortion_effect <= effect_a; - when "10" => - wanted_distortion_effect <= effect_c; - when others => - -- Do nothing. It's not specified. - end case; - end case; - END IF; + if d_reset = '1' then + wanted_distortion_effect <= effect_a; + o_selection_fct <= "00"; + else + if rising_edge(clk) then + case current_distortion_effect is + when effect_a => + o_selection_fct <= "00"; + case d_strobe_btn(1 downto 0) is + when "01" => + wanted_distortion_effect <= effect_b; + when "10" => + wanted_distortion_effect <= effect_d; + when others => + -- Do nothing. It's not specified. + end case; + + when effect_b => + o_selection_fct <= "01"; + case d_strobe_btn(1 downto 0) is + when "01" => + wanted_distortion_effect <= effect_c; + when "10" => + wanted_distortion_effect <= effect_a; + when others => + -- Do nothing. It's not specified. + end case; + + when effect_c => + o_selection_fct <= "10"; + case d_strobe_btn(1 downto 0) is + when "01" => + wanted_distortion_effect <= effect_d; + when "10" => + wanted_distortion_effect <= effect_b; + when others => + -- Do nothing. It's not specified. + end case; + + when effect_d => + o_selection_fct <= "11"; + case d_strobe_btn(1 downto 0) is + when "01" => + wanted_distortion_effect <= effect_a; + when "10" => + wanted_distortion_effect <= effect_c; + when others => + -- Do nothing. It's not specified. + end case; + end case; + end if; + end if; end process; o_btn_cd <= d_btn_cd; -- cgit v1.2.3