所以我有这个实验室作业,它继承了前一个,我在VHDL中实现了一个单位ALU . 单比特ALU模块采用操作码并基于该操作码执行操作,例如,操作码 . 加法或减法 .

entity alu_slice is
     Port ( a : in STD_LOGIC;
           b : in STD_LOGIC;
           s : out STD_LOGIC;
           opcode : in STD_LOGIC_VECTOR (2 downto 0);
           cin : in STD_LOGIC;
           cout : out STD_LOGIC);
end alu_slice;

上面的操作码向量是在模拟时放置3位操作码的地方,以告诉ALU要执行什么算术运算 . 单比特ALU的行为如下:

architecture Behavioural of alu_slice is
architecture Behavioural of alu_slice is

begin 

multiplex: process(a, b, opcode, cin)  is begin

case opcode is
when "000" =>
--cin <= '0';
--s <= (a xor b) xor cin;
s <= (a xor b) xor cin;
cout <= (a and b) xor ((a xor b) and cin);


when "001" =>
s <= (a xor not b) xor cin;
cout <= (a and not b) xor ((a xor not b) and cin);


when "010" =>
s <= a and b;

when "011" =>
s <= a or b;

when "100" =>
s <= a xor b;

when "101" =>
s <= not a;

when "110" =>
--a <= cin;
cout <= a;

when "111" =>
s <= a xor cin;
cout <= a and cin;

when others =>
s <= (a xor b) xor cin;
cout <= (a and b) xor ((a xor b) and cin);


end case;

end process;

end behavioural;

我不会详细介绍每个操作码的含义,因为这不是我遇到的问题的一部分 . 我应该使用这个alu切片作为4位ALU架构的一部分,其中包含alu_slice实体的四个单独实例 . 我遇到的问题是,如果操作码的代码全部在alu切片的内部,那么在仿真期间它应该如何从4位模块改变?

这是我制作的4位alu实体 .

entity alu_pb is
    Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
           b : in STD_LOGIC_VECTOR (3 downto 0);
           s : out STD_LOGIC_VECTOR (3 downto 0);
           --op: in STD_LOGIC_VECTOR (2 downto 0);
           overflow : out STD_LOGIC;
           compl_overflow : out STD_LOGIC;
           zero : out STD_LOGIC);
end alu_pb;

这是使用我被告知在我的笔记中使用的所有信号 . 我注释掉了op向量,因为我试图解决这个问题 . 最后我在项目的体系结构中有四个ALU切片,但我无法编译,因为我似乎无法找到更新alu切片组件中的操作码逻辑向量的方法,以便它可以在所有单独的片在四个位中的每一个之间执行适当的操作 .

以下是架构中的其余代码:

architecture Behavioral of alu_pb is

component alu_slice is
  Port(a: in STD_LOGIC;
       b: in STD_LOGIC;
       s: out STD_LOGIC;
       opcode: in STD_LOGIC_VECTOR(2 down to 0);
       cin: in STD_LOGIC;
       cout: out STD_LOGIC);
       end component;

signal carry: STD_LOGIC_VECTOR(3 down to 0);
signal op_carry: STD_LOGIC_VECTOR(2 down to 0);
signal sum_buffer: STD_LOGIC_VECTOR(3 down to 0);
signal carry_in: STD_LOGIC;


begin

slice_zero: alu_slice
port map(
--opcode(0) => op(0);
--opcode(1) => op(1);
--opcode(2) => op(2);
a => a(0),
b => b(0),
s => s(0),
--s => sum_buffer(0),
cin => carry_in,
cout=>carry(0)
);

slice_one: alu_slice
port map(
--op(0) => opcode(0),
--op(1) => opcode(1),
--op(2) => opcode(2),
a => a(1),
b => b(1),
s => s(1),
--s => sum_buffer(1)
cin => carry(0),
cout => carry(1)
);

slice_two: alu_slice
port map(
--op(0) => opcode(0),
--op(1) => opcode(1),
--op(2) => opcode(2),
a => a(2),
b => b(2),
s => s(2),
--s => sum_buffer(2)
cin => carry(1),
cout => carry(2)
);

slice_three: alu_slice
port map(
--op(0) => opcode(0),
--op(1) => opcode(1),
--op(2) => opcode(2),
a => a(3),
b => b(3),
s => s(3),
--s => sum_buffer(3),
cin => carry(2),
cout => carry(3)
);



--op_carry(0) <= op(0);
--op_carry(1) <= op(1);
--op_carry(2) <= op(2);



end Behavioral;

在'end behavioral'之前的末尾还有一些其他注释代码,但我省略了它们,因为它们与实际问题无关,并且与alu_pb实体的某些端口设置的条件有关(compl_overflow,overflow,zero等) . )

如果我尝试模拟我的模型,我收到此错误消息:

“错误:[VRFC 10-704]正式操作码没有实际或默认值[U:/alu/alu_pb.vhd:63]” .

希望有经验的VHDL人员能够帮助我找到解决方案 .

提前致谢,

西蒙 .