You are on page 1of 2

High Level Verification with SystemVerilog SV Datatype

SV Datatype Lab Exercise


Lab 6: Queue
Abhishek Kumar Singh | EVD18I031

Problem Statement
Given the following code, determine what will be displayed.

`default_nettype none
module test;
string street[$] = {"Tejon", "Bijou", "Boulder"};
initial begin
$display("Street[0] = %s", street[0]);
street.insert(2, "Platte");
$display("Street[2] = %s", street[2]);
street.push_front("St. Vrain");
$display("Street[2] = %s", street[2]);
$display("pop_back = %s", street.pop_back);
$display("street.size = %d", street.size);
end
endmodule
// test

Goal: write SV code, simulate and verify manually. Submit your SV code and log

Solution
1. Tejon. (Queue: Tejon, Bijou, Boulder)
2. Platte. (Queue: Tejon, Bijou, Platte, Boulder)
3. Bijou. (Queue: St. Vrain, Tejon, Bijou, Platte, Boulder)
4. Boulder. (Queue: St. Vrain, Tejon, Bijou, Platte)
5. 4.

Simulation
`default_nettype none

1
High Level Verification with SystemVerilog SV Datatype

module test;
string street[$] = {"Tejon", "Bijou", "Boulder"};
initial begin
$display("Street[0] = %s", street[0]);
street.insert(2, "Platte");
$display("Street[2] = %s", street[2]);
street.push_front("St. Vrain");
$display("Street[2] = %s", street[2]);
$display("pop_back = %s", street.pop_back);
$display("street.size = %d", street.size);
end
endmodule
// test

Log:
[2022-03-20 14:18:39 UTC] xrun -Q -unbuffered '-timescale' '1ns/1ns' '-sysv' '-access'
'+rw' design.sv testbench.sv
TOOL: xrun 20.09-s003: Started on Mar 20, 2022 at 10:18:39 EDT
xrun: 20.09-s003: (c) Copyright 1995-2020 Cadence Design Systems, Inc.
Top level design units:
test
xmelab: *W,DSEMEL: This SystemVerilog design will be simulated as per IEEE 1800-2009
SystemVerilog simulation semantics. Use -disable_sem2009 option for turning off SV
2009 simulation semantics.
Loading snapshot worklib.test:sv .................... Done
xmsim: *W,DSEM2009: This SystemVerilog design is simulated as per IEEE 1800-2009
SystemVerilog simulation semantics. Use -disable_sem2009 option for turning off SV
2009 simulation semantics.
xcelium> source /xcelium20.09/tools/xcelium/files/xmsimrc
xcelium> run
Street[0] = Tejon
Street[2] = Platte
Street[2] = Bijou
pop_back = Boulder
street.size = 4
xmsim: *W,RNQUIE: Simulation is complete.
xcelium> exit
TOOL: xrun 20.09-s003: Exiting on Mar 20, 2022 at 10:18:41 EDT (total: 00:00:02)
Done

★★★

You might also like