0

I have the following queue which I create in my sequence:

bit [31:0] transfers_seq [$];

I enter the following values to the queue:

{{00000000, 12345678, 54871245},{12454612, 00000000, 12367894}}

Now I have to pass the transfers_seq to another queue which in the transaction file by initial function that I wrote in the transaction file

transaction file:

class axi_transaction extends uvm_sequence_item();
   bit [31:0] transfers [$];

function init ( bit [31:0] transfers2init [$]);

endfunction: init

How can I assign the "bit [31:0] transfers2init [$]" to the "bit [31:0] transfers [$]" in the init function?

3 Answers 3

2

You can simply assign one queue to another:

transfers = transfers2init;

It will copy the elements of transfer2init to transfers. You can check it here: https://www.edaplayground.com/x/3q3f

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

Comments

1

Your function needs to return something and, to return a queue, you need a typedef:

typedef bit [31:0] queue [$];

Then, in your function, you can just copy one queue to the other (as suggested in another answer here):

function queue init ( queue transfers2init);
  init=transfers2init;
endfunction: init

But this is so simple, you don't really need a function.

https://www.edaplayground.com/x/3kyE

Comments

0

You can directly assign that.

transfer = transfer2init

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.