Exploring some more advanced verification constructs
The testing we have done thus far has been pretty simple, even when we used self-checking. There is one construct that I have found very useful over the years. The queue is easy to use and understand.
Introducing SystemVerilog queues
Often, you need to generate an input in a design that will produce an expected output some time later. Examples of this are parsing engines, data processing engines, and, as we saw in Chapter 9, A Better Way to Display – VGA, the PS/2 interface.
When I modified the ps2_host
module, I decided to upgrade the testbench for it using queues. I had to create a structure to define what I wanted to store in the queue:
typedef struct packed   {    logic [7:0] data;    logic       parity;   } ps2_rx_data_t;
This structure will store our expected data as we generate data in the ps2_host
for testing.
A queue...