赋值语句左值中的语法

问题描述

  1. 这是代码

  2. 并且无法识别错误

  3. 显示 {contractHolders: []}错误。我改了名字,但也显示错误

我认为这是一个逻辑错误

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