问题描述
new_content
我收到这些错误:
module IF_ID(new_content,instruction,newPC,clk,pwrite1);
input pwrite1,clk;
input [31:0] instruction,newPC;
output [63:0] new_content;
reg [63:0] next;
always (@negedge clk) begin
if(pwrite1)
new_content <= {instruction,newPC};
else
new_content <= 64'b0;
end
endmodule
解决方法
您有两种类型的语法错误。
您需要将 new_content
声明为 reg
,因为您在 always
块中对其进行了程序分配。
您需要将 @
放在 (
行中 always
的左侧。
这段代码对我来说编译没有错误:
module IF_ID(new_content,instruction,newPC,clk,pwrite1);
input pwrite1,clk;
input [31:0] instruction,newPC;
output reg [63:0] new_content;
reg [63:0] next;
always @(negedge clk) begin
if(pwrite1)
new_content <= {instruction,newPC};
else
new_content <= 64'b0;
end
endmodule