1 System Verilog Narges Baniasadi University of Tehran Spring 2004.

Slides:



Advertisements
Similar presentations
VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
Advertisements

CS 3850 Lecture 6 Tasks and Functions. 6.1 Tasks and Functions Tasks are like procedures in other programming languages. e. g., tasks may have zero or.
Simulation executable (simv)
Combinational Logic.
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 07: Verilog (3/3) Prof. Sherief Reda Division of.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
2/9/20031 ECE 551: Digital System Design & Synthesis Lecture Set 4 4.1: Verilog – Procedural Assignments &Scheduling Semantics 4.2: Verilog – More Behavioral.
Chapter 7: User-Defined Functions II
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
ELEN 468 Lecture 91 ELEN 468 Advanced Logic Design Lecture 9 Behavioral Descriptions III.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
2/3/03ΗΥ220 - Μαυροειδής Ιάκωβος1 Delays in Behavioral Verilog - Interassignment Delay  Key idea: unlike blocking delay, RHS is evaluated before delay.
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
Spring 2007W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example,
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
ECE 2372 Modern Digital System Design
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
SoC Verification HW #2 TA: Wei-Ting Tu Assignment: 04/12/06
System Verilog Testbench Language David W. Smith Synopsys Scientist
Verilog Language Concepts
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
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.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
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.
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,
SVA Encapsulation in UVM enabling phase and configuration aware assertions by Mark Litterick Verification Consultant Verilab GmbH, Munich, Germany.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
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)
Aarthi Nadarajan Interns – Basic Intro.  Language “e”  The ‘e’ Language has constructs necessary for verification automation  Specman Elite is the.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 6: Procedural Modeling Spring 2009 W. Rhett.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Verification Presentation to SystemVerilog Basic Committee Peter Flake Nov 15, 2002.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
TOPIC : SEQUENTIAL AND PARALLEL BLOCKS Module 2.3 : Behavioral modeling in verilog.
1 A hardware description language is a computer language that is used to describe hardware. Two HDLs are widely used Verilog HDL VHDL (Very High Speed.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Verilog Introduction Fall
Digital System Verification
‘if-else’ & ‘case’ Statements
11/10/2018.
University of Washington EE400/590 Dean Wen Chen
SystemVerilog for Verification
SystemVerilog for Verification
SystemVerilog and Verification
ECE 551: Digital System Design & Synthesis
C Language B. DHIVYA 17PCA140 II MCA.
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

1 System Verilog Narges Baniasadi University of Tehran Spring 2004

2 System Verilog Extensive enhancements to the IEEE 1364 Verilog-2001 standard. By Accellera More abstraction: modeling hardware at the RTL and system level Verification Improved productivity, readability, and reusability of Verilog based code Enhanced IP protection

3 Motivation As design sizes have increased: Design Code size verification code size Simulation time Have increased as well. Co-design Higher Level Design, simulation, synthesis, Test…

4 Alternatives SystemC model full systems at a much higher level of abstraction Hardware Verification Languages (HVLs) Verisity's e Synopsys' Vera more concisely describe complex verification routines Increased simulation time Working with multiple languages

5

6 Roots Accellera chose not to re-invent the wheel and relied on donations of technology from a number of companies. High-level modeling constructs : Superlog language developed by Co-Design Testbench constructs : Open Vera language and VCS DirectC interface technology by Synopsys Assertions : OVA from Verplex, ForSpec from Intel, Sugar (renamed PSL) from IBM, and OVA from Synopsys

7 Compatibility with Verilog 2001 SystemVerilog is fully compatible with the IEEE Verilog standard Warning: adds several new keywords to the Verilog language  Identifiers may cause errors: use Compatibility switches

8 Assertions Special language constructs to verify design behavior; a statement that a specific condition, or sequence of conditions, in a design is true. For documentation of the assumptions Assertions outside of Verilog modules Very complex combination of situations

9 Assertion Types Concurrent: the property must be true throughout a simulation Procedural: incorporated in procedural code apply only for a limited time

10 Procedural Assertions Immediate : at the time of statement execution Strobed : schedule the evaluation of the expression for the end of current timescale to let the glitches settle down Not in functions Clocked : being triggered by an event or sampling clock

11 Immediate assertions Severity level $fatal : terminates the simulation with an error code. The first argument shall be consistent with the argument to $finish. $error $warning $info assert (myfunc(a,b)) count1 = count + 1; else ->event1; [ identifier : ] assert ( expression ) [ pass_statement ] [ else fail_statement ]

12 Strobed assertions If immediate assertion is triggered by a timing control that happens at the same time as a blocking assignment to the data being tested, there is a risk of the wrong value being sampled. Pass and Fail statements in strobed assertions must not create more events at that time slot or change values. clock) a = a + 1; // blocking assignment clock) begin... assert (a < b); cas:assert_strobe (a < b); end

13 System Functions $onehot ( ) returns true if only one and only one bit of expression is high. $onehot0( ) returns true if at most one bit of expression is low. $inset (, {, } ) returns true if the first expression is equal to at least one of the subsequent expression arguments. $insetz(, {, } ) returns true if the first expression is equal to at least other expression argument. $isunknown( ) returns true if any bit of the expression is ‘x’.

14 Assertion example a sequence of conditions that span multiple clock cycles

15 Interfaces : to encapsulate communication and facilitate “Communication Oriented” design Several modules often have many of the same ports Abstraction Prevent Redundancy in code Can include functionality & built-in protocol checking the variables and nets in it are assumed to be inout ports.

16 Interface Example 1 interface simple_bus; // Define the interface logic req, gnt; logic [7:0] addr, data; logic [1:0] mode; logic start, rdy; endinterface: simple_bus module memMod(simple_bus a, // Use the simple_bus interface input bit clk); logic avail; // a.req is the req signal in the ’simple_bus’ interface clk) a.gnt <= a.req & avail; endmodule module cpuMod(simple_bus b, input bit clk);... endmodule module top; logic clk = 0; simple_bus sb_intf; // Instantiate the interface memMod mem(sb_intf, clk); cpuMod cpu(.b(sb_intf),.clk(clk)); endmodule

17 Interface Example 2 Interface serial(input bit clk); logic data_wire; logic data_start=0; task write(input data_type d); for (int i = 0; i <= 31; i++) begin if (i==0) data_start <= 1; else data_start <= 0; data_wire = clk) data_wire = 'x; end endtask task read(output data_type d); while (data_start !== for (inti = 0; i <= 31; i++) begin d[i] <= ; end endtask endinterface

18 Abstraction & Interfaces BlkA is unchanged

19 Data Types More abstract and C like class — an object-oriented dynamic data type, similar to C++ and Java. byte — a 2-state signed variable, that is defined to be exactly 8 bits. shortint — a 2-state signed variable, that is defined to be exactly 16 bits. int — a 2-state signed variable, similar to the "int" data type in C, but defined to be exactly 32 bits. longint — a 2-state signed variable, that is defined to be exactly 64 bits. bit — a 2-state unsigned of any vector width. logic — a 4-state unsigned of any vector width, equivalent to the Verilog "reg" data type. shortreal — a 2-state single-precision floating-point variable void — represents no value User defined types User defined types Typedef unsigned int uint; uint a, b;

20 Data Types Enumerated types enum {red, green, blue} RGB; Built in methods to work with Structures and unions Struct { bit[15:0 ]opcode; Logic[23:0] address } IR; IR.opcode = 1 or IR = {5, 200};

21 Arrays dynamic arrays one-dimensional arrays where the size of the array can be changed dynamically associative arrays one-dimensional sparse arrays that can be indexed using values such as enumerated type names. exists(), first(), last(), next(), prev() and delete().

22 String data type contains a variable length array of ASCII characters. Each time a value is assigned to the string, the length of the array is automatically adjusted. Operations: standard Verilog operators len(), putc(), getc(), toupper(), tolower(), compare(), icompare(), substr(), atoi(), atohex(), atooct(), atobin(), atoreal(), itoa(), hextoa(), octtoa(), bintoa(), realtoa().

23 Classes data declarations (referred to as “properties”), tasks and functions for operating on the data (referred to as “methods”). Classes can have inheritance and public or private protection, as in C++. dynamically created, deleted and assigned values. Objects can be accessed via handles, which provide a safe form of pointers. Memory allocation, de-allocation and garbage collection are automatically handled. dynamic nature: ideal for testbench modeling. Not Synthesizable verification routines and highly abstract system-level modeling.

24 Class example:

25 Relaxed data type rules Net data types (such as wire, wand, wor) Variables (such as reg, integer) Allowing variable types to be used in almost any context.

26 Type Casting

27 Global declarations Any declarations outside of a module boundary are in the global, or root, name space. Variables, type definitions, functions

28 New Operators ++ and -- increment and decrement operators +=, -=, *=, /=, %=, &=, ^=, |=, >=, >>= assignment operators

29 Time units Not a compiler directive module and the files can be compiled in any order Time unit/precision can be declared as part of the module.

30 Unique and priority decision statements if-else and case statements can be a source of mismatches between RTL simulation & synthesis The synthesis full_case and parallel_case pragmas can lead to further mismatches if improperly used, as they affect synthesis but not simulation. SystemVerilog adds the ability to explicitly specify when each branch of a decision statement is unique or requires priority evaluation, using the keywords "unique" and "priority."

31 Enhanced for loops Allow the loop control variable to be declared as part of the for loop, and allows the loop to contain multiple initial and step assignments. for (int i=1, shortint count=0; i*count < 125; i++, count+=3) Bottom testing loops. adds a do-while loop, which tests the loop condition at the end of executing code in the loop. Jump statements. adds the C "break" and "continue" keywords, which do not require the use of block names, and a "return" keyword, which can be used to exit a task or function at any point. Final blocks. execute at the very end of simulation, can be used in verification to print simulation results, such as code coverage reports

32 Hardware-specific procedures Instead of inferring the intent of the always procedure from the sensitivity list and the statements within the procedure explicitly indicate the intent of the logic: always_ff — the procedure is intended to represent sequential logic always_comb —: the procedure is intended to represent combinational logic always_latch — the procedure is intended to represent latched logic. For example:

33 Task and function enhancements Function return values can have a "void" type. Void functions can be called the same as a Verilog task. Functions can have any number of inputs, outputs and inouts, including none. Values can be passed to a task or function in any order, using the task/function argument names. Task and function input arguments can be assigned a default value as part of the task/function declaration. This allows the task or function to be called without passing a value to each argument. Task or function arguments can be passed by reference, instead of copying the values in or out of the task or function. To use pass by reference, the argument direction is declared as a "ref," instead of input, output or inout.

34 Inter-process synchronization semaphore : as a bucket with a fixed number of “keys.” built-in methods : new(), get(), put() and try_get(). mailbox allows messages to be exchanged between processes. A message can be added to the mailbox at anytime by one process, and retrieved anytime later by another process. Mailboxes behave like FIFOs (First-In, First-Out). built-in methods: new(), put(), tryput(), get(), peek(), try_get() and try_peek(). Event The Verilog "event" type is a momentary flag that has no logic value and no duration. If a process is not watching when the event is triggered, the event will not be detected. SystemVerilog enhances the event data type by allowing events to have persistence throughout the current simulation time step. This allows the event to be checked after it is triggered.

35 Constrained random values Verilog $random : little control rand and randc: classes with methods to set seed values and to specify various constraints on the random values that are generated

36 Testbench program block Declared between the keywords "program" and "endprogram." Contains a single initial block. Executes events in a “reactive phase” of the current simulation time, appropriately synchronized to hardware simulation events. Can use a special "$exit" system task that will wait to exit simulation until after all concurrent program blocks have completed execution (unlike "$finish," which exits simulation immediately).

37 Clocking domains Clocking domains allow the testbench to be defined using a cycle-based methodology, rather than the traditional event-based methodology A clocking domain can define detailed skew information avoiding race conditions with the design

38 Clocking Domain

39 Direct Programming Interface (DPI) To directly call functions written C, C++ or SystemC, without having to use the complex Verilog Programming Language Interface (PLI). Values can be passed and received directly to/from the foreign language function. Gives the foreign language functions access to simulation events and simulation time. A bridge between high-level system design using C, C++ or SystemC and lower-level RTL and gate-level hardware design.

40 Enhanced fork-join join_none — statements that follow the fork- join_none are not blocked from execution while the parallel threads are executing. Each parallel thread is an independent, dynamic process. join_any — statements which follow a fork- join_any are blocked from execution until the first of any of the threads has completed execution

41 Processes Static processes always initial fork Dynamic processes introduced by process. SystemVerilog creates a thread of execution for each initial or always block, for each parallel statement in a fork...join block and for each dynamic process

42 Dynamic Processes A fork without a join Does not block the flow of execution of statements within the procedure or task: A separate thread Multi-threaded processes task monitorMem(input int address); process $display("address %h data %h", mem[address] ); endtask

43 Enhanced IP Protection Modules can be declared within modules and these nested modules are local to their parent modules. Other parts of the design can not see local modules.

44 References: An overview of SystemVerilog 3.1 By Stuart Sutherland, EEdesign May 21, 2003 (4:09 PM) System Verilog 3.0 LRM