我正在尝试实现给定特定功能代码的 ALU。
出于某种原因,下面的代码没有运行,并且根据编译器有错误。
错误(可抑制):alu.v(61): (vlog-2388) 'result' 已在此范围 (alu) 中声明。
错误(可抑制):alu.v(67): (vlog-2388) 'operand0' 已在此范围 (alu) 中声明。
错误(可抑制):alu.v(67): (vlog-2388) 'operand1' 已在此范围 (alu) 中声明。
错误(可抑制):alu.v(68):(vlog-2388)“控制”已在此范围(alu)中声明。
错误:(vlog-13069)alu.v(71):靠近“<=:语法错误,意外<=。
错误:alu.v(71): (vlog-13205) 在“结果”之后的范围内发现语法错误。是否缺少'::'?
如果我将 result、operand0、operand1 和 control 的声明删除为线和 regs,我仍然会收到错误消息,指出“结果”超出范围或无法访问。我真的对这部分感到困惑,任何帮助将不胜感激。
我觉得问题出在注册表和电线的某个地方,但我不确定。
module alu
(
//--------------------------
// Input Ports
//--------------------------
input [31:0] operand0,
input [31:0] operand1,
input [3:0] control,
//--------------------------
// Output Ports
//--------------------------
output [31:0] result,
output zero,
output overflow
);
// Signal Declarations: local params
// Signal Declarations: reg
// Signal Declarations: wire
always @(*)
begin
case(control)
4'b0000: result= operand0 | operand1; // OR
4'b0001: begin
result= operand0 & operand1; // AND
end
default: result = 4'b0;
endcase
end
endmodule
我将上面的代码更改为修改后的版本。我仍然收到错误:
现在它说:(vlog-2110)非法引用网络“结果”。3次