# \#queues-systemverilog

**URL:** https://verificationacademy.com/forums/tag/queues-systemverilog/7137.md

[Latest](https://verificationacademy.com/forums/latest.md) · [Categories](https://verificationacademy.com/forums/categories.md) · [Tags](https://verificationacademy.com/forums/tags.md)

---

## [Pattern Detector 10110 in SV (no FSM)](https://verificationacademy.com/forums/t/pattern-detector-10110-in-sv-no-fsm/49653)

<div class="topic-metadata">

**Author:** [@CharchicaA](https://verificationacademy.com/forums/u/CharchicaA)\
**Replies:** 1\
**Last updated:** [February 19, 2025, 9:48pm UTC](https://verificationacademy.com/forums/t/pattern-detector-10110-in-sv-no-fsm/49653 "2025-02-19T21:48:49Z")

</div>

Q. Write Code for Pattern Detector 10110. Input to DUT is 1 bit and output is 1 bit. How can I implement without queue? If I change queue to array in below code I get flag=1 twice. Why? EDA Link: EDA Playground D…

---

## [Constraint an array to have at least n pairs of consecutive x values](https://verificationacademy.com/forums/t/constraint-an-array-to-have-at-least-n-pairs-of-consecutive-x-values/42634)

<div class="topic-metadata">

**Author:** [@tharindu](https://verificationacademy.com/forums/u/tharindu)\
**Replies:** 3\
**Last updated:** [March 31, 2024, 4:49am UTC](https://verificationacademy.com/forums/t/constraint-an-array-to-have-at-least-n-pairs-of-consecutive-x-values/42634 "2024-03-31T04:49:21Z")

</div>

Hi All, I want to constraint an array / a queue to have at least n pairs of consecutive x values. For example: int values = '{1,2,2,3,5,1,2,2,2}; In the above array (1,2), (6,7), (7,8) index pairs have value “2”. So …

---

## [Count unique values in an array or a queue](https://verificationacademy.com/forums/t/count-unique-values-in-an-array-or-a-queue/42633)

<div class="topic-metadata">

**Author:** [@tharindu](https://verificationacademy.com/forums/u/tharindu)\
**Replies:** 4\
**Last updated:** [November 3, 2023, 5:52am UTC](https://verificationacademy.com/forums/t/count-unique-values-in-an-array-or-a-queue/42633 "2023-11-03T05:52:27Z")

</div>

Hi All, I want to get the number of unique values in an array / a queue. This method does not work int values\[$\] = '{1,2,3,4,1,2,3,4}; int unique\_value\_count; unique\_value\_count = values.unique().size(); It gives …

---

## [Constraint for selection of Address Bits based on strobe bits](https://verificationacademy.com/forums/t/constraint-for-selection-of-address-bits-based-on-strobe-bits/42109)

<div class="topic-metadata">

**Author:** [@skyhome0911](https://verificationacademy.com/forums/u/skyhome0911)\
**Replies:** 3\
**Last updated:** [August 15, 2023, 5:54pm UTC](https://verificationacademy.com/forums/t/constraint-for-selection-of-address-bits-based-on-strobe-bits/42109 "2023-08-15T17:54:31Z")

</div>

Hi everyone, I am pretty much new in SV. I am trying write a constraint, based on strobe and valid bit, particular bits of address bits will be valid and printed. But as I understand in SV Queues, we can’t assigning in q…

---

## [Delete a particular item in a queue without using delete method](https://verificationacademy.com/forums/t/delete-a-particular-item-in-a-queue-without-using-delete-method/39369)

<div class="topic-metadata">

**Author:** [@verific\_engi](https://verificationacademy.com/forums/u/verific_engi)\
**Replies:** 7\
**Last updated:** [July 4, 2023, 2:08am UTC](https://verificationacademy.com/forums/t/delete-a-particular-item-in-a-queue-without-using-delete-method/39369 "2023-07-04T02:08:25Z")

</div>

q\[$\] = {12,3,45,23}; How to delete 45 from the queue without using delete or pop\_back methods to pop front or back items

---

## [Clearing data from queue](https://verificationacademy.com/forums/t/clearing-data-from-queue/41490)

<div class="topic-metadata">

**Author:** [@polyengineer13](https://verificationacademy.com/forums/u/polyengineer13)\
**Replies:** 1\
**Last updated:** [April 7, 2023, 8:22pm UTC](https://verificationacademy.com/forums/t/clearing-data-from-queue/41490 "2023-04-07T20:22:13Z")

</div>

What is more efficient with respect to simulation time (CPU cycles) and clearing a queue? Especially with very big queues, does it matter? task clear\_queue ; while (queue.size() \> 0) begin queue.pop\_front() ;…

---

## [Queue randomization distribution](https://verificationacademy.com/forums/t/queue-randomization-distribution/41392)

<div class="topic-metadata">

**Author:** [@sk7799](https://verificationacademy.com/forums/u/sk7799)\
**Replies:** 5\
**Last updated:** [March 19, 2023, 11:59pm UTC](https://verificationacademy.com/forums/t/queue-randomization-distribution/41392 "2023-03-19T23:59:22Z")

</div>

QUESTION: Create a system verilog class with a random queue constrained with the following conditions: 1)It should have a random number of elements between 1 and 32 2)All the elements should have a value between 0 and…

---

## [Executing a pop\_back() function call on empty queue](https://verificationacademy.com/forums/t/executing-a-pop-back-function-call-on-empty-queue/41360)

<div class="topic-metadata">

**Author:** [@asvpuneet](https://verificationacademy.com/forums/u/asvpuneet)\
**Replies:** 3\
**Last updated:** [March 9, 2023, 6:02pm UTC](https://verificationacademy.com/forums/t/executing-a-pop-back-function-call-on-empty-queue/41360 "2023-03-09T18:02:56Z")

</div>

When calling a pop\_back() function on an empty queue, the simulation doesnt fail module GRG\_queue1; typedef struct { string txt ; byte unsigned b ; int array\[\]; } T; typed…

---

## [Is it possible to use find\_index() functions to match nested queues?](https://verificationacademy.com/forums/t/is-it-possible-to-use-find-index-functions-to-match-nested-queues/41315)

<div class="topic-metadata">

**Author:** [@markiv](https://verificationacademy.com/forums/u/markiv)\
**Replies:** 10\
**Last updated:** [February 28, 2023, 5:34pm UTC](https://verificationacademy.com/forums/t/is-it-possible-to-use-find-index-functions-to-match-nested-queues/41315 "2023-02-28T17:34:14Z")

</div>

In a queue of a class/Transaction holding multiple variables and queues. Is it possible to use find\_index to search the second level of queues along with the first level? Haven’t been able to find any language in the L…

---

## [How to use queues of associative arrays?](https://verificationacademy.com/forums/t/how-to-use-queues-of-associative-arrays/40971)

<div class="topic-metadata">

**Author:** [@xujiaan](https://verificationacademy.com/forums/u/xujiaan)\
**Replies:** 1\
**Last updated:** [November 4, 2022, 2:15am UTC](https://verificationacademy.com/forums/t/how-to-use-queues-of-associative-arrays/40971 "2022-11-04T02:15:22Z")

</div>

Hi guys, I want create a hash table, use bit\[9:0\] as index to find value ( bit \[59:0\] queue ). So I think maybe I can use a queues of associative arrays. But unfortunately, I don\`t know how to use it. I tried like this…

---

## [Constraint failure while using a queue in a task](https://verificationacademy.com/forums/t/constraint-failure-while-using-a-queue-in-a-task/40800)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 2\
**Last updated:** [August 30, 2022, 9:19pm UTC](https://verificationacademy.com/forums/t/constraint-failure-while-using-a-queue-in-a-task/40800 "2022-08-30T21:19:47Z")

</div>

I use following code in my base sequence as I need this to be used in other sequences. class base\_sequence extends uvm\_sequence#(sequence\_item); \`uvm\_object\_utils(base\_sequence) //Constructor function new(strin…

---

## [What is the memory structure for a systemverilog queue](https://verificationacademy.com/forums/t/what-is-the-memory-structure-for-a-systemverilog-queue/40716)

<div class="topic-metadata">

**Author:** [@ahennawy](https://verificationacademy.com/forums/u/ahennawy)\
**Replies:** 4\
**Last updated:** [August 9, 2022, 5:49pm UTC](https://verificationacademy.com/forums/t/what-is-the-memory-structure-for-a-systemverilog-queue/40716 "2022-08-09T17:49:42Z")

</div>

Hi, in Dave’s answers in the following link, He stated that a queue in sv is implemented as a linked list. hence, he said: “and requires a traversal of elements to get to element in between the head an tail.” in the SV…

---

## [Array locator method 'find\_index' not working on a string queue](https://verificationacademy.com/forums/t/array-locator-method-find-index-not-working-on-a-string-queue/40621)

<div class="topic-metadata">

**Author:** [@Dev\_Engine](https://verificationacademy.com/forums/u/Dev_Engine)\
**Replies:** 5\
**Last updated:** [July 14, 2022, 5:12pm UTC](https://verificationacademy.com/forums/t/array-locator-method-find-index-not-working-on-a-string-queue/40621 "2022-07-14T17:12:16Z")

</div>

Hello, I’ve been having a problem with a string queue that I wish to search. Made worse by the LRM (1800-2017). Let me share what I have done. module find\_markers; string arr\[$\]; image\_tests img1(.arr(arr)); //String q…

---

## [Why I get the error: Uxexpected SystemVerilog keywork "package"?](https://verificationacademy.com/forums/t/why-i-get-the-error-uxexpected-systemverilog-keywork-package/40428)

<div class="topic-metadata">

**Author:** [@kevinvig7](https://verificationacademy.com/forums/u/kevinvig7)\
**Replies:** 1\
**Last updated:** [May 20, 2022, 10:56pm UTC](https://verificationacademy.com/forums/t/why-i-get-the-error-uxexpected-systemverilog-keywork-package/40428 "2022-05-20T22:56:50Z")

</div>

Hi! I am trying to compile my UVM code, when I get the error Uxexpected SystemVerilog keywork “package”. I was looking for a missing semicolon or some syntax error in my code, but I could not find anything. I attach m…

---

## [Record all SystemVerilog classes with Questasim](https://verificationacademy.com/forums/t/record-all-systemverilog-classes-with-questasim/40317)

<div class="topic-metadata">

**Author:** [@MrSergio](https://verificationacademy.com/forums/u/MrSergio)\
**Replies:** 1\
**Last updated:** [April 26, 2022, 11:41pm UTC](https://verificationacademy.com/forums/t/record-all-systemverilog-classes-with-questasim/40317 "2022-04-26T23:41:45Z")

</div>

Is there a way to somehow log ALL SystemVerilog classes in the testbench to wlf(waveform) file without specifying each of them manually in QuestaSim 10.7c? The question is related to a non-UVM testbench, just a regular S…

---

## [How do I declare a queue such that it's index begins from 1 and not zero?](https://verificationacademy.com/forums/t/how-do-i-declare-a-queue-such-that-its-index-begins-from-1-and-not-zero/40281)

<div class="topic-metadata">

**Author:** [@ShashankGurijala](https://verificationacademy.com/forums/u/ShashankGurijala)\
**Replies:** 1\
**Last updated:** [April 16, 2022, 5:25pm UTC](https://verificationacademy.com/forums/t/how-do-i-declare-a-queue-such-that-its-index-begins-from-1-and-not-zero/40281 "2022-04-16T17:25:27Z")

</div>

See the program I’ve tried below: module built\_in\_functions\_manual; int insert\_queue \[$\]; int i; int insert\_element; int insert\_location; initial begin insert\_queue='{4,8,98,12,34,56,76,50,90,11}; $display("\\…

---

## [How to push data in queue with $realtime](https://verificationacademy.com/forums/t/how-to-push-data-in-queue-with-realtime/39843)

<div class="topic-metadata">

**Author:** [@m\_r\_m](https://verificationacademy.com/forums/u/m_r_m)\
**Replies:** 1\
**Last updated:** [November 24, 2021, 1:01pm UTC](https://verificationacademy.com/forums/t/how-to-push-data-in-queue-with-realtime/39843 "2021-11-24T13:01:35Z")

</div>

seq\_item\_q qu\[$\]; function write\_scb(seq\_item obj); env\_ptr.scb\[agt\_num\].qu.push\_back(obj); // env\_ptr represent env\[i\] // based on agt\_num pushing to queue and // retrieving from the queue based on the agt\_num endfu…

---

## [QUEUE](https://verificationacademy.com/forums/t/queue/39648)

<div class="topic-metadata">

**Author:** [@poonamnlwd](https://verificationacademy.com/forums/u/poonamnlwd)\
**Replies:** 4\
**Last updated:** [October 11, 2021, 12:02pm UTC](https://verificationacademy.com/forums/t/queue/39648 "2021-10-11T12:02:40Z")

</div>

I have queue which is having elements multiple of 16. Ex 256. But I have to take 16 element from queue and process that. After processing first 16 elements , I need to take next 16 elements from queue and process until a…

---

## [For Serial protocol, Why need data field in dynamic array or queue instead of normal vector in transaction class?](https://verificationacademy.com/forums/t/for-serial-protocol-why-need-data-field-in-dynamic-array-or-queue-instead-of-normal-vector-in-transaction-class/39297)

<div class="topic-metadata">

**Author:** [@Kashyap\_14](https://verificationacademy.com/forums/u/Kashyap_14)\
**Replies:** 0\
**Last updated:** [July 10, 2021, 8:53am UTC](https://verificationacademy.com/forums/t/for-serial-protocol-why-need-data-field-in-dynamic-array-or-queue-instead-of-normal-vector-in-transaction-class/39297 "2021-07-10T08:53:20Z")

</div>

hi… as shown below, I give two options for transection which one batter for a serial protocol like I2S or I2C or any other? why? 1) define size 32 class trasaction; rand \[size-1:0\]r\_data; rand \[size-1:0\]l\_data\[\]; end…

---

## [Cyclic randomization behavior without 'randc' keyword](https://verificationacademy.com/forums/t/cyclic-randomization-behavior-without-randc-keyword/38678)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 6\
**Last updated:** [February 5, 2021, 4:16am UTC](https://verificationacademy.com/forums/t/cyclic-randomization-behavior-without-randc-keyword/38678 "2021-02-05T04:16:20Z")

</div>

Can anyone give an idea on how to bring cyclic randomization without using randc keyword and queue/array as for reference Common methods for genearting cyclic randomization is Using randc keyword using a queue/array…

---

## [Last pushback in queue in scoreboard write method, overriding all values in queue](https://verificationacademy.com/forums/t/last-pushback-in-queue-in-scoreboard-write-method-overriding-all-values-in-queue/38447)

<div class="topic-metadata">

**Author:** [@cahuja](https://verificationacademy.com/forums/u/cahuja)\
**Replies:** 3\
**Last updated:** [December 9, 2020, 6:39pm UTC](https://verificationacademy.com/forums/t/last-pushback-in-queue-in-scoreboard-write-method-overriding-all-values-in-queue/38447 "2020-12-09T18:39:31Z")

</div>

I have a monitor and a scoreboard connected through uvm\_analysis\_port/imp. I am sampling some values in the monitor and using the write function to transport those to the scoreboard. The scoreboard is also getting those …

---

## [Use regular expression in systemverilog to remove "anything start with some predefined letter "](https://verificationacademy.com/forums/t/use-regular-expression-in-systemverilog-to-remove-anything-start-with-some-predefined-letter/37660)

<div class="topic-metadata">

**Author:** [@AlokMandal](https://verificationacademy.com/forums/u/AlokMandal)\
**Replies:** 1\
**Last updated:** [June 2, 2020, 4:52pm UTC](https://verificationacademy.com/forums/t/use-regular-expression-in-systemverilog-to-remove-anything-start-with-some-predefined-letter/37660 "2020-06-02T16:52:40Z")

</div>

Hi everyone, i have one queue of string, i want to remove "anything which start with UVM ". for example UVM\_VERBOSITY,UVM\_TESTNAME etc. i know how to do it using perl because it supports regular expression very well. b…

---

## [System verilog FIFO](https://verificationacademy.com/forums/t/system-verilog-fifo/37597)

<div class="topic-metadata">

**Author:** [@Design\_Engineer](https://verificationacademy.com/forums/u/Design_Engineer)\
**Replies:** 5\
**Last updated:** [May 26, 2020, 10:16am UTC](https://verificationacademy.com/forums/t/system-verilog-fifo/37597 "2020-05-26T10:16:43Z")

</div>

How to verify the functionality of FIFo using Queue methods?

---

## [Queue](https://verificationacademy.com/forums/t/queue/37609)

<div class="topic-metadata">

**Author:** [@Design\_Engineer](https://verificationacademy.com/forums/u/Design_Engineer)\
**Replies:** 7\
**Last updated:** [May 22, 2020, 1:44am UTC](https://verificationacademy.com/forums/t/queue/37609 "2020-05-22T01:44:14Z")

</div>

module queue; int q\[$\]; initial begin q={1,2,3,4}; $display("queue=%p",q); foreach(q\[i\])begin q.pop\_back(); $display("pop\_back values =%p",i,q); end end endmodule Output: # KERNEL: queue…

---

## [Find index in 2D array using find\_index](https://verificationacademy.com/forums/t/find-index-in-2d-array-using-find-index/37317)

<div class="topic-metadata">

**Author:** [@amitgarg](https://verificationacademy.com/forums/u/amitgarg)\
**Replies:** 1\
**Last updated:** [March 15, 2020, 8:28pm UTC](https://verificationacademy.com/forums/t/find-index-in-2d-array-using-find-index/37317 "2020-03-15T20:28:35Z")

</div>

Hi, i am trying to find the two dimensional index of array whose value matches to 1. i am looking for array method like find\_index can be used for the same. i can easily accomplish the same with foreach loop but would …

---

## [Executing code after a particular point, bin has been hit](https://verificationacademy.com/forums/t/executing-code-after-a-particular-point-bin-has-been-hit/36826)

<div class="topic-metadata">

**Author:** [@rgarcia07](https://verificationacademy.com/forums/u/rgarcia07)\
**Replies:** 1\
**Last updated:** [November 21, 2019, 4:20pm UTC](https://verificationacademy.com/forums/t/executing-code-after-a-particular-point-bin-has-been-hit/36826 "2019-11-21T16:20:10Z")

</div>

Hello, I was wondering if there is any way to know when a particular bin(s) have been hit and after that calling your own code to do something. Something like generating an event once you hit set of bins, I know you can…

---

## [Delete an element from queue by name](https://verificationacademy.com/forums/t/delete-an-element-from-queue-by-name/36749)

<div class="topic-metadata">

**Author:** [@amitgarg](https://verificationacademy.com/forums/u/amitgarg)\
**Replies:** 4\
**Last updated:** [November 10, 2019, 7:06pm UTC](https://verificationacademy.com/forums/t/delete-an-element-from-queue-by-name/36749 "2019-11-10T19:06:24Z")

</div>

Hi, i want to delete an element from queue. the delete method requires an index to delete the element. i know the value which i want to delete. How can it be done ? string queue\_2\[$\]; initial begin queue\_2 = {“Red”…
