cprog_ex.py

Created by famille-bvc

Created on May 11, 2023

3.24 KB


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;

*******************************

multiplexeur de signaux mux4_4.

Ecrire l’entité et l’architecture du composant mux4_4 utilisé sur le schéma. 
Le vecteur de sortie dépendra dela valeur du vecteur de commande. 


entity mux4_4 is
 Port ( cde : in STD_LOGIC_VECTOR (1 downto 0);
 in_0 : in STD_LOGIC_VECTOR (3 downto 0);
 in_1 : in STD_LOGIC_VECTOR (3 downto 0);
 in_2 : in STD_LOGIC_VECTOR (3 downto 0);
 in_3 : in STD_LOGIC_VECTOR (3 downto 0);
 mux_out : out STD_LOGIC_VECTOR (3 downto 0));
end mux4_4;

architecture Behavioral of mux4_4 is

begin

with cde select
  mux_out <= in_0 when "00",
             in_1 when "01",
             in_2 when "10",
             in_3 when "11",
             "1111" when others;

end Behavioral; 

*******************************

regroupement de compteurs en VHDL.

Ecrire le code VHDL (entité et architecture) d' un compteur de 0 à 999 
regroupant les 3 compteurs du schéma avec leurs interconnexions.Vous déclarerez
les signaux nécessaires au câblage interne.On supposera quune bibliothèque 
a permis la déclaration du composant counter (ne pas le déclarer juste 
l'instancier)


entity counter_0_999 is
 Port ( clk : in STD_LOGIC;
 raz : in STD_LOGIC;
 enable : in STD_LOGIC;
 count_u, count_d, count_c,: out STD_LOGIC_VECTOR (3 downto 0);
 carry : out STD_LOGIC);
end counter_0_999 ;

architecture arch of counter_0_999 is
  signal carry_u, carry_d : std_logic;

begin
 C1: counter port map(clk ,raz, enable, count_u , carry_u);
 C2: counter port map(clk ,raz, carry_u, count_d , carry_d);
 C3: counter port map(clk ,raz, carry_d, count_c, carry );

end;

*******************************

en considérant le codage de la machine et en cas de parasite un blocage est 
possible.Pourquoi ? 


Le codage de la machine nécessite 3 bits (6 possibiliés) hors seules 5 sont 
identifiées,si la machine tombe dans le 6ème état, rien n'est pévu pour en
sortir. 


Proposer sur le code fourni une modification permettant d'éviter ce blocage. 

A la fin de l'instruction case, il suffit d'ajouter les 2 lignes suivantes :

when others => -- trap state

 Sreg0 <= coherence;

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.