Array
(
    [content] => 
    [params] => Array
        (
            [0] => /forum/threads/system-verilog-queues-which-can-shrink-and-grow.2815/
        )

    [addOns] => Array
        (
            [DL6/MLTP] => 13
            [Hampel/TimeZoneDebug] => 1000070
            [SV/ChangePostDate] => 2010200
            [SemiWiki/Newsletter] => 1000010
            [SemiWiki/WPMenu] => 1000010
            [SemiWiki/XPressExtend] => 1000010
            [ThemeHouse/XLink] => 1000970
            [ThemeHouse/XPress] => 1010570
            [XF] => 2021770
            [XFI] => 1050270
        )

    [wordpress] => /var/www/html
)

System Verilog Queues which can shrink and grow !

Dear Readers,

System Verilog has new data type called ‘queue’ which can grow and shrink. With SV queue, we can easily add and remove elements anywhere that is the reason we say it can shrink and grow as we need. Queues can be used as LIFO (Last In First Out) Buffer or FIFO (First In First Out) type of buffers.

Each element in the queue is identified by an ordinal number that represents its position within the queue, with 0 representing the first element and $ represents the last element.

The size of the queue is variable similar to dynamic array but queue may be empty with zero element and still its a valid data structure.


Lets take a few examples to understand queue operation with different methods we have in system verilog.


###############################################
int a;
Q[$] = {0,1,2,3}; // Initial queue


initial begin
//Insert and delete
Q.insert (1, 1); // This means insert 1 at first element in the queue which becomes {0,1,1,2,3}
Q.delete(2); // This means delete 2[SUP]nd[/SUP] element from the queue. {0,1,2,3}


//Push_front
Q.push_front (6); //Insert ‘6’ at front of the queue. {6,0,1,2,3}


//Pop_back
a = Q.pop_back; // Poping the last element and stored it to local variable ‘a’, a = 3 in this case. Resultant Queue = {6,0,1,2}


//push_back
Q.push_back(7) // Pushing the element ‘7’ from the back. {6,0,1,2,7}

//Pop_front:
a =Q.pop_front; Poping the first element and stored it to local variable called ‘a’, a=6 in this case. Resultant Queue = {0,1,2,7}


end
#####################################################


When you create a queue System Verilog actually allocates extra space and because this we can add and remove the element based on need in our test bench. This is very useful feature in test bench implementation. System Verilog automatically allocates the additional space so we don't need to worry about the limits and queue will not run out of space.


Queue is very useful data type in System Verilog for developing a test benches. It can be used in development of various entity in the test bench like scoreboard, monitor, transaction class, drivers etc.


Hope this helps in basic understanding of queue and its methods.


Happy Reading!
ASIC With Ankit
 
Steve Grout • A "queue" is a necessary element for any HDL, whether used at the low gate/RTL level or at the system/ESL level.
However, what you really want is a "Virtual Memory" element, with unlimited and/or automatic-unlimited width, depth, and structure (bit/byte/word/file/file-system) definition, including automatic definition as an index-sequential ("ISP") file-system element.

I added such an element to both our HDL (an extension of Yahaon Chu's HDL) and to our Muser database with its "Lats" digital simulator, in about 1973, as part of the Muser-based Honeywell Large Systems design system. A "virtual memory" element had to be included so that our system architects and lower-level design groups could do that design work of the various Honeywell H600, Level66, and Level 88 design blocks they were working on, without having first to also do a finite design portion of the ISP file system the major cabinets/blocks were used in.

Thanks to the Honeywell file system being hardware-transparent (any collection of hard drives,tape handlers, bubble memories, et.al., looked to the user like 'a file' or directory of files - So we (me) in EDA had to early on provide HDL and Muser database elements with those same properties, hence the "virtual memory" element.

I'm not sure if either Fred Christley's or Marv Wold's paper on our Honeywell/Honeywell-Bull design technology ever mentioned this particular development.
Defining a "queue" then was a typical definition and use of the "virtual memory" element.
Hope this helps, --Steve Grout
 
Thanks Steve for sharing your valuable comments!

Lots of useful information with knowledge on history, it always good to know the history and great experience from people like you.

Thanks for your sharing your experience.

Regards,
Ankit
ASIC With Ankit
 
Back
Top