Compteur binaire 4 bits à remise à zéro asynchrone et validation de comptage synchrone et retenue. Ecrire l’entité et l’architecture d’un compteur décimal 4 bits (de sortie count) à remise à zéro (raz) asynchrone active à 1. Le comptage est rendu possible lorsque le signal enable est actif. Un signal de sortie carry (à traiter) permet le chaînage de plusieurs compteurs élémentaires pour la réalisation d'un compteur multi digits comme sur le schéma complet. entity counter is Port ( clk : in STD_LOGIC; raz : in STD_LOGIC; enable : in STD_LOGIC; count : out STD_LOGIC_VECTOR (3 downto 0); carry : out STD_LOGIC); end counter; architecture Behavioral of counter is constant cntmax : std_logic_vector (3 downto 0):= "1001"; signal cnt : std_logic_vector (3 downto 0); begin process (clk,raz) begin if raz='1' then cnt <= ( others => '0'); elsif clk'event and clk='1' then if enable = '1' then if cnt < cntmax then cnt <= cnt+1; else cnt <= ( others => '0'); end if; end if; end if; end process; count <= cnt; carry <= '0' when cnt<cntmax else '1'; end Behavioral;