Gast
#1179644
Hallo,
ich habe hier ein code für schieberegister geschrieben.Der soll von
"00000001" bis "11111111" schieben und wieder von "11111111" bis
"00000001" quasi rechts und links schieben.kann mir bitte jemand sagen
wo ich falsch denken.Ich weiss es nicht mir weiter!!!!
Danke euch.
architecture VERHALTEN of reg2 is
signal clk_new : std_logic;
signal r_l : std_logic;
signal shift : std_logic_vector (7 downto 0);
begin
links:process (clk, reset_n)
variable temp : std_logic;
begin
if reset_n = '0' then
shift <= "00000001";
temp := '1';
elsif clk ='1' and clk'event then
clk_new <=clk_in;
if clk_in = '0'and clk_new ='1' then
if r_l = '0' then
shift(7 downto 1) <= shift(6 downto 0) ;
else
shift(6 downto 0) <= shift(7 downto 1);
end if;
if shift = "11111111" then
r_l <='1';
shift(7)<= '0';
shift(7 downto 1) <= shift(6 downto 0) ;
elsif shift="00000000" then
shift(0)<= '1';
end if;
end if;
LED <= shift;
end if;
end process links;
end VERHALTEN;