task xyz(output op, output bit [width-1:0] write_data []);

I have my task xyz definiton in an interface. I want to call this task from my testbench.sv.

How should I call it? I am trying to call it in this manner, but I am getting an error:

xyz(1'b0, bit[width-1:0] write_data [])

What's the correct way of passing an unpacked array of packed array as task arguments?


1 Answer 1


There are 2 types of errors in your task call line.

You should not use the variable type (bit) or any dimensions. These are only used in the task definition. Instead of passing:

bit[width-1:0] write_data []

simply pass the variable name:


You must not connect a constant (1'b0) to the op output.

Here is a complete code example which has no compile errors:

module tb;
  parameter width = 4;
  bit [width-1:0] write_data [];
  bit op;
  task xyz(output op, output bit [width-1:0] write_data []);
  initial begin
    xyz(op, write_data);

Here is the code on EDA playground.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.