移位寄存器
--实验评述
一、简单移位寄存器
二、带左右移位的移位寄存器
P186
library ieee;
use ;
entity shifter is
port(
din:in bit_vector(3 downto 0);
clk,load,left_right: in std_logic;
dout: inout bit_vector(3 downto 0));
end shifter;
architecture synth of shifter is
----------------------------------------
signal shift_val: bit_vector(3 downto 0);;
begin
nxt: process(load,left_right,din,dout)
begin
if(load = '1') then
shift_val <= din;
elsif(left_right = '0') then
shift_val(2 downto 0) <= dout(3 downto 1);
shift_val(3)<='0';
else
shift_val(3 downto 1) <= dout(2 downto 0);
shift_val(0) <='0';
end if;
end process;
current : process
begin
wait until clk'event and clk = '1';
dout <= shift_val;
end process;
end synth;
三、带并行控制的移位寄存器
四、桶形移位
EDA 移位寄存器 来自淘豆网m.daumloan.com转载请标明出处.