我是 VHDL 的新手。我正在使用 VHDL 实现串行输入串行输出 72 位移位寄存器。当使能信号为高电平时,我希望移位寄存器移位 72 次,无论使能信号继续为高电平还是低电平。我编写了以下代码,该代码仅在启用高时才有效。任何人都可以在启用高后帮助我转移数据,然后不依赖于启用来转移数据吗?
library ieee;
use ieee.std_logic_1164.all;
entity SR is
port(clk, din, rst, enable : in std_logic;
sr_out : inout std_logic_vector(71 downto 0));
end SR;
architecture behavioral of SR is
signal shift_reg: std_logic_vector(71 downto 0);
begin
process (clk, rst)
begin
if (rst = '0') then
shift_reg <= (others => '0');
elsif (clk'event and clk = '1') then
if enable= '1' then
shift_reg(70 downto 0) <= shift_reg(71 downto 1);
shift_reg(71) <= din;
end if;
end if;
end process;
sr_out <= shift_reg;
end behavioral;
非常感谢!