Skip to content
Snippets Groups Projects
Commit 47851b9a authored by Jean-Noël Bazin's avatar Jean-Noël Bazin
Browse files

update tirage

parent c4f63948
Branches
No related tags found
No related merge requests found
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity comparateur is
port(
I_reg0 : in std_logic_vector(5 downto 0);
I_reg1 : in std_logic_vector(5 downto 0);
I_reg2 : in std_logic_vector(5 downto 0);
I_reg3 : in std_logic_vector(5 downto 0);
I_reg4 : in std_logic_vector(5 downto 0);
I_nombre_courant : in std_logic_vector(5 downto 0);
O_invalide : out std_logic
);
end entity comparateur;
architecture arch of comparateur is
begin
invalide <= '1' when (I_reg0 = I_nombre_courant
or I_reg1 = I_nombre_courant
or I_reg2 = I_nombre_courant
or I_reg3 = I_nombre_courant
or I_reg4 = I_nombre_courant
) else '0';
end architecture arch;
...@@ -5,17 +5,17 @@ use IEEE.numeric_std.all; ...@@ -5,17 +5,17 @@ use IEEE.numeric_std.all;
entity registres is entity registres is
port ( port (
I_clk : in std_logic; I_clk : in std_logic;
I_rst : in std_logic; I_rst : in std_logic;
I_wr : in std_logic; I_wr : in std_logic;
I_adr : in std_logic_vector(2 downto 0); I_adr : in std_logic_vector(2 downto 0);
I_data : in std_logic_vector(5 downto 0); I_data : in std_logic_vector(5 downto 0);
O_reg0 : out std_logic_vector(5 downto 0) O_reg0 : out std_logic_vector(5 downto 0);
O_reg1 : out std_logic_vector(5 downto 0) O_reg1 : out std_logic_vector(5 downto 0);
O_reg2 : out std_logic_vector(5 downto 0) O_reg2 : out std_logic_vector(5 downto 0);
O_reg3 : out std_logic_vector(5 downto 0) O_reg3 : out std_logic_vector(5 downto 0);
O_reg4 : out std_logic_vector(5 downto 0) O_reg4 : out std_logic_vector(5 downto 0);
O_reg5 : out std_logic_vector(5 downto 0) O_reg5 : out std_logic_vector(5 downto 0)
); );
end registres; end registres;
......
...@@ -26,141 +26,166 @@ architecture a_tirage of tirage is ...@@ -26,141 +26,166 @@ architecture a_tirage of tirage is
component automate is component automate is
port ( port (
rst, clk : in std_logic; I_clk : in std_logic;
clk_display, bouton, invalide, fin : in std_logic; I_rst : in std_logic;
comptage : out std_logic; I_bouton : in std_logic;
enregistrement : out std_logic; I_clk_display : in std_logic;
l_rouge : out std_logic; I_bouton : in std_logic;
l_verte : out std_logic I_invalide : in std_logic;
); I_fin : in std_logic;
end component; O_comptage : out std_logic;
O_enregistrement : out std_logic;
O_l_rouge : out std_logic;
O_l_verte : out std_logic);
end component automate;
component registres is component registres is
port ( port (
clk, rst : in std_logic; I_clk : in std_logic;
enregistre : in std_logic; I_rst : in std_logic;
adr : in std_logic_vector(2 downto 0); I_wr : in std_logic;
numero_courant : in std_logic_vector(5 downto 0); I_adr : in std_logic_vector(2 downto 0);
reg0, reg1, reg2, reg3, reg4, reg5 : out std_logic_vector(5 downto 0) I_data : in std_logic_vector(5 downto 0);
); O_reg0 : out std_logic_vector(5 downto 0);
end component; O_reg1 : out std_logic_vector(5 downto 0);
O_reg2 : out std_logic_vector(5 downto 0);
O_reg3 : out std_logic_vector(5 downto 0);
O_reg4 : out std_logic_vector(5 downto 0);
O_reg5 : out std_logic_vector(5 downto 0));
end component registres;
component compteur_valid is component compteur_valid is
port ( port (
clk, rst, comptage : in std_logic; I_clk : in std_logic;
adr : out std_logic_vector(2 downto 0); I_rst : in std_logic;
fin : out std_logic I_comptage : in std_logic;
); O_adr : out std_logic_vector(2 downto 0);
end component; O_fin : out std_logic);
end component compteur_valid;
component comparateur is component comparateur is
port ( port (
reg0, reg1, reg2, reg3, reg4 : in std_logic_vector(5 downto 0); I_reg0 : in std_logic_vector(5 downto 0);
nombre_courant : in std_logic_vector(5 downto 0); I_reg1 : in std_logic_vector(5 downto 0);
invalide : out std_logic I_reg2 : in std_logic_vector(5 downto 0);
); I_reg3 : in std_logic_vector(5 downto 0);
end component; I_reg4 : in std_logic_vector(5 downto 0);
I_nombre_courant : in std_logic_vector(5 downto 0);
O_invalide : out std_logic);
end component comparateur;
component compteur1_49 is component compteur1_49 is
port ( port (
clk, rst, comptage : in std_logic; I_clk : in std_logic;
sortie : out std_logic_vector(5 downto 0) I_rst : in std_logic;
); I_comptage : in std_logic;
end component; O_sortie : out std_logic_vector(5 downto 0));
end component compteur1_49;
component led_pwm is component led_pwm is
port( port (
clk, rst : in std_logic; I_clk : in std_logic;
ledR, ledV : in std_logic; I_rst : in std_logic;
ledR_PWM, ledV_PWM : out std_logic I_ledR : in std_logic;
I_ledV : in std_logic;
O_ledR_PWM : out std_logic;
O_ledV_PWM : out std_logic
); );
end component led_pwm; end component led_pwm;
signal recom, comptage : std_logic; signal SC_recom : std_logic;
signal enregistrement, invalide, fin : std_logic; signal SC_comptage : std_logic;
signal adr : std_logic_vector(2 downto 0); signal SC_enregistrement : std_logic;
signal numero_courant, r0, r1, r2, r3, r4, r5 : std_logic_vector(5 downto 0); signal SC_invalide : std_logic;
signal SC_fin : std_logic;
signal l_V, l_R : std_logic; signal SC_adr : std_logic_vector(2 downto 0);
signal cpt_leds, cpt_leds_reg : unsigned(4 downto 0); signal SC_numero_courant : std_logic_vector(5 downto 0);
signal SC_r0 : std_logic_vector(5 downto 0);
signal SC_r1 : std_logic_vector(5 downto 0);
signal SC_r2 : std_logic_vector(5 downto 0);
signal SC_r3 : std_logic_vector(5 downto 0);
signal SC_r4 : std_logic_vector(5 downto 0);
signal SC_r5 : std_logic_vector(5 downto 0);
signal SC_l_V : std_logic;
signal SC_l_R : std_logic;
signal SC_cpt_leds : unsigned(4 downto 0);
signal SC_cpt_leds_reg : unsigned(4 downto 0);
begin begin
automate_1 : entity work.automate automate_1 : entity work.automate
port map ( port map (
rst => rst, I_rst => I_rst,
clk => clk, I_clk => I_clk,
clk_display => clk_display, I_clk_display => I_clk_display,
bouton => bouton, bouton => I_bouton,
invalide => invalide, invalide => SC_invalide,
fin => fin, fin => SC_fin,
comptage => comptage, comptage => SC_comptage,
enregistrement => enregistrement, enregistrement => SC_enregistrement,
l_rouge => l_R, l_rouge => SC_l_R,
l_verte => l_V l_verte => SC_l_V
); );
registres_1 : entity work.registres
registres_2 : entity work.registres
port map ( port map (
clk => clk, I_clk => I_clk,
rst => rst, I_rst => I_rst,
enregistre => enregistrement, I_wr => SC_enregistrement,
adr => adr, I_adr => SC_adr,
numero_courant => numero_courant, I_data => SC_numero_courant,
reg0 => r0, O_reg0 => O_Reg0,
reg1 => r1, O_reg1 => O_Reg1,
reg2 => r2, O_reg2 => O_Reg2,
reg3 => r3, O_reg3 => O_Reg3,
reg4 => r4, O_reg4 => O_Reg4,
reg5 => r5 O_reg5 => O_Reg5
); );
compteur_valid_1 : entity work.compteur_valid compteur_valid_1 : entity work.compteur_valid
port map ( port map (
clk => clk, I_clk => I_clk,
rst => rst, I_rst => I_rst,
comptage => enregistrement, I_comptage => SC_enregistrement,
adr => adr, O_adr => SC_adr,
fin => fin O_fin => SC_fin
); );
comparateur_1 : entity work.comparateur
port map (
reg0 => r0,
reg1 => r1,
reg2 => r2,
reg3 => r3,
reg4 => r4,
nombre_courant => numero_courant,
invalide => invalide
);
compteur_1 : entity work.compteur1_49 compteur_1 : entity work.compteur1_49
port map ( port map (
clk => clk, I_clk => I_clk,
rst => rst, I_rst => I_rst,
comptage => comptage, I_comptage => SC_comptage,
sortie => numero_courant O_sortie => SC_numero_courant
); );
led_pwm_1 : entity work.led_pwm led_pwm_1 : entity work.led_pwm
port map ( port map (
clk => clk, I_clk => I_clk,
rst => rst, I_rst => I_rst,
ledR => l_R, I_ledR => SC_l_R,
ledV => l_V, I_ledV => SC_l_V,
ledR_PWM => l_rouge, O_ledR_PWM => O_l_rouge,
ledV_PWM => l_verte O_ledV_PWM => O_l_verte
); );
invalide <= '1' when (SC_reg0 = SC_nombre_courant or
SC_reg1 = SC_nombre_courant or
SC_reg2 = SC_nombre_courant or
SC_reg3 = SC_nombre_courant or
SC_reg4 = SC_nombre_courant
) else '0';
reg0 <= r0; reg0 <= r0;
reg1 <= r1; reg1 <= r1;
reg2 <= r2; reg2 <= r2;
reg3 <= r3; reg3 <= r3;
reg4 <= r4; reg4 <= r4;
reg5 <= r5; reg5 <= r5;
end a_tirage; end a_tirage;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment