2

Here is an example below

module a_mod ( u );
input bit [2:0] u [1:0];
...
endmodule

module b_mod ();

bit [2:0] c1, c2;
a_mod a_mod_inst ( 
  .u ( {c1,c2} ) // won't work
);

endmodule

What's the easiest way of doing the hookup such that u[0] == c2 and u[1] == c1 ?

BTW, I know I can do what I show below, but looking for a more elegant alternative

bit [2:0] tmp_u [1:0];
assign tmp_u[0] = c2;
assign tmp_u[1] = c1;

a_mod a_mod_inst (
.u ( tmp_u )  // works for sure
);

1 Answer 1

3

Try:

bit [2:0] c1, c2;
a_mod a_mod_inst ( 
  .u ( '{c1,c2} ) // note the single quote before the open curly bracket
);

See IEEE1800-2012 Section 10.9. '{ is used for assigning or passing unpacked arrays.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.