# How to pass array wires from the design which will be by reference and not static?

**URL:** <https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757>\
**Category:** SystemVerilog\
**Tags:** logic-array-packed-unsigned, SystemVerilog, pass-argument-by-ref, wire-assign, fork-join\_none-and-automatic-variables, forksystemverilog\
**Created:** [November 26, 2023, 4:55pm UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757 "2023-11-26T16:55:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabi0307](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@gabi0307](https://verificationacademy.com/forums/u/gabi0307)\
**Post date:** [November 26, 2023, 4:55pm UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/1 "2023-11-26T16:55:37Z")

</div>

Hi there,

I have a task in which I need to check several sequences (logical not in UVM sense).

each sequence has a different set of design signals which should be checked. I created a task which checks a general sequence by the requirements needed. The issue is I need to generalize the task in order to pass different design arrays but I cannot manage to do that. the task is an automatic task (a requirement which is necessary).

My question is how do I pass a design array of wires in such way where I can monitor its changes (for example waiting for posedge or negedge)? and then perform the checks that I need.

Best Regards and thank you in advance.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [November 28, 2023, 2:32pm UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/2 "2023-11-28T14:32:40Z")

</div>

_In reply to [gabi0307](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757):_

There are a couple of ways to handle this.

The straightforward approach might be to create an array of variables and use a continuous assignment from the array of wires to the array of variables, the call the task with the variable.

```verilog
  wire [7:0] W[10];
  logic [7:0] V[10];
  assign V = W;
  ...
  myrask(V);

```

But a better methodology might be to use a module instead of task to model your checks (or place your task inside this module). You can use the bind construct to instantiate your module. This simplifies the need to create a separate array variable and continuous assignment for each check.

---

<div class="post-metadata">

**Author:** ![gabi0307](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@gabi0307](https://verificationacademy.com/forums/u/gabi0307)\
**Post date:** [November 28, 2023, 5:46pm UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/3 "2023-11-28T17:46:17Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/2):_

Hi Dave,  
Thank you for the reply.

I’ve tried what you have suggested but it gives me a shallow copy (static value of design) and not a pointer to the signals themselves.

below is a pseudo code of my situation:

```verilog

interface scoreboard ();
   //defines of variables
   //...
   assign design_array1 = {a1,...,an}
   assign design_array2 = {b1,...,bn}

   //later in the code

   always @ (trigger1) begin
      task_sequence1
   end
   always @ (trigger2) begin
      task_sequence2
   end

   //later in the code

   task task_sequence1 ();
      sequence_checker (/*all the arguments*/)
   endtask
   task task_sequence2 ();
      sequence_checker (/*all the arguments*/)
   endtask

   //later in the code

   task automatic sequence_checker (/*all the arguments*/);
      // implemintation of the task
   endtask

endinterface

```

The issue is I need sequence checker to know how to receive different design\_array inputs for each sequence I have with the same verification method of sequence\_checker. I hope it clarifies the issue I have.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [November 29, 2023, 2:37am UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/4 "2023-11-29T02:37:15Z")

</div>

_In reply to [gabi0307](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/3):_

I don’t know what you mean by /\* all the arguments \*/. Didn’t you want to pass design\_array1 by reference?

It would help to show a [minimal compete example](https://stackoverflow.com/help/minimal-reproducible-example) of what you are trying to accomplish.

---

<div class="post-metadata">

**Author:** ![gabi0307](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/g/43a26b/32.png) [@gabi0307](https://verificationacademy.com/forums/u/gabi0307)\
**Post date:** [November 29, 2023, 8:18am UTC](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/5 "2023-11-29T08:18:03Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/how-to-pass-array-wires-from-the-design-which-will-be-by-reference-and-not-static/42757/4):_

Hi Dave,

The sequence\_checker task holds many arguments and I just didn’t want to belabor my comment. Yes my purpose is to be able to pass design\_array as an argument in the following way:

```verilog

sequence_checker (input logic design_array[], int SIZE, input logic expected_values[], input logic expected_values_init[], input logic expected_values_final[])

```

Basically those are the arguments I am passing. I’ve used “input logic” because I believed it was the correct way. If you feel this is wrong or there is a better way let me know.

Best Regards,  
Gabriel.
