# Queues of Dynamic Arrays

**URL:** <https://verificationacademy.com/forums/t/queues-of-dynamic-arrays/32864>\
**Category:** SystemVerilog\
**Tags:** dynamic-arrays, SystemVerilog, queue\
**Created:** [February 15, 2017, 7:49pm UTC](https://verificationacademy.com/forums/t/queues-of-dynamic-arrays/32864 "2017-02-15T19:49:31Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [February 21, 2017, 7:10pm UTC](https://verificationacademy.com/forums/t/queues-of-dynamic-arrays/32864/5 "2017-02-21T19:10:46Z")

</div>

_In reply to [jin17](https://verificationacademy.com/forums/t/queues-of-dynamic-arrays/32864/4):_  
Assignments only work with contiguous sets of bits. You will need to pop into an intermediate dynamic array variable, and then use a foreach loop.

```verilog
module top;
   logic [7:0] Qda[$] []; // this is a Queue -> of dynamic arrays -> of logic [7:0]
   logic [7:0] DA[]={1,2,3};
   logic [7:0] temp_da[];
   logic [15:0] DA2[];
   initial begin
      Qda = '{10{ {} }}; // initializes a Queue of 10 empty dynamic arrays
      Qda.push_back(DA); // pushes the eleventh Queue element by copying the DA {1,2,3}
      //...
      temp_da = Qda.pop_front();
      DA2 = new[temp_da.size];
      foreach(DA2[ii]) DA2[ii] = temp_da[ii];
      $display("%p",DA2);
   end
endmodule

```

---

_[View the full topic](https://verificationacademy.com/forums/t/queues-of-dynamic-arrays/32864)._
