没当do为1时循环左移一位:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity txt is
port (clk:in std_logic;
do:in std_logic;
putout:out std_logic_vector(3 downto 0)
);
end entity;
architecture behav of txt is
signal tmp:std_logic_vector(3 downto 0):="1010";
begin
process (clk,do)
begin
if clk'event and clk='1' then
if do='1' then
tmp<=tmp(2 downto 0)&tmp(3);
end if;
putout<=tmp;
end if;
end process;
end behav;