-- Fichier : reg_decalage.vhd -- Société : ENSERB -- Auteur : P.Nouel -- Date de création :oct 95 -- Description d'un registre a décalage gauche-droite, N bits -- avec chargement paralelle (synchrone) et remise a zero (asynchrone) -- L'horloge est active sur front montant ------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY registre_decalage IS GENERIC (Nb_bits : natural := 8; Tps : Time := 15 ns; Tpas : Time := 18 ns); PORT ( h, raz, edg, edd : IN STD_ULOGIC; sel : IN STD_ULOGIC_VECTOR(1 DOWNTO 0); d_entree : IN STD_ULOGIC_VECTOR(Nb_bits -1 DOWNTO 0); d_sortie : OUT STD_ULOGIC_VECTOR(Nb_bits -1 DOWNTO 0)); END; --------------------------------------------------------------------------------- 4 fonctions selon les valeurs de selection (sel) -- | sel | d_sortie -- | "00" | inchangee -- | "01" | decalage a droite avec bit edd a gauche -- | "10" | decalage a gauche avec bit edg a droite -- | "11" | Chargement de d_entree -- Relations temporelles simplifiees: -- Temps de propagation horloge->sortie : 15 ns -- Temps de propagation raz->sortie : 18 ns -- ------------------------------------------------------------------------------- ARCHITECTURE un_process OF registre_decalage IS BEGIN sr : PROCESS VARIABLE stmp : STD_ULOGIC_VECTOR(Nb_bits -1 DOWNTO 0) := ( OTHERS => '0'); BEGIN WAIT ON raz, h; IF raz = '1' THEN stmp := ( OTHERS => '0'); d_sortie <= stmp after tpas; ELSIF h'last_value = '0' AND h = '1' AND h'EVENT THEN CASE sel IS WHEN "11" => stmp := d_entree ; WHEN "10" => stmp := stmp(Nb_bits - 2 DOWNTO 0) & edg; WHEN "01" => stmp := edd & stmp(Nb_bits -1 DOWNTO 1); WHEN OTHERS => NULL; END CASE; d_sortie <= stmp after Tps; END IF; END PROCESS; END; -------------------------------------------------------------------------------