summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLYAM <cous5830@gmail.com>2025-05-18 19:34:48 -0400
committerLYAM <cous5830@gmail.com>2025-05-18 19:34:48 -0400
commit365464a8d1961271e5825a3772c7e8489f932166 (patch)
tree516330e573f01b9b5785aa842c9553f2910ebef4
parent5c72385b2d95a7842ddff0393e91744432da24af (diff)
M8 Works!
-rw-r--r--pb_logique_seq.srcs/sources_1/imports/new/module_commande.vhd157
1 files changed, 81 insertions, 76 deletions
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 2141173..d37b2b6 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
@@ -25,9 +25,9 @@ ARCHITECTURE BEHAVIOR OF module_commande IS
type sound_effect is (effect_a, effect_b, effect_c, effect_d);
signal current_sound_effect : sound_effect;
signal wanted_sound_effect : sound_effect;
- signal increase_selection : std_logic;
- signal decrease_selection : std_logic;
- signal has_pressed_selection_already : std_logic;
+-- signal increase_selection : std_logic;
+-- signal decrease_selection : std_logic;
+-- signal has_pressed_selection_already : std_logic;
component conditionne_btn_v7 is
generic (nbtn : integer := nbtn; mode_simul: std_logic := '0');
@@ -43,8 +43,8 @@ end component;
signal d_strobe_btn : std_logic_vector (nbtn-1 downto 0);
signal d_btn_cd : std_logic_vector (nbtn-1 downto 0);
signal d_reset : std_logic;
- signal needs_to_increase : std_logic;
- signal needs_to_decrease : std_logic;
+-- signal needs_to_increase : std_logic;
+-- signal needs_to_decrease : std_logic;
BEGIN
@@ -75,81 +75,86 @@ BEGIN
end if;
end process;
-button_spam_manager : process(d_btn_cd, d_reset, clk)
- begin
- if d_reset = '1' then
- has_pressed_selection_already <= '0';
- increase_selection <= '0';
- decrease_selection <= '0';
- elsif rising_edge(clk) then
- -- Managing creating pulses for the button to avoid spam increasing states!
- if (NOT (has_pressed_selection_already = '1')) AND ((d_btn_cd(0) = '1') OR (d_btn_cd(1) = '1')) then
- -- No increase or decrease is called AND one of the buttons is pressed!
- -- That means we can send a pulse to increase or decrease the counter.
- has_pressed_selection_already <= '1';
- if d_btn_cd(0) = '1' then
- increase_selection <= '1';
- decrease_selection <= '0';
- elsif d_btn_cd(1) = '1' then
- decrease_selection <= '1';
- increase_selection <= '0';
- end if;
- else
- increase_selection <= '0';
- decrease_selection <= '0';
- end if;
- else
- if ((d_btn_cd(0) = '0') AND (d_btn_cd(1) = '0')) then
- -- no buttons is pressed. Therefor, we can start registering an increase or decrease again.
- has_pressed_selection_already <= '0';
- end if;
- end if;
- end process;
+--button_spam_manager : process(d_strobe_btn, d_reset, clk)
+-- begin
+-- if d_reset = '1' then
+-- has_pressed_selection_already <= '0';
+-- increase_selection <= '0';
+-- decrease_selection <= '0';
+-- elsif rising_edge(clk) then
+-- -- Managing creating pulses for the button to avoid spam increasing states!
+-- if (NOT (has_pressed_selection_already = '1')) AND ((d_strobe_btn(0) = '1') OR (d_strobe_btn(1) = '1')) then
+-- -- No increase or decrease is called AND one of the buttons is pressed!
+-- -- That means we can send a pulse to increase or decrease the counter.
+-- has_pressed_selection_already <= '1';
+-- if d_strobe_btn(0) = '1' then
+-- increase_selection <= '1';
+-- decrease_selection <= '0';
+-- elsif d_strobe_btn(1) = '1' then
+-- decrease_selection <= '1';
+-- increase_selection <= '0';
+-- end if;
+-- else
+-- increase_selection <= '0';
+-- decrease_selection <= '0';
+-- end if;
+-- else
+-- if ((d_strobe_btn(0) = '0') AND (d_strobe_btn(1) = '0')) then
+-- -- no buttons is pressed. Therefor, we can start registering an increase or decrease again.
+-- has_pressed_selection_already <= '0';
+-- end if;
+-- end if;
+-- end process;
-state_manager : process(current_sound_effect, decrease_selection, increase_selection)
+state_manager : process(clk, current_sound_effect, d_strobe_btn)
begin
- case current_sound_effect is
- when effect_a =>
- o_selection_fct <= "00";
- if increase_selection = '1' then
- wanted_sound_effect <= effect_b;
--- increase_selection <= '0';
- elsif decrease_selection = '1' then
- wanted_sound_effect <= effect_d;
- --decrease_selection <= '0';
- end if;
-
- when effect_b =>
- o_selection_fct <= "01";
- if increase_selection = '1' then
- wanted_sound_effect <= effect_c;
- --increase_selection <= '0';
- elsif decrease_selection = '1' then
- wanted_sound_effect <= effect_a;
- --decrease_selection <= '0';
- end if;
+ if rising_edge(clk) then
+ case current_sound_effect is
+ when effect_a =>
+ o_selection_fct <= "00";
+ case d_strobe_btn(1 downto 0) is
+ when "01" =>
+ wanted_sound_effect <= effect_b;
+ when "10" =>
+ wanted_sound_effect <= effect_d;
+ when others =>
+ -- Do nothing. It's not specified.
+ end case;
- when effect_c =>
- o_selection_fct <= "10";
- if increase_selection = '1' then
- wanted_sound_effect <= effect_d;
- --increase_selection <= '0';
- elsif decrease_selection = '1' then
- wanted_sound_effect <= effect_b;
- --decrease_selection <= '0';
- end if;
+ when effect_b =>
+ o_selection_fct <= "01";
+ case d_strobe_btn(1 downto 0) is
+ when "01" =>
+ wanted_sound_effect <= effect_c;
+ when "10" =>
+ wanted_sound_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_sound_effect <= effect_d;
+ when "10" =>
+ wanted_sound_effect <= effect_b;
+ when others =>
+ -- Do nothing. It's not specified.
+ end case;
- when effect_d =>
- o_selection_fct <= "11";
- if increase_selection = '1' then
- wanted_sound_effect <= effect_a;
- --increase_selection <= '0';
- elsif decrease_selection = '1' then
- wanted_sound_effect <= effect_c;
- --decrease_selection <= '0';
- end if;
- end case;
-
+ when effect_d =>
+ o_selection_fct <= "11";
+ case d_strobe_btn(1 downto 0) is
+ when "01" =>
+ wanted_sound_effect <= effect_a;
+ when "10" =>
+ wanted_sound_effect <= effect_c;
+ when others =>
+ -- Do nothing. It's not specified.
+ end case;
+ end case;
+ END IF;
end process;
o_btn_cd <= d_btn_cd;