
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Keeping Up with Chip — the Proposed SystemVerilog 2012 Standard Makes
Verifying Ever-increasing Design
Complexity More Efficient Stuart Sutherland, Sutherland HDL, Inc.
Tom Fitzpatrick, Mentor Graphics Corporation
L
H
D
Sutherland
www.sutherland-hdl.com Training Engineers to be SystemVerilog wizards
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
2 of 24
About the Authors ^
Stuart Sutherland^
Has been using Verilog since 1988
Involved in IEEE Verilog/SystemVerilog standards since inception
Technical editor of every generation of Verilog and SystemVerilogLanguage Reference Manuals
Author of books on Verilog, SystemVerilog and Verilog PLI
Tom Fitzpatrick
Verification Technologist at Mentor Graphics Corp
20+ of design and verification experience
Involved in the standardization of SystemVerilog
One of the original designers of AVM and OVM
Editor of Verification Horizons, a quarterly newsletter
Published articles and papers about verification methodologies
Sutherland HDL helpsengineers become trueSystemVerilog wizards!
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
4 of 24
A Brief History Lesson… ^
Verilog (IEEE standard 1364)^
Began in 1983 as a proprietary language
Opened to the public in 1992
Became an IEEE standard in 1995 (updated in 2001 and 2005)
Between 1983 and 2005 design sizes increased dramatically!
SystemVerilog (IEEE standard 1800)
Originally intended to be the 2005 update to Verilog
Contains hundreds of enhancements and extensions to Verilog
Published in 2005 as a separate document
Officially superseded Verilog in 2009
For a summary of new features added in SV-2009, see the DAC-
2-part presentation by Stuart Sutherland and Cliff Cummings
(available at www.sutherland-hdl.com and www.sunburst-design.com)
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
5 of 24
Mile High View ofSystemVerilog-2012 ^
Design size and complexity continues to grow^
And grow and grow…
SystemVerilog is keeping pace (keeping up with Chip – your chip!)
IEEE began work on SV-2012 as soon as SV-2009 was complete
Work on specifying SV-2012 was finished in January 2012
IEEE balloting process began mid February 2012
In a nut shell…
31 new features
added to the language
60 clarifications to existing language features
71 corrections (typos, English grammar, punctuation, etc.)
Dozens of minor editorial corrections (font usage, punctuation)
The focus of this paper is on the 31 new language features, and how those featurescan help make writing complex verification testbenches simpler or more efficient
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
7 of 24
Nonblocking Assignmentsto Class Properties ^
Before…^
Class properties could not be assigned using nonblocking assigns
Nonblocking assignments are useful in verification code
Can prevent race conditions between the testbench and the DUT
SystemVerilog-
Removes the restriction about using nonblocking assignments
Allows verification engineers to take full advantage ofSystemVerilog’s event scheduling rules
class base_trans;
int data;bit resetN; endclassinitial begin
t.resetN <= 0;
// assert reset in NBA event region
Nonblocking assignment used to ensure
DUT won’t miss a power-up reset
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
8 of 24
interface class Put;
pure virtual function void put(int a); endclassinterface class Get;
pure virtual function int get(); endclassclass Fifo implements Put, Get;
... // implementations of inherited methods endclass
An “interface” class can contain: •^
Parameter constants
-^
User-defined types (typedefs)
-^
Pure virtual method prototypes
-^
A regular class can “implement”one or more interface classes
Inherit prototypes from multiple parents
The full paper discusses someways this new feature might be
useful for a UVM testbench
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
10 of 24
Uniqueness Constraints ^
Before…^
There was no simple way to specify constraints so that severalvariables — or all the members of an array — had differentrandom values and none had the same value
SystemVerilog-
Adds a uniqueness constraint that where all variables in a list or anarray receive unique values class Transaction;
rand int
a, b, c;
rand byte data_array[16];constraint c1 {
unique
{a,b,c}; }
constraint c2 {
unique
{data_array}; }
endclass
Constraint c2 ensures that when random values are generated, every
element of data_array will have a
different value
Constraint c1 ensures that, whenrandom values are generated, thevalues of a, b and c will be different
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
11 of 24
Parameterized Methods /Parameterized Types ^
Before…^
Module and class parameters could be redefined for each instance
Task/function instances could not have different parameter values
Required writing many versions of the same task or function
SystemVerilog-
Allows static class methods to be “specialized” with uniqueparameter values each time the method is used
virtual class C #(parameter DECODE_W, localparam
ENCODE_W=$clog2(DECODE_W));
static function
decoder_f
(input [ENCODE_W-1:0] EncodeIn);
endfunction endclassmodule test;
decoder_1 =
C#(4)::decoder_f(2'b11);
decoder_2 =
C#(8)::decoder_f(3'b100);
Redefine DECODE_W value for each instance of decoder_f method
Each instance of a parameterized user-defined type can be specialized
in a similar way
Strictly speaking, these are “clarifications” in the standard, not new features
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
13 of 24
Var Type() in For-Loops /Ref Args with Dynamic Arrays ^
Before…^
The data type of a for-loop iterator had to be hard-coded
SystemVerilog-
The type() function can be used to declare the iterator variable paramenter
logic [SIZE-1:0] a, b;for (var type({a,b})
i; i<=255; i++) ...
Before…
A task/function ref argument could only point to fixed-sized arrays
SystemVerilog-
Adds ability for ref arguments to point to dynamically-sized arrays
If SIZE is not redefined, i will bedeclared as a logic [128:0] type
-^
If SIZE is redefined, variable i willadjust accordingly
task put_data (input value,
ref d[$]
d.push_back(value); endtask
int data_q[$];always @(posedge clock)
put_data(data,
data_q);
pass a queue to a task
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
14 of 24
$countbits System Function /`begin_keywords 1800-2012 ^
Before…^
The $countones function returned the number of bits set to 1
There was no easy way to count the number of bits set to 0, X or Z
SystemVerilog-
Adds a $countbits function that returns the number of bits set to alist of values
Before…
The words
implements
,^
interconnect
,^
nettype
, and
soft
had no special meaning in the language
SystemVerilog-
Reserves these four words as keywords
Adds an 1800-2012 argument to the `begin_keywords directive
Existing code that uses any of these new keywords should specify `begin_keywords 1800-
$error("data has %0d bits with X or Z",
$countbits (data, 'x, 'z)
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
16 of 24
Coverpoint Variables /bins…with() Construct /Coverage Functions ^
Before…^
Coverpoint labels could not be used in expressions
Coverage expressions could not call functions
Coverage bins could not easily exclude specific values
SystemVerilog-
Coverpoint labels are variables that can be used in expressions
Coverage expressions can call functions (eliminates duplicatecode used by multiple coverpoints)
A bins...with() construct can be used to exclude values in a bin thatwould not be of interest in a test
a: coverpoint data {
bins
mod16[] = {[0:255]}
with
(item
mod16 only tracks values that
are evenly divisible by 16(“item” is a variable that is built into bins…with() )
These 3 enhancements can help improve run-
time performance!
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
17 of 24
Assertion Data Types /Sampled Value Data Types ^
Before…^
Assertions were limited to testing simple, integral values
SystemVerilog-
Assertions can now test real (floating point) values and dynamicarrays (such as strings and queues) and static class properties
Before…
Value sampling functions, such as $sample() were limited totesting simple, integral values
SystemVerilog-
Value sampling functions can now test real values and dynamicarrays (e.g.: strings and queues) and static class properties
byte q[$];property p1;
$rose(write) |->
q[0];
endproperty
A dynamic queue array
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
19 of 24
Inferred Clocks in Sequences /Sequence Method Expressions ^
Before…^
An assertion sequence only infers a clock when used in a property
SystemVerilog-
Sequences can infer a clock in other contexts
Before…
The triggered and matched sequence methods could only be usedon instances of a sequence
SystemVerilog-
Sequence methods can also be used with a sequence expression
checker check_mutex(input sequence s1,
input cond,event clk=$inferred_clock);
default clocking cb @clk; endclockinglet r =
s1.triggered;
a1: assert property (cond |=> r); endchecker
Not allowed in SV-
-
©2012 Stuart Sutherland – Sutherland HDL, Inc. – www.sutherland-hdl.com
20 of 24
Final Deferred ImmediateAssertions ^
Before…^
Immediate assertions
can have glitches within a moment in time
SystemVerilog-2009’s
deferred immediate assertions
reduce the
risk of glitches but do not eliminate them
SystemVerilog-
Adds
final deferred immediate assertions
that eliminate all glitches
always_comb
assert #
(!$isunknown state) else begin
err_cnt++;$error("bad state"); end
Processed in the Reactiveevent region
-^
Can execute any type ofprogramming statements
Deferred Immediate Assertion
Processed in the Postponedevent region
-^
Can only execute a singleprint statement
-^
Cannot contain begin…end
always_comb
assert final
(!$isunknown state)
else $error("bad state");
Final Deferred Immediate Assertion