3

I want to define an add module which has a parameter, but my declaration of the new instance doesn't go well.

I want to define an instance of this module:

module add #(parameter wd=1) (input wire [wd-1:0] a,b, output wire [wd-1:0] o);

   assign o = a + b;

endmodule

I tried this line, but I get an error:

 add len_plus_1 #(8)(.a(len),.b(8'h1),.o(lenPlus1));

1 Answer 1

6

The instance name must come after the parameter specifier:

add #(8) len_plus_1 (.a(len),.b(8'h1),.o(lenPlus1));

This syntax is specified in the IEEE Standard (1800-2009, for example).

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.