entityarchitecture4.py

Created by arthur-candillon

Created on May 02, 2024

1.23 KB


Compteur binaire 4 bits à remise à
zéro asynchrone et validation de 
comptage synchrone et retenue.
Ecrire lentité et larchitecture dun 
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;

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.