An Introduction to SystemVerilog.

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Chapter 15:Introduction to Verilog Testbenches Objectives In this section,you will learn about designing a testbench: Creating clocks Including files Strategic.
Simulation executable (simv)
Combinational Logic.
by Adiel Khan Staff CAE Synopsys
Lecture 12 Latches Section , Block Diagram of Sequential Circuit gates New output is dependent on the inputs and the preceding values.
MotoHawk Training Model-Based Design of Embedded Systems.
Design For Verification Synopsys Inc, April 2003.
1 Assertion Based Verification 2 The Design and Verification Gap  The number of transistors on a chip increases approximately 58% per year, according.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Educational Computer Architecture Experimentation Tool Dr. Abdelhafid Bouhraoua.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
C++ fundamentals.
Design Synopsys System Verilog API Donations to Accellera João Geada.
Overview Logistics Last lecture Today HW5 due today
CSET 4650 Field Programmable Logic Devices
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
ECE 2372 Modern Digital System Design
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
ASIC/FPGA design flow. FPGA Design Flow Detailed (RTL) Design Detailed (RTL) Design Ideas (Specifications) Design Ideas (Specifications) Device Programming.
Some Course Info Jean-Michel Chabloz. Main idea This is a course on writing efficient testbenches Very lab-centric course: –You are supposed to learn.
New and active ways to bind to your design by Kaiming Ho Fraunhofer IIS.
Using Formal Verification to Exhaustively Verify SoC Assemblies by Mark Handover Kenny Ranerup Applications Engineer ASIC Consultant Mentor Graphics Corp.
SoC Verification HW #2 TA: Wei-Ting Tu Assignment: 04/12/06
System Verilog Testbench Language David W. Smith Synopsys Scientist
1 H ardware D escription L anguages Modeling Digital Systems.
Verilog Language Concepts
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
EE694v-Verification-Lect10-1- Lect 10 - Stimulus & Response Applying input stimulus to a design Creating clock signals Other waveforms Synchronizing inputs.
SystemVerilog. History Enhancement of Verilog Enhancement of Verilog 2002 – accellera publishes SystemVerilog – accellera publishes SystemVerilog.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
1 Extending FPGA Verification Through The PLI Charles Howard Senior Research Engineer Southwest Research Institute San Antonio, Texas (210)
3/4/20031 ECE 551: Digital System Design * & Synthesis Lecture Set 3 3.1: Verilog - User-Defined Primitives (UDPs) (In separate file) 3.2: Verilog – Operators,
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
SVA Encapsulation in UVM enabling phase and configuration aware assertions by Mark Litterick Verification Consultant Verilab GmbH, Munich, Germany.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
Introduction to ASIC flow and Verilog HDL
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
Verification Presentation to SystemVerilog Basic Committee Peter Flake Nov 15, 2002.
Structural Description
Hardware Description Languages: Verilog
ASIC Design Methodology
IAY 0600 Digitaalsüsteemide disain
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
Digital System Verification
Hardware Description Languages: Verilog
FPGA Implementation of Multicore AES 128/192/256
CoCentirc System Studio (CCSS) by
Hardware Description Languages
SYNTHESIS OF SEQUENTIAL LOGIC
ECE-C662 Introduction to Behavioral Synthesis Knapp Text Ch
SystemVerilog for Verification
SystemVerilog and Verification
Presentation transcript:

An Introduction to SystemVerilog

Prime goal is to make you understand the significance of SystemVerilog This Presentation will… Define what is “SystemVerilog” Provide an overview of the major features in “SystemVerilog” How it’s different from other languages Prime goal is to make you understand the significance of SystemVerilog

References Websources: Books : 1. www.systemverilog.org 2. www.asic-world.com/systemverilog/index.html 3. http://svug.org/ 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? System verilog is the superset of verilog It supports all features of verilog plus add on features It’s a super verilog additional features of system verilog will be discussed

Why SystemVerilog ?

Why SystemVerilog? Constrained Randomization Easy c model integration OOP support New data types ie,logic System Verilog Assertions Coverage support Narrow gap b/w design & verification engineer

SystemVerilog Intent Verilog System Verilog Design entry Module level verification Module level design Gate level simulations System level verification Unified language to span almost the entire SoC design flow

Relaxed data type rules Verilog System Verilog Strict about usage of wire & reg data type Variable types are 4 state – 0,1,X,Z Logic data type can be used so no need to worry about reg & wire 2 state data type added – 0, 1 state 2 state variable can be used in test benches,where X,Z are not required 2 state variable in RTL model may enable simulators to be more efficient

Memory Management Verilog System Verilog Memories in verilog are static in nature Example :-reg[7:0] X[0:127]; 128 bytes of memory Memories are dynamic in nature Allocated at runtime Better memory management ie,queues Example:Logic[3:0] length[$]; an empty queue with an unbounded size of logic data type

Complexity Verilog System Verilog For complex designs large number of RTL code is required Increase in verification code to test these designs Extra time Less RTL & verification code Less code hence less no. of bugs Readable Higher level of abstraction due to algorithmic nature(inherited from C++)

Hardware specific procedures Verilog System Verilog It uses the “always” procedure to represent Sequential logic Combinational logic Latched logic It uses three new procedures always_ff - sequential logic always_comb - combinational logic always_latch - latched logic

Port connections Verilog System Verilog Ports are connected using either named instance or positional instance Ports are connected using Design DUT(.*);which means connect all port to variables or nets with the same name as the ports

Synthesis support Extensive support for verilog-2001 in simulation and synthesis Synthesis tool support for system verilog is limited Verilog System Verilog “This is a major drawback which is restricting people to accept SystemVerilog as a Design language”

SystemVerilog Concepts

System Verilog Concepts Data types : reg r; // 4-state Verilog-2001 logic w; // 4-valued logic, see below bit b; // 2-state bit 0 or 1 integer i; // 4-state, 32-bits, signed Verilog-2001 byte b8; // 8 bit signed integer int i; // 2-state, 32-bit signed integer shortint s;// 2-state, 16-bit signed integer longint l; // 2-state, 64-bit signed integer Bit subs allowed Explicit 2-state variables allow compiler optimizations to improve performance logic is has single driver (procedural assignments or a continuous assignment), can replace reg and single driver wire. (Equivalent to “std_ulogic” in VHDL)

System Verilog Concepts Fork/join Initial Begin Clk =0; #5 Fork #5 a = 0; #10 b = 0; Join Clk= 1; end fork Clk becomes 1 at t=15 join

System Verilog Concepts Fork/join_any Initial Begin Clk =0; #5 Fork #5 a = 0; #10 b = 0; Join_any Clk= 1; end fork Clk becomes 1 at t=10 Join_any

System Verilog Concepts Fork/join_none Initial Begin Clk =0; #5 Fork #5 a = 0; #10 b = 0; Join_none Clk= 1; end fork Clk becomes 1 at t=5 Join_none

System Verilog Concepts Final block Executes at the end of simulation It can not have delays Used in verification to print simulation results, such as error report, code coverage reports

System Verilog Concepts Tasks & Functions No begin end required Return can be used in task Function return values can have a “void return type” Functions can have any number of inputs,outputs and inouts including none

System Verilog Concepts DPI(Direct Programming interface ) DPI’s are used to call C, C++, System C functions System verilog has a built in C interface Simple to used as compared to PLI’s Values can be passed directly

System Verilog Concepts DPI(Direct Programming interface ) Imported functions System verilog calls the C functions Exported functions C calls the system verilog function Both sides of DPI are fully independent System verilog does not analyze the C-code C complier does not have to analyze the system verilog code

System Verilog Concepts Top SystemVerilog Testbench Constructs Queue Mailbox Fork/join Class Constraint Covergroup Program Virtual interface Clocking Block modports

Verification Targeted Capabilities

Verification environment DUT Driver Transactor Monitor Supplies data to the DUT Observes data from DUT Executes transactions Identifies transactions Checks correctness Creates stimulus Testbench Assertions Test Checker Self Check Verification Environment

Verification targeted capabilities Verilog System Verilog File I/o Random number generation Fork/join Initial block Task & functions PLI All verilog features Constrained random number generation Classes Fork/join_any,fork/join_none Final block Task & function enhancements DPI

OOP Concepts

What is OOP? classes encapsulation OOP inheritance polymorphism

What is OOP? OOP is object oriented programming Classes form the base of OOP programming Encapsulation - OOP binds data & function together Inheritance –extend the functionality of existing objects Polymorphism – wait until runtime to bind data with functions

What is OOP? OOP breaks a testbench into blocks that work together to accomplish the verification goal Why OOP Highly abstract system level modelling Classes are intended for verification Classes are easily reused and extended Data security Classes are dynamic in nature Easy debugging, one class at a time

Why not C++ Why system Verilog? Why Not C++?

Why not C++ C++ System Verilog No relation to verilog Interface is required to interact with Verilog Superset of Verilog RTL/Verification language Assertion language Constraint language Code coverage language

Inheritance Inheritance is to reuse the existing code Inheritance allows to add new Data members(properties) New Methods Inheritance is to share code between classes

Inheritance Advantages Common code can be grouped into one class No need to modify the existing classes Add new features to existing class by means of new derived classes Easy debug & easy to maintain the code base

Randomization

Randomization Why Randomization ? Random generation of stimulus Random setting of parameters Hard-to-reach corner cases can be reached

Randomization Shift from directed to random Directed Random Detect the expected bugs Time consuming Detects unexpected bugs (corner cases) Tremendously reduce the efforts

Randomization Constrained Randomization Improves the result Speed-up the bug finding process More interesting cases can be achieved within the constrained boundary

Assertions

Assertion Used primarily to validate the behaviour of a design An assertion is a statement about a designs intended behaviour In-line assertions are best added by design engineers Interface assertions are best added by verification engineers An assertion’s sole purpose is to ensure consistency between the designer’s intention and design implementation It increases the bug detection possibility during RTL design phase

Crux

Crux SystemVerilog Reduce the design cycle Is a unified language (HDVL) Reduce the design cycle Verify that designs are functionally correct Greatly increase the ability to model huge designs Incorporates the capability of Vera & powerful assertion constructs Bridges the gap between Hardware design engineer and verification engineer

Verification with SystemVerilog

This Presentation is… Focused on “SystemVerilog” Testbench constructs It’s a platform for open discussion on “SystemVerilog”

References Websources: Books : 3. http://svug.org/ 1. www.systemverilog.org 3. http://svug.org/ Books : 1. Writing Testbenches using SystemVerilog - Janick Bergeron 2. Verification Methodology Manual - Janick Bergeron 3. SystemVerilog For Verification - Chris Spear

We will discuss… Top SystemVerilog Testbench Constructs Queue Mailbox Fork/join Semaphore Constraint Covergroup Program Interface Clocking Block modports

Queue… Data storage array [$] Variable size array with automatic sizing Searching, sorting and insertion methods

Mailbox Fifo with flow control passes data between two processes put() – stimgen calls put() to pass data to bfm get() – bfm calls get() to retrieve data from stimgen mailbox stimgen bfm put() get()

Mailbox mailbox mbx; mbx = new(); // allocate mailbox mbx.put(data); // Put data object into mailbox mbx.get(data); // data will be updated with data from FIFO success = mbx.try_get(ref data); // Non-blocking version mbx.peek(data); // Look but don’t remove count = mbx.num(); // Number of elements in mailbox

Fork/join Fork/join Initial Begin Clk =0; #5 Fork #5 a = 0; #10 b = 0; end fork Clk becomes 1 at t=15 join

Fork/join Fork/join_any Initial Begin Clk =0; #5 Fork #5 a = 0; end fork Clk becomes 1 at t=10 Join_any

Fork/join Fork/join_none Initial Begin Clk =0; #5 Fork #5 a = 0; end fork Clk becomes 1 at t=5 Join_none

Used for Synchronization Semaphore Used for Synchronization Variable number of keys can be put and removed controlled access to a shared object think of two people wanting to drive the same car – the key is a semaphore

Control randomization Constraint Control randomization Values for random variable can be controlled through constraint expressions These are declared within constraint block Class packet ; rand logic [7:0] src; rand logic [7:0] dest; Constraint my_constraints { src[1:0] == 2’b00; // constraint expression …………… // always set src[1:0] to 0 } endclass:packet

Captures results from a random simulation Covergroup Captures results from a random simulation Encapsulates the coverage specification bins transitions Covergroup check @(posedge top.valid ); coverpoint global; coverpoint top.test; endgroup:check ……………… check chk = new();

Program Block Benefits: Functionality: 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

The testbench (program) runs separately from design (module) Program Block The testbench (program) runs separately from design (module) Triggered by clock Samples just before clock edge, drives just after clock clock Sample inputs Drive outputs Design Testbench

bundling of port signals Interface bundling of port signals provide an abstract encapsulation of communication between blocks Directional information (modports) Timing (clocking blocks) Functionality (routines,assertions) device1 device2 interface

Interface Interface:An example Interface bus_a (input clock); logic [7:0] address; logic [31:0] data ; bit valid ; bit rd_wr ; Endinterface: bus_a

Specify synchronization characteristics of the design Clocking Block Specify synchronization characteristics of the design Offer a clean way to drive and sample signals Features Clock specification Input skew,output skew Cycle delay (##)

Clocking Block Can be declared inside interface,module or program

Clocking Block Signals will be sampled 2ns before posedge ck Module M1(ck, enin, din, enout, dout); input ck,enin; input [31:0] din ; output enout ; output [31:0] dout ; clocking sd @(posedge ck); input #2ns ein,din ; output #3ns enout, dout; endclocking:sd reg [7:0] sab ; initial begin sab = sd.din[7:0]; end endmodule:M1 Signals will be sampled 2ns before posedge ck Signals will be driven 3ns after posedge ck

All signal names in a modport must be declared in the interface Modports An interface can have multiple viewpoints Master/Slave, Transmitter/Receiver These can be specified using modports All signal names in a modport must be declared in the interface Interface bus_b (input clock); logic [7:0] addr,data; logic [1:0] mode ; bit ready ; modport master (input ready,output addr,data,mode) ; modport slave (input addr,data,mode,output ready) ; endinterface: bus_b

Conclusion But still a long way to go…….. Some of SystemVerilog Testbench constructs were discussed But still a long way to go……..

Thank you