我有以下问题:我要实现8位左移位器,使一个移位到左,它的代码是:循环8位移位器,VHDL
entity left_shift is
generic (N: integer := 8);
Port(
Databitsin : in STD_LOGIC_vector(N-1 downto 0);
Databitsout : out STD_LOGIC_vector(N-1 downto 0);
Carry: out std_logic
);
end left_shift;
architecture Behavioral_l of left_shift is
begin
Databitsout(N-1 downto 1)<= Databitsin(N-2 downto 0);
Carry<=Databitsin(N-1);
end Behavioral_l;
然后我需要实现另一个具有使一个右移
entity Right_shift is
generic (N: integer := 8);
Port(
Databitsin : in STD_LOGIC_vector(N-1 downto 0);
Databitsout : out STD_LOGIC_vector(N-1 downto 0);
Carry: out std_logic
);
end Right_shift;
architecture Behavioral of Right_shift is
begin
Databitsout(N-2 downto 0)<= Databitsin(N-1 downto 1);
Carry<=Databitsin(0);
end Behavioral;
现在,我必须建立具有使用这些2个组件,使循环移位(左,右)的主模块。 我该怎么做?
非常感谢您的帮助 – user2280448 2013-04-30 00:22:04