0
  1. This is code

  2. and can't recognize the error

  3. it's showing new_content as error. I changed its name, but error are also showing

I thing this is a logical error

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

I get these errors:

jdoodle.v:6: syntax error
jdoodle.v:8: Syntax in assignment statement l-value.
jdoodle.v:9: syntax error
jdoodle.v:10: error: invalid module item.
jdoodle.v:12: syntax error
0

1 Answer 1

0

You have 2 types of syntax errors.

You need to declare new_content as a reg since you make a procedural assignment to it in an always block.

You need to place @ to the left of the ( in your always line.

This code compiles with no errors for me:

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.