bonjour,
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.std_arith.all;
entity DEC7SEG4 is
port (DEC :in std_logic_vector(3 downto 0);
SEG

ut std_logic_vector(0 to 6));
end DEC7SEG4;
architecture ARCH_DEC7SEG4 of DEC7SEG4 is
begin
SEG <= "1111110" WHEN DEC = 0
ELSE "0110000" WHEN DEC = 1
ELSE "1101101" WHEN DEC = 2
ELSE "1111001" WHEN DEC = 3
ELSE "0110011" WHEN DEC = 4
ELSE "1011011" WHEN DEC = 5
ELSE "1011111" WHEN DEC = 6
ELSE "1110000" WHEN DEC = 7
ELSE "1111111" WHEN DEC = 8
ELSE "1111011" WHEN DEC = 9
ELSE "-------";--indeterminé
end ARCH_DEC7SEG4;
pour le decodeur 7 segments
compteur:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.std_arith.all;
PACKAGE cpt_10_pkg IS
COMPONENT cpt_10
PORT (
clk, reset : IN STD_LOGIC;
dix : OUT STD_LOGIC ;
output : OUT STD_LOGIC_VECTOR (3 DOWNTO 0));
END COMPONENT;
END cpt_10_pkg;
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.std_arith.all;
ENTITY cpt_10 IS PORT (
clk, reset : IN STD_LOGIC;
dix : OUT STD_LOGIC ;
output : OUT STD_LOGIC_VECTOR (3 DOWNTO 0));
END cpt_10;
ARCHITECTURE compteur OF cpt_10 IS
BEGIN
PROCESS(clk,reset)
VARIABLE inc :STD_LOGIC_VECTOR (3 DOWNTO 0);
BEGIN
IF (reset='1') THEN inc:="0000";
ELSIF (clk'event and clk='1') THEN
IF (inc="1001") THEN
inc:="0000";
dix <= '1';
ELSE
inc:=inc+1;
dix <='0';
END IF;
END IF;
output <=inc;
END PROCESS;
END compteur;
et le tout:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.all;
ENTITY cpt_dec IS PORT (
clk, reset : IN STD_LOGIC;
centaine : OUT STD_LOGIC;
segm1, segm2 : OUT STD_LOGIC_VECTOR (6 DOWNTO 0));
ATTRIBUTE PIN_NUMBERS OF cpt_dec : ENTITY IS
"clk:2 reset:3 centaine:4 segm1(0):5 segm1(1):6 segm1(2):9 segm1(3):10" &
" segm1(4):11 segm1(5):12 segm1(6):17 segm2(0):18 segm2(1):19 segm2(2):20" &
" segm2(3):23 segm2(4):24 segm2(5):25 segm2(6):26";
END cpt_dec;
ARCHITECTURE compt_decod OF cpt_dec IS
SIGNAL clock2 : STD_LOGIC;
SIGNAL output1,output2 : STD_LOGIC_VECTOR (3 DOWNTO 0);
COMPONENT dec_7_segm
PORT (
input : IN STD_LOGIC_VECTOR (3 DOWNTO 0);
commande : OUT STD_LOGIC_VECTOR (6 DOWNTO 0));
END COMPONENT;
COMPONENT cpt_10
PORT (
clk,reset : IN STD_LOGIC;
dix : OUT STD_LOGIC ;
output : OUT STD_LOGIC_VECTOR (3 DOWNTO 0));
END COMPONENT;
BEGIN
cpt1 :
cpt_10
port map(clk,reset,clock2,output1);
cpt2 :
cpt_10
port map(clock2,reset,centaine,outp ut2);
decodeur1 :
dec_7_segm
port map (output1,segm1);
decodeur2 :
dec_7_segm
port map (output2,segm2);
END compt_decod;
bon la il ya deux decodeurs en changeant un peu le code ca devrait lmarcher. en esperant que ca t'aide