SystemVerilog and Verification Slides
SystemVerilog and Verification Slides
SystemVerilog and
Verification
Cody Rigby
Department of Electrical and Computer Engineering
Topics
What is SystemVerilog
Differences from VHDL
Features
Verification Concepts
Assertions
Coverage
Department of Electrical and Computer Engineering
SystemVerilog
Hardware Description and Verification Language (HDVL) combines features of HDL’s with features from C and C++
Borrows features from Verilog Superlog, VHDL, PSL, C, Vera,
Most of the verification functionality is based on the OpenVera language by Synopsys
Adopted as IEEE standard in 2005, most current version is IEEE standard 1800-2017
Can be used to describe hardware behavior but typically used for verification
SystemVerilog is an Object Oriented language that supports a single-inheritance model
Verification features allow for complex testbenching and random stimuli in simulation
Department of Electrical and Computer Engineering
SystemVerilog VHDL
C-style data types 7 control –enum, struct, typedef, ++ break return Yes
Packages Yes
RTL Synthesis –friendly “concise” RTL notation No
Interfaces No
Assertions Systemverilog Assertions Yes
Clocking Blocks No
Object Oriented Programming –Classes No
Test Bench Constrained random stimulus generation No
Function Coverage No
Dynamic Processes, Dynamic arrays, queues, mailboxes, semaphores No
DPI Direct Programming Interface(DPI) –calling C from Systemverilog Yes
Department of Electrical and Computer Engineering
SystemVerilog Types
wire : acts like real write in circuits
reg : holds values until another value is assigned, like register in hardware
real, shortreal : single and double precision floating point numbers
Time : 64 bit quantity used to hold simulation time
Logic : improved version of reg from Verilog to SystemVerilog, can be driven by continuous
assignments, gates and modules in addition to being a variable
Two State Types : byte, bit, int, shortint, longint : improved performance and memory usage
event : event is a handle to a synchronization object that can be passed around to routines,
SystemVerilog introduces triggered function that lets you check whether an event has been
triggered
Department of Electrical and Computer Engineering
Vector width/dimensions declared before the object name referenced as packed array, array size/dimensions declared
after object name is refereed as unpacked array
Dynamic Arrays : one dimension of an unpacked array whose size can be set or changed at run-time
data_type array_name [ ];
data_type is the data type of the array elements.
Methods for Dynamic Arrays
new[ ] --> allocates the storage.
size( ) --> returns the current size of a dynamic array.
delete( ) --> empties the array, resulting in a zero-sized array.
Department of Electrical and Computer Engineering
Mailboxes: mechanism to exchange messages between processes, data can be sent to a mailbox by one process and
retrieved by another. Very effective in testbenches to transfer packets of data between modules
Department of Electrical and Computer Engineering
Processes
Fork-join : will start all the Fork-Join_any will be un-blocked Fork-Join_none does not wait for
processes inside it in parallel after the completion of any of the completion of Process inside
and wait for the completion of the Process the fork-join_none before
all processes following processes are executed
Department of Electrical and Computer Engineering
Classes
User defined data type
that includes data,
functions, and tasks
that operate on data.
Classes allow objects
to be dynamically
created, deleted assig
and accessed via object
handles.
Department of Electrical and Computer Engineering
Modules
Basic building block that can be used in design or verification.
Constructing a Basic
Testbench Topology
in SystemVerilog
Department of Electrical and Computer Engineering
Department of Electrical and Computer Engineering
Transaction Class
Field required to generate stimulus are
declared in transaction class
Transaction class can also be used as
placeholder for the activity monitored
by monitor on DUT signals
Generator sends transactions to be
interpreted by the driver to provide
stimulus to the DUT through the
interface
Monitor interprets outputs of the DUT
into transactions then pushes them to
the scoreboard
Department of Electrical and Computer Engineering
Interface
Systemverilog construct to
encapsulate communication
between modules
Can contain modports which
provides direction information for
module interface ports and controls
the uses of tasks and functions
within certain modules
Shared by multiple entities (driver,
monitor, etc.)
Department of Electrical and Computer Engineering
Driver
Driver Class receives the
stimulus from a
generator in the form of
a transaction through a
shared mailbox
Driver converts
transaction level data to
signal level activity
Department of Electrical and Computer Engineering
Monitor
Samples the Interface
signals and convert
signal level activity to
transaction level
Sends transaction to
scoreboard via
mailbox
Department of Electrical and Computer Engineering
Score Board
Scoreboard receives the sampled transaction from the monitor
Generator
Generates transactions that will be translated into stimulus for the DUT
Environment
Contains instances of the
generator, driver, monitor, and
scoreboard, connects generators
to drivers and monitors to
scoreboard with mailboxes, and
provides instance of the interface
to all
UVM SystemVerilog
Universal Verification Methodology
Provides framework for modular and layered verification components
Developed and maintained by Accellera
Consists of class libraries that allow for robust, reusable verification
environments
Used widely in industry for RTL verification
Department of Electrical and Computer Engineering
Department of Electrical and Computer Engineering
UVM Features
Sequences : UVM gives comprehensive control on stimulus, can be developed by
randomization, layered sequences, virtual sequences etc. (sequences of transactions)
Configuration class : database where all the parameters for the testbench hierarchy are
located
Department of Electrical and Computer Engineering
Verification Concepts
Simulation Verification : Verify that design meets spec for a given
input stimuli
Formal Verification : Verify that design meets spec for any valid
input stimuli
Equivalence Checking
Model Checking
Department of Electrical and Computer Engineering
Model Checking
Given a model of a system, exhaustively and automatically check
whether this model meets a given specification as described by
assertions
Assertions are provided by the user that describe legal or illegal
behavior
Assertions include coverage properties that help ensure thoroughness
of verification
How to do this ? SystemVerilog Assertions (SVA)
Department of Electrical and Computer Engineering
Types of Assertions
Concurrent assertions must always be satisfied by a design.
4 Layers:
Boolean Expression Layer : evaluates a single expression to be true or false
Sequence Layer : sequence of Boolean expressions over time
Property Layer : defines a behavior of the design defined elsewhere
Assertion Layer : asserts the property
Department of Electrical and Computer Engineering
Example :
sequence seq;
a ##2 b;
endsequence
property p;
@(posedge clk) seq;
endproperty
a_1 : assert property(p);
Department of Electrical and Computer Engineering
Coverage:
Coverage is used to measure tested and untested portions of the design. Defined by the
percentage of objective that have been met
Two Types :
Code Coverage:
How much of the design code is exercised, Number of lines, conditions, States in FSM,
paths taken etc.
Functional Coverage:
User defined metric:
Data-oriented : values of inputs and outputs
Control-oriented Coverage : checks for sequences of behaviors
Department of Electrical and Computer Engineering
SVA Coverage
Defined by creating coverage points using the covergroup construct
References
https://www.verificationguide.com/
Department of Electrical and Computer Engineering