⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 移位寄存器.txt

📁 4位乘法器,4位除法器 8位数据锁存器,8位相等比较器,带同步复位的状态 机,元件例化与层次设计,最高优先级编码器
💻 TXT
字号:
--
--
---------------------------------------------------------------------------------------
-- DESCRIPTION   :  Shift register
--                  Type : univ
--                  Width : 4
--                  Shift direction: right/left (right active high)
--
--                  CLK active : high
--                  CLR active : high
--                  CLR type : synchronous
--                  SET active : high
--                  SET type : synchronous
--                  LOAD active : high
--                  CE active : high
--                  SERIAL input : SI
--
-- Download from :  http://www.pld.com.cn
---------------------------------------------------------------------------------------



library IEEE;
use IEEE.std_logic_1164.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
						TEMP_data_out <= TEMP_data_out(2 downto 0) & SI;
					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 + -