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

📄 shifter.vhd

📁 用vhdl实现双向移位寄存器 仿真环境MAXPLUS-II
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;

entity shifter is 
port(
  clk,load,left_right:  in std_logic;
  din: in std_logic_vector(3 downto 0);
  dout: out std_logic_vector(3 downto 0)
);
end ;


architecture synthesis of shifter is
signal shift_var:std_logic_vector(3 downto 0);
begin

process(load,left_right,din)
 begin
     if load='1' then
       shift_var<=din;
     elsif left_right='0' then
       shift_var(2 downto 0)<=din(3 downto 1);
       shift_var(3)<='0';
     else
       shift_var(3 downto 1)<=din(2 downto 0);
       shift_var(0)<='0';
      end if;

end process;

process(clk)
begin
if clk'event and clk='1' then
dout<=shift_var;
end if;
end process;

end synthesis;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -