📄 shft_reg.vhd
字号:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
Entity shft_reg is
Port (
DIR : in std_logic;
CLK : in std_logic;
CLR : in std_logic;
SET : in std_logic;
CE : in std_logic;
LOAD : in std_logic;
SI : in std_logic;
DATA : in std_logic_vector ( 3 downto 0);
Data_out : out std_logic_vector ( 3 downto 0)
);
End entity;
Architecture shft_reg_arch of shft_reg is
Signal TEMP_data_out : std_logic_vector ( 3 downto 0);
Begin
Process(CLK)
begin
if rising_edge(CLK) then
if CE = '1' then
if CLR = '1' then
TEMP_data_out <= "0000";
elsif SET = '1' then
TEMP_data_out <= "1111";
elsif LOAD = '1' then
TEMP_data_out <= DATA;
Else
If DIR = '1' then
TEMP_data_out <=SI & TEMP_data_out( 3 downto 1);
else
if DIR = '1' then
TEMP_data_out <= TEMP_data_out( 2 downto 0) & SI;
end if;
end if;
end if;
end if;
end if;
end Process;
data_out <= TEMP_data_out;
end Architecture;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -