Escolar Documentos
Profissional Documentos
Cultura Documentos
30/09/15 7:02 am
Page 1 of 3
30/09/15 7:02 am
begin
qu.push_front(2);
qu.push_front(12);
qu.push_front(22);
qu.push_back(11);
qu.push_back(99);
$display(" %d ",qu.size() );
$display(" %d ",qu.pop_front() );
$display(" %d ",qu.pop_back() );
qu.delete(3);
$display(" %d ",qu.size() );
end
endmodule
RESULTS :
5
22
99
Dynamic Array Of Queues Queues Of Queues
EXAMPLE:
module top;
typedef int qint_t[$];
// dynamic array of queues
qint_t DAq[]; // same as int DAq[][$];
// queue of queues
qint_t Qq[$]; // same as int Qq[$][$];
// associative array of queues
qint_t AAq[string]; // same as int AAq[string][$];
initial begin
// Dynamic array of 4 queues
DAq = new[4];
// Push something onto one of the queues
DAq[2].push_back(1);
// initialize another queue with three entries
DAq[0] = {1,2,3};
$display("%p",DAq);
// Queue of queues -two
Qq= {{1,2},{3,4,5}};
Qq.push_back(qint_t'{6,7});
Qq[2].push_back(1);
$display("%p",Qq);
// Associative array of queues
AAq["one"] = {};
AAq["two"] = {1,2,3,4};
AAq["one"].push_back(5);
$display("%p",AAq);
end
endmodule : top
http://www.printfriendly.com/print/?source=homepage&url=http%3A%2F%2Fwww.testbench.in%2FSV_13_QUEUES.html
Page 2 of 3
30/09/15 7:02 am
RESULTS:
'{'{1, 2, 3}, '{}, '{1}, '{}}
'{'{1, 2}, '{3, 4, 5}, '{6, 7, 1}}
'{one:'{5}, two:'{1, 2, 3, 4} }
http://www.printfriendly.com/print/?source=homepage&url=http%3A%2F%2Fwww.testbench.in%2FSV_13_QUEUES.html
Page 3 of 3
30/09/15 7:04 am
http://www.printfriendly.com/print/?source=homepage&url=htA%2F%2Fwww.testbench.in%2FSV_14_COMPARISON_OF_ARRAYS.html
Page 1 of 2
http://www.printfriendly.com/print/?source=homepage&url=htA%2F%2Fwww.testbench.in%2FSV_14_COMPARISON_OF_ARRAYS.html
30/09/15 7:04 am
Page 2 of 2