SystemVerilog Veriflcation
SystemVerilog Veriflcation
SystemVerilog
This Presentation will…
Books :
1. Writing Testbenches using SystemVerilog
- Janick Bergeron
2. Verification Methodology Manual
- Janick Bergeron
3. SystemVerilog For Verification
- Chris Spear
What is SystemVerilog?
What is SystemVerilog?
SystemVerilog is a hardware description and Verification
language(HDVL)
SystemVerilog is an extensive set of enhancements to IEEE
1364 Verilog-2001 standards
It has features inherited from Verilog HDL,VHDL,C,C++
Adds extended features to verilog
What is SystemVerilog?
Verilog
Verilog SystemVerilog
System Verilog
Final block
Imported functions
Exported functions
Queue Covergroup
Mailbox Program
Fork/join Virtual interface
Class Clocking Block
Constraint modports
Verification Targeted Capabilities
Verification environment
Checks
Checks Testbench
Testbench Verification
Verification
correctness
correctness Environment
Creates Environment
Creates
stimulus
stimulus
Identifies
Identifies
Executes Test Self Check transactions
transactions
Executes
transactions
transactions
Transactor Checker Observes
Observes
Supplies
Supplies data
data data
data
to
to the
the DUT
DUT from
from DUT
DUT
Driver Assertions Monitor
DUT
Verification targeted capabilities
Verilog
Verilog SystemVerilog
System Verilog
classes encapsulation
OOP
polymorphism inheritance
What is OOP?
Why system
Verilog?
C++
C++ SystemVerilog
System Verilog
• Data members(properties)
• New Methods
Advantages
Directed
Directed Random
Random
Constrained Randomization
Improves the result
Speed-up the bug finding process
More interesting cases can be achieved within the
constrained boundary
Assertions
Assertion
Books :
1. Writing Testbenches using SystemVerilog
- Janick Bergeron
2. Verification Methodology Manual
- Janick Bergeron
3. SystemVerilog For Verification
- Chris Spear
We will discuss…
Queue Covergroup
Mailbox Program
Fork/join Interface
Semaphore Clocking Block
Constraint modports
Queue…
mailbox
put() get()
Mailbox
mailbox
mailbox mbx;
mbx;
mbx
mbx == new();
new();//
// allocate
allocate mailbox
mailbox
mbx.put(data);
mbx.put(data); //
// Put
Put data
data object
object into
into mailbox
mailbox
mbx.get(data);
mbx.get(data); //// data
data will
will be
be updated
updated with
with data
data from
from FIFO
FIFO
success
success == mbx.try_get(ref
mbx.try_get(ref data);
data); // // Non-blocking
Non-blocking version
version
mbx.peek(data);
mbx.peek(data); //
// Look
Look but
but don’t
don’t remove
remove
count
count == mbx.num();
mbx.num(); //
// Number
Number of
of elements
elements in
in mailbox
mailbox
Fork/join
Fork/join
Initial
Begin
Clk =0;
fork
#5
Fork
#5 a = 0;
#10 b = 0;
Clk becomes 1
join Join at t=15
Clk= 1;
end
Fork/join
Fork/join_any
Initial
Begin
Clk =0;
fork
#5
Fork
#5 a = 0;
#10 b = 0;
Clk becomes 1
Join_any Join_any at t=10
Clk= 1;
end
Fork/join
Fork/join_none
Initial
Begin
Clk =0;
fork
#5
Fork
#5 a = 0;
#10 b = 0;
Clk becomes 1
Join_none at t=5
Join_none
Clk= 1;
end
Semaphore
Covergroup
Covergroup check
check @(posedge
@(posedge top.valid
top.valid );
);
coverpoint
coverpoint global;
global;
coverpoint
coverpoint top.test;
top.test;
endgroup:check
endgroup:check
………………
………………
check
check chk
chk == new();
new();
Program Block
Benefits:
• Encapsulates the testbench
• Separates the testbench from the DUT
• Provides an entry point for execution
• Creates a scope to encapsulate program-wide data
Functionality:
• Can be instantiated in any hierarchical location
Typically at the top level
• Ports can be connected in the same manner as any
other module
• Executes in the SV reactive region
Program Block
The testbench (program) runs separately
from design (module)
• Triggered by clock
• Samples just before clock edge, drives just after clock
clock
Design
Testbench
Sampl Drive
e output
inputs s
Interface
Interface:An example
Interface
Interface bus_a
bus_a (input
(input clock);
clock);
logic
logic [7:0]
[7:0] address;
address;
logic
logic [31:0]
[31:0] data
data ;;
bit
bit valid
valid ;;
bit
bit rd_wr
rd_wr ;;
Endinterface:
Endinterface: bus_a
bus_a
Clocking Block