entityarchitecture2.py

Created by arthur-candillon

Created on May 02, 2024

1.15 KB


Générateur de parité paire ou impaire
Donner lentité et larchitecture
dun générateur de parité paire 
ou impaire selon l'état du 
signal ptype (1=> impaire). 
Le générateur traite un vecteur 
de 6 bits (data) et fournit le 
résultat pbit sur un front 
descendant de la commande pcheck.
Notes : 
Parité paire : le nombre de bits
à 1 y compris le bit de parité 
doit être paire. 
Parité impaire : le nombre de bits
à 1 y compris le bit de parité 
doit être impaire. 
L'utilisation d'un opérateur ou exclusif s'avère efficace. 

entity parity_gen is 
 Port ( data : in STD_LOGIC_VECTOR (5 downto 0); 
  raz : in STD_LOGIC; 
  ptype : in STD_LOGIC; 
  pcheck : in STD_LOGIC; 
  pbit : out STD_LOGIC); 
end parity_gen;

architecture Behavioral of parity_gen is 
  signal psig : std_logic; 
  begin 
    process (pcheck) 
    variable pvar : std_logic;
    begin 
      if pcheck'event and pcheck='0' then 
        pvar := data(5) xor data(4) xor data(3) xor data(2) xor data(1) xor data(0); 
        psig <= pvar; 
      end if; 
end process; 
pbit <= '0' when raz='1' else 
  psig when ptype='0' else not psig;
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.