blob: a8cf7d8659f10df57f1c0e90842416a0759a868c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---------------------------------------------------------------------------------------------
-- circuit compteur_nbits.vhd.vhd
---------------------------------------------------------------------------------------------
-- Université de Sherbrooke - Département de GEGI
-- Version : 1.0
-- Nomenclature : 0.8 GRAMS
-- Date : 14 mai 2019
-- Auteur(s) : Daniel Dalle
-- Technologies : FPGA Zynq (carte ZYBO Z7-10 ZYBO Z7-20)
--
-- Outils : vivado 2018.2
---------------------------------------------------------------------------------------------
-- Description:
-- Compteur a avec nombre de bits en parametre generic
---------------------------------------------------------------------------------------------
-- À faire :
--
--
---------------------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL; -- pour les additions dans les compteurs
entity compteur_nbits is
generic (nbits : integer := 8);
port ( clk : in std_logic;
i_en : in std_logic;
reset : in std_logic;
o_val_cpt : out std_logic_vector (nbits-1 downto 0)
);
end compteur_nbits;
architecture BEHAVIORAL of compteur_nbits is
-- compteur simple
signal d_val_cpt: std_logic_vector (nbits-1 downto 0);
BEGIN
compteur_proc : process (clk, reset, i_en)
begin
if ( reset = '1') then
d_val_cpt <= (others =>'0');
else
if (rising_edge(clk) AND i_en = '1') then
d_val_cpt <= d_val_cpt + 1;
end if;
end if;
end process;
-- sortie
o_val_cpt <= d_val_cpt;
END Behavioral;
|