Académique Documents
Professionnel Documents
Culture Documents
Le registre à décalage est à peine plus compliqué à décrire que le registre simple. Il nécessite
l’utilisation d’une boucle for :
library IEEE;
use IEEE.std_logic_1164.all;
entity shift is
port ( CLK : in std_logic ;
CLEAR : in std_logic;
CE : in std_logic;
Din : in std_logic;
Q : out std_logic_vector(7 downto 0));
end shift;
architecture RTL of shift is
signal Qint : std_logic_vector(Q'range);
begin
process(CLK, CLEAR)
begin
if (CLEAR='1') then
Qint <= (others => '0');
elsif (CLK'event and CLK='1') then
if (ce = '1') then
for i in 1 to 7 loop
Qint(8-i) <= Qint(7-i);
end loop;
Qint (0) <= Din;
end if;
end if;
end process;
Q <= Qint;
End RTL ;