summaryrefslogtreecommitdiff
path: root/pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd
diff options
context:
space:
mode:
Diffstat (limited to 'pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd')
-rw-r--r--pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd55
1 files changed, 55 insertions, 0 deletions
diff --git a/pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd b/pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd
new file mode 100644
index 0000000..a8cf7d8
--- /dev/null
+++ b/pb_logique_seq.srcs/sources_1/imports/new/compteur_nbits.vhd
@@ -0,0 +1,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;
+