我有以下問題:我要實現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