VHDLEntity et ArchitecturePorte ORentity OR_ent is port( x: in std_logic; y: in std_logic; s: out std_logic ); end OR_ent; architecture OR_beh of OR_ent is begin s <= x or y; end OR_beh; Un design VHDL est constitué d'une partie "entity" et d'une partie "architecture". L'entity décrit les entrées/sorties et l'architecture décrit le fonctionnement.
ProcessProcessprocess (x,b) begin s <= x or y; t <= a and b; end process; Un process contient des opérations parallèles. Toutes les opérations se déroulent de manière concurrente (en même temps).
A la première ligne, les signaux entre paranthèses indiquent quand le process doit s'exécuter. Ici, le process est exécuté seulement quand x où b change. Cela signifie que rien ne se passe lorsque y où a change. Process avec reset et horlogeprocess(CLK,RESET) begin if RESET='1' then s <= '0'; elsif rising_edge (CLK) then s <= x or y; end if; end process; Ce process est synchronisé sur l'horloge CLK ; à chaque front montant, s recopie x or y. Lors du RESET, s vaut 0.
Code VHDL complet-- code VHDL complet library ieee; use ieee.std_logic_1164.all; entity OR_ent is port( x: in std_logic; y: in std_logic; s: out std_logic ); end OR_ent; architecture OR_beh of OR_ent is signal CLK, RESET : std_logic begin CLK <= not CLK after 10 ns; RESET <= '1', '0' after 3 ns; process(CLK,RESET) begin if RESET='1' then s <= '0'; elsif rising_edge (CLK) then s <= x or y; end if; end process; end OR_beh;
Il n'y a pas de commentaire sur cette page.
[Afficher commentaires/formulaire]
|
|