What, If Anything, In SystemVerilog Will Help Me With FPGA-based Design. Stuart Sutherland, Consultant and Trainer, Sutherland HDL, Inc.

Similar documents
SystemVerilog 3.1: It s What The DAVEs In Your Company Asked For

Lecture 8: More SystemVerilog Features

What, If Anything, In SystemVerilog Will Help Me With FPGA-based Designs?

Can My Synthesis Compiler Do That?

Verilog: The Next Generation Accellera s SystemVerilog Standard

Verilog Is Not Called Verilog Anymore!

Course Profile SystemVerilog Design

SystemVerilog Essentials Simulation & Synthesis

OVERVIEW: ============================================================ REPLACE

Stuart Sutherland, Sutherland HDL, Inc.

Is SystemVerilog Useful for FPGA Design & Verification?

Sunburst Design - Comprehensive SystemVerilog Design & Synthesis by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

Sunburst Design - Advanced SystemVerilog for Design & Verification by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

Quick Introduction to SystemVerilog: Sequental Logic

SystemVerilog Design: User Experience Defines Multi-Tool, Multi-Vendor Language Working Set Experience from Four Years of SVD Adoption

An Overview of SystemVerilog 3.1

IP Core Design. Lecture 6 Introduction to Verilog-2001

HDVL += (HDL & HVL) SystemVerilog 3.1 The Hardware Description AND Verification Language

EE 4755 Digital Design Using Hardware Description Languages

EEL 4783: HDL in Digital System Design

Unifying Design and Verification

EECS 470 Lab 6. SystemVerilog. Department of Electrical Engineering and Computer Science College of Engineering. (University of Michigan)

Verilog for Synthesis Ing. Pullini Antonio

CSE140L: Components and Design

קורס SystemVerilog Essentials Simulation & Synthesis.. SystemVerilog

Extending SystemVerilog Data Types to Nets

CSE140L: Components and Design Techniques for Digital Systems Lab

Yet Another Latch and Gotchas Paper

Standard Gotchas Subtleties in the Verilog and SystemVerilog Standards That Every Engineer Should Know

SystemVerilog For Design Second Edition

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

HDL Compiler Directives 7

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Getting Ready for SystemVerilog at DAC

SystemVerilog Design: User Experience Defines Multi-Tool, Multi-Vendor Language Working Set No Excuses for Not Using SystemVerilog in Your Next Design

Lecture 32: SystemVerilog

Modular SystemVerilog

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

Extending SystemVerilog Data Types to Nets

Bulletproofing FSM Verification Automated Approach to Detect Corner Case Issues in an FSM Design

the New Verilog 2000 Standard

FSM and Efficient Synthesizable FSM Design using Verilog

Verilog for High Performance

UVM for VHDL. Fast-track Verilog for VHDL Users. Cont.

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

ECEN 468 Advanced Logic Design

List of Code Samples. xiii

A short introduction to SystemVerilog. For those who know VHDL We aim for synthesis

Cadence Technical Analysis of System Verilog DECEMBER 2002

Design Creation & Synthesis Division Avoid FPGA Project Delays by Adopting Advanced Design Methodologies

EECS 470 Lab 3. SystemVerilog Style Guide. Department of Electrical Engineering and Computer Science College of Engineering University of Michigan

SystemVerilog 3.1 It s What The DAVEs In Your Company Asked For ABSTRACT

Course Topics - Outline

HDLs and SystemVerilog. Digital Computer Design

Index. 1=> implication operator > implication operator * See dot-starport connection

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Chapter 4 :: Topics. Introduction. SystemVerilog. Hardware description language (HDL): allows designer to specify logic function only.

SystemVerilog Lecture 3. Prof. Gerald E. Sobelman Dept. of Electrical and Computer Engineering University of Minnesota Minneapolis, MN USA

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Testbenches for Sequential Circuits... also, Components

A short introduction to SystemVerilog. For those who know VHDL We aim for synthesis

A Verilog Primer. An Overview of Verilog for Digital Design and Simulation

Course Details: Webpage

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb With material by Professor Moritz and Kundu UMass Amherst Fall 2016

SystemVerilog Assertions Are For Design Engineers Too!

Synthesizable Verilog

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA

Chapter 4. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 4 <1>

Chapter 4. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 4 <1>

A User s Experience with SystemVerilog

E85: Digital Design and Computer Engineering Lab 2: FPGA Tools and Combinatorial Logic Design

VHDL simulation and synthesis

VHDL Essentials Simulation & Synthesis

SystemVerilog Data Types

Verilog Behavioral Modeling

Chapter 2 Using Hardware Description Language Verilog. Overview

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

Lecture 15: System Modeling and Verilog

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

Using PLI 2.0 (VPI) with VCS Yes, it really works! (or does it?)

System Verilog Tagged Unions and Pattern Matching

Writing Circuit Descriptions 8

Quartus II Tutorial. September 10, 2014 Quartus II Version 14.0

Programmable Logic Devices HDL-Based Design Flows CMPE 415

Sunburst Design - Verilog-2001 Design & Best Coding Practices by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

COMPREHENSIVE SYSTEMVERILOG-SYSTEMC-VHDL MIXED-LANGUAGE DESIGN METHODOLOGY

EN2911X: Reconfigurable Computing Topic 02: Hardware Definition Languages

Register Transfer Level

TSEA44: Computer hardware a system on a chip

VHDL vs. BSV: A case study on a Java-optimized processor

A Fast Review of C Essentials Part I

Introduction to Verilog HDL

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

Introduction to Verilog/System Verilog

VHDL for Synthesis. Course Description. Course Duration. Goals

Last Lecture: Divide by 3 FSM

Transcription:

What, If Anything, In SystemVerilog Will Help Me With FPGA-based Design Stuart Sutherland, Consultant and Trainer, Sutherland HDL, Inc.

About the Presenter... Stuart Sutherland, SystemVerilog wizard Independent SystemVerilog consultant and trainer Hardware design engineer Have worked with Verilog since 1988 Specialize in Verilog and SystemVerilog training BS in Computer Science, MS in elearning Education Member of the IEEE Verilog and SystemVerilog standards groups Involved with the IEEE Verilog standard since its beginning Involved with the definition of SystemVerilog since its inception Technical editor of every generation of the Verilog and SystemVerilog Language Reference Manuals What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 2 of 24

What This Presentation Will Discuss Verilog versus SystemVerilog There is more to the story than you might be aware of Synthesizable SystemVerilog Constructs There s a lot! Why these constructs are beneficial What do FPGA synthesis tools support? What commercial synthesis compilers FPGA vendor synthesis compilers Recommendations When (if ever) will it be time to adopt SystemVerilog? What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 3 of 24

A 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 tremendously SystemVerilog (IEEE standard 1800) 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 What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 4 of 24

classes assertions mailboxes SystemVerilog is an Extension to Verilog inheritance test program blocks semaphores verification design constrained randomization functional coverage interfaces nested hierarchy unrestricted ports automatic port connect enhanced literals time values and units specialized procedures ANSI C style ports generate localparam constant functions modules parameters function/tasks always @ assign clocking domains process control packages 2-state modeling packed arrays array assignments queues unique/priority case/if compilation unit space standard file I/O $value$plusargs `ifndef `elsif `line @* $finish $fopen $fclose $display $write $monitor `define `ifdef `else `include `timescale SystemVerilog Verilog-2001/2005 (* attributes *) configurations memory part selects variable part select Verilog-1995 initial disable events wait # @ fork join dynamic arrays associative arrays int shortint longint byte shortreal void alias wire reg integer real time packed arrays 2D memory globals enum typedef structures unions casting const multi dimensional arrays signed types automatic ** (power operator) begin end while for forever if else repeat reference arguments direct C function calls break continue return do while ++ -- += -= *= /= >>= <<= >>>= <<<= &= = ^= %= + = * / % >> << What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 5 of 24

Let s Look At The Details! All we have time for is a quick review of synthesizable SystemVerilog We will emphasize the benefits of each construct Read the paper for more details Only synthesizable enhancements are listed if we don t talk about it in the paper, it is probably not synthesizable by most FPGA tools What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 6 of 24

SystemVerilog Variables SystemVerilog adds synthesizable variable types logic single bit 4-state variable (replaces Verilog reg type) bit single bit 2-state variable byte 8-bit 2-state variable shortint 16-bit 2-state variable int 32-bit 2-state variable longint 64-bit 2-state variable So what? The logic type prevents confusion on hardware registers 2 state types are used for constrained random verification What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 7 of 24

Enumerated Types SystemVerilog adds enumerated types to Verilog enum defines variables or nets with a legal set of values Can be a simple enumerated type enum {WAITE, LOAD, READY} state; The first label defaults to a value of 0 Subsequent labels increment from the previous label value Can specify an explicit size and explicit values for each label enum logic [2:0] {WAITE=3 b001, LOAD=3 b010, READY=3 b100} state; Enumerated types have strict rules Can only be assigned a label or another identical enumerated type So what? Enumerated types can prevent inadvertent (and hard to debug) coding errors (example on next slide) What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 8 of 24

localparam [2:0] WAIT=3 b001, LOAD=3 b010, DONE=3 b100; localparam [2:0] RED=3 b001, GREEN=3 b010, BLUE=3 b100; logic [2:0] State1, nstate1; logic [1:0] State2, nstate2; legal, but a bug sizes don't match always @(posedge clk or negedge rstn) if (!rstn) State1 <= 0; legal, but a bug not a valid state value else State1 <= nstate2; legal, but a bug wrong nstate variable always @(State1) case (State1) // next state logic legal, and functionally OK WAIT : nstate1 = State1 + 1; legal, but a bug not a valid state value LOAD : nstate1 = State1 + 1; DONE : nstate1 = State1 + 1; legal, but a bug not a valid state value enum logic [2:0] {WAIT=3 b001, LOAD=3 b010, DONE=3 b100} State1, nstate1; enum logic [1:0] {RED=3'b001, GREEN=3'b010, BLUE=3'b100} State2, nstate2; always @(posedge clk or negedge rstn) illegal, sizes must match if (!rstn) State1 <= 0; illegal, must assign a label name else State1 <= nstate2; illegal, not from same definition always @(State1) case (State1) // next state logic illegal, must assign a label name WAIT : nstate1 = State1 + 1; illegal, must assign a label name LOAD : nstate1 = State1 + 1; DONE : nstate1 = State1 + 1; illegal, must assign a label name What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 9 of 24

Structures SystemVerilog adds structures to Verilog Structures bundle multiple variables together under one name Structure variables can be assigned individually The entire structure can be assigned a list of values Structures can copied and can be passed through module ports struct { logic [47:0] opcode; logic [63:0] data; } operation_s; operation_s.data = 48 hf; operation_s = {55, 1024}; So what? Structures can significantly reduce the amount of code required to model complex functionality Structures can make code easier to read and maintain What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 10 of 24

User-defined Types SystemVerilog adds user-defined types to Verilog typedef defines a new type Can be based on built-in types or other user-defined types Variables and nets can be declared as a user-defined type typedef enum {FALSE, TRUE} boolean_t; boolean_t ready; // variable "ready" can be FALSE or TRUE typedef enum {WAIT, LOAD, READY} states_t; states_t state, next_state; So what? User-defined types reduce the number of times complex types (such as enum and struct) must be declared User-defined types ensure declarations are consistent What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 11 of 24

SystemVerilog Nets SystemVerilog adds a single-driver net uwire a wire that is restricted to at most one source SystemVerilog adds complex net types wire integer w2; 32-bit 4-state net typedef enum bit {FALSE, TRUE} bool_t; wire bool_t w3; net with bool_t values So what? Enforced single-driver nets prevent hard-to-find coding errors (Verilog net types (e.g., wire) permit any number of sources) Complex nets transfer any variable type to other modules What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 12 of 24

Packages SystemVerilog adds a package construct to Verilog Allows the same definition to be used by multiple design modules package definitions; typedef enum {s1,s2,s3} states_t; task automatic fetch... endpackage Package definitions can be imported 3 ways Explicit references of package items Explicit import of package items Implicit wildcard import of package So what? Packages can reduce duplicate code, make code more maintainable, and make code easier to reuse definitions::states_t state; import definitions::fetch; import definitions::*; What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 13 of 24

Data Arrays Packed arrays (old Verilog vectors) Vectors can be divided into sub fields Unpacked arrays (Verilog arrays) Arrays of structures, user-defined types, etc. C-like array declarations Copy arrays Assign list of values Assign to slices of an array Pass arrays through module ports logic [3:0] [7:0] a; a[3] a[2] a[1] a[0] [7:0] [7:0] [7:0] [7:0] int a1 [2][4]; //C-like declaration int a2 [0:1][0:3] = {default: 1}; // initialize array at declaration a1 = a2; // copy array a2 = { {7,3,0,5}, {2,0,1,6}}; // assign list of values So what? Manipulating entire arrays substantially reduces lines of code (see example on next page) What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 14 of 24

Array Manipulation Reduces Code package design_types; typedef struct { logic [ 3:0] GFC; logic [ 7:0] VPI; logic [15:0] VCI; logic CLP; logic [ 2:0] T; logic [ 7:0] HEC; logic [ 7:0] Payload [48]; } uni_t; // UNI cell definition endpackage module transmit_reg (output design_types::uni_t data_reg, another 54 ports input design_types::uni_t data_packet, input logic clock, resetn); always @(posedge clock or negedge resetn) if (!resetn) data_reg <= {default:0}; else data_reg <= data_packet; endmodule 4 lines of code in SystemVerilog replaces 216 lines in old Verilog! (and ensures consistency in all 4 places) This structure bundles 54 variables together (including the array of 48 Payload variables) 54 ports in old Verilog 54 separate assignment statements in old Verilog another 54 assignments What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 15 of 24

Type, Size and Sign Casting SystemVerilog adds casting operations to Verilog <type> (<expression>) cast expression to different data type <size> (<expression>) casts expression to a vector size <sign> (<expression>) casts expression to signed or unsigned real r; SystemVerilog style logic [ 2:0] b; logic [31:0] a; always_comb y = a + logic [31:0]'(r ** b); So what? Fewer lines of code Self-documenting code More maintainable and reusable code real r; old Verilog style to make reg [ 2:0] b; synthesis infer an integer reg [31:0] a; instead of floating-point adder reg [31:0] temp; always @(a or b or r) begin temp = r ** b; y = a + temp; end What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 16 of 24

Hardware Specific Procedural Blocks SystemVerilog adds special hardware-oriented procedures: always_ff, always_comb, and always_latch Enforce several semantic rules required by synthesis Simulation, synthesis and formal tools to use same rules always @(mode) if (!mode) y = a + b; else y = a - b; old Verilog synthesis must guess what type of logic was intended (might infer wrong type) always_comb if (!mode) y = a + b; else y = a - b; So what? Self-documenting code Non-synthesizable code won t simulate SystemVerilog sensitivity list is inferred contents checked for adherence to synthesis rules for combinational logic What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 17 of 24

Operators and Programming Statements SystemVerilog adds many new synthesizable constructs: ++ and -- increment and decrement +=, -=, *=, /=, %=, &=, ^=, =, <<=, >>=, <<<=, >>>= assignment ==? and!=? wild equality/inequality operators Variables on left-hand side of continuous assignments foreach and do while loops break, continue and return jump statements unique and priority decision statements (see next slide) So what? Model more functionality in fewer lines of code Self-documenting code Built-in error checking (see example on next slide) What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 18 of 24

Unique and Priority Decisions unique and priority decisions Turn on synthesis parallel_case and/or full_case pragmas Simulation and synthesis warn if detect overlap in the decisions Simulation has run-time warning if there is no matching condition unique casez (a) 2 b?0:... 2 b1?:... default:... endcase Will get warnings if a decodes to multiple branches (not parallel_case) Will get warnings if a doesn t decode to any branch (not full_case) unique if (a == 0)... else if (a == 2)... else if (a == 2)... else... So what? Automatic run-time checking that the decision statement will synthesize as intended Prevents very subtle, difficult to debug, design errors What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 19 of 24

Interface Ports Verilog discrete ports CPU clk data address request grant ready RAM clk data address request grant ready SystemVerilog interface ports CPU interface port chip_bus interface SystemVerilog interfaces are a compound, multi-signal port Bundles any number of signals (nets and variables) together Bundles methods with the signals (e.g. a handshake sequence) Bundles assertion checks with the signals What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 20 of 24 RAM interface port interface chip_bus; logic [31:0] data, address; logic clk, request, grant, ready; endinterface module CPU (interface chip_bus);... endmodule So what? Simplifies complex bus definitions and interconnections Ensures consistency throughout the design

Synthesis Support The SystemVerilog constructs presented in this paper are all synthesizable (and there s more that we didn t discuss ) Commercial FPGA synthesis tools Synopsys Synplify-Pro has excellent support Synopsys DC has excellent support Mentor Precision has excellent support Proprietary FPGA synthesis tools Xilinx XST has limited support (planned for version 14.1 in 2012) Altera Quartus has good support (but with several exceptions) Lattice has excellent support (via commercial tools) Microsemi (Actel) has excellent support (via commercial tools) What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 21 of 24

Conclusions SystemVerilog is Verilog (on steroids) SystemVerilog-2009 supersedes Verilog-2005 The IEEE terminated the Verilog standard in 2009 A substantial portion of SystemVerilog is synthesizable SystemVerilog is a Hardware Design Language Using SystemVerilog you can Model more functionality with much less code Reduce potential functionality errors in RTL code Gain built-in compile and run-time synthesis rule checking You can use SystemVerilog today for FPGA design! FPGA synthesis has excellent support for SystemVerilog What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 22 of 24

Questions? A copy of this presentation is available at www.sutherland-hdl.com/papers What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 23 of 24

About Sutherland HDL Sutherland HDL, Inc. provides SystemVerilog training SystemVerilog for Design and Synthesis SystemVerilog for Verification SystemVerilog Assertions SystemVerilog UVM All training workshops are available on-site and as online etutored training Sutherland HDL instructors are expert trainers and experienced design and verification engineers Sutherland HDL helps engineers become true SystemVerilog wizards! visit www.sutherland-hdl.com for workshop descriptions What, if anything, in SystemVerilog will help me with FPGA-based designs Stuart Sutherland, Sutherland HDL, Inc. 24 of 24