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

Similar documents
Simple Behavioral Model: the always block

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

SystemVerilog Essentials Simulation & Synthesis

Stuart Sutherland, Sutherland HDL, Inc.

Verilog for Synthesis Ing. Pullini Antonio

Hardware Description Languages: Verilog

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

EECS 470 Lab 1. Verilog: Hardware Description Language

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

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

EECS 470 Lab 1. Verilog: Hardware Description Language

Hardware Description Languages: Verilog. Quick History of HDLs. Verilog/VHDL. Design Methodology. Verilog Introduction. Verilog.

Outline. EECS150 - Digital Design Lecture 5 - Verilog 2. Structural Model: 2-to1 mux. Structural Model - XOR. Verilog Basics Lots of Examples

Lecture 32: SystemVerilog

! ISP (circa 1977) - research project at CMU " Simulation, but no synthesis

EECS 270 Verilog Reference: Sequential Logic

CSE140L: Components and Design Techniques for Digital Systems Lab

VHDL for Synthesis. Course Description. Course Duration. Goals

Advanced Synthesis Techniques

Synthesizable Verilog

FSM and Efficient Synthesizable FSM Design using Verilog

Digital System Design with SystemVerilog

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

EECS 470 Lab 2. Synopsys Build System. Department of Electrical Engineering and Computer Science College of Engineering University of Michigan

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

EECS 470: Computer Architecture. Discussion #2 Friday, September 14, 2007

CSE140L: Components and Design

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

Course Profile SystemVerilog Design

IP Core Design. Lecture 6 Introduction to Verilog-2001

Digital Design with SystemVerilog

271/469 Verilog Tutorial

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

EE 4755 Digital Design Using Hardware Description Languages

EEL 4783: HDL in Digital System Design

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

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

Digital Design using HDLs EE 4755 Midterm Examination

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

CMPE 415 Synthesis and Loops

Verilog for High Performance

Programming with HDLs

271/471 Verilog Tutorial

SystemVerilog Assertions Are For Design Engineers Too!

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

EEL 4783: HDL in Digital System Design

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

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA

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

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

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

Quick Introduction to SystemVerilog: Sequental Logic

Quartus II Version 14.0 Tutorial Created September 10, 2014; Last Updated January 9, 2017

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

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

VHDL simulation and synthesis

Testbenches for Sequential Circuits... also, Components

Introduction to synthesis. Logic Synthesis

Yet Another Latch and Gotchas Paper

VHDL Sample Slides Rev Sample Slides from the 2-day and 4-day VHDL Training Courses

SystemVerilog HDL - a programming language

World Class Verilog & SystemVerilog Training

Digital Design with FPGAs. By Neeraj Kulkarni

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

ECEN 468 Advanced Logic Design

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

Digital Design and Computer Architecture

EECS 4340: Computer Hardware Design Unit 4: Validation

ECE 353 Lab 4. Verilog Review. Professor Daniel Holcomb UMass Amherst Fall 2017

Lecture 12 VHDL Synthesis

Digital Design using HDLs EE 4755 Final Examination

Course Topics - Outline

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

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

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

SystemC Synthesis Standard: Which Topics for Next Round? Frederic Doucet Qualcomm Atheros, Inc

HDLs and SystemVerilog. Digital Computer Design

EECS 470 Lab 7. Final Project Memory & Caches. Department of Electrical Engineering and Computer Science College of Engineering University of Michigan

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Verilog: The Next Generation Accellera s SystemVerilog Standard

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

Top-Down Transaction-Level Design with TL-Verilog

HDL Compiler Directives 7

SystemVerilog For Design Second Edition

Verilog Overview. The Verilog Hardware Description Language. Simulation of Digital Systems. Simulation of Digital Systems. Don Thomas, 1998, Page 1

Intro to Digital Logic, Lab 5 Sequential Logic. Lab Objectives. Assigned Task Mapping sequential logic to the FPGA

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

Sequential Logic Design

MLR Institute of Technology

Lab 1.5 (Warmup): Synthesis Workflow and SystemVerilog Register File Not Due

EECS150 - Digital Design Lecture 10 Logic Synthesis

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

EECS150 - Digital Design Lecture 10 Logic Synthesis

EE 4755 Digital Design Using Hardware Description Languages

Synthesis of Combinational and Sequential Circuits with Verilog

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

Introduction to Verilog

Verilog Design Entry, Synthesis, and Behavioral Simulation

Unifying Design and Verification

Transcription:

EECS 470 Lab 6 SystemVerilog Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Thursday, October. 18 th, 2018 Thursday, October. 18 th, 2018 1 /

Overview Administrivia Motivation Multidimensional Arrays Unique and Priority Assertions For Loops Generate Blocks Assignment Thursday, October. 18 th, 2018 2 /

Administrivia Crazy times are here Project Milestone 1 is due Wednesday, October th! You should have at least one module fully completed and debugged Turn in: progress report, and one module and testbench for us to grade Starter code for an RS and other resources (like fast priority selector) are available on the course site! Thursday, October. 18 th, 2018 3 /

Motivation Motivation Why SystemVerilog? Why now? Extra features that will be useful in your projects Not all features are easy to use: many have a steep learning curve The goal isn t to go wild and try to use everything... Instead, think about which are worthwhile to incorporate Thursday, October. 18 th, 2018 4 /

Motivation What is SystemVerilog? 1. 1995 Verilog HDL 2. 2001 Verilog 2001 3. 2005 SystemVerilog Emphasis on creating a combined Hardware Description Language and Hardware Verification Language Ability to debug at the system level Provides the basis for very powerful, object-oriented testbenches The framework for industry verification tools, e.g. UVM Thursday, October. 18 th, 2018 5 /

Multidimensional Arrays Multidimensional Arrays Example logic [127:0] [63:0] multi_d_array [3:0]; assign multi_d_array[3][101] = 64 hffff_ffff; Explanation [127:0] and [63:0] are called packed dimensions [3:0] is an unpacked dimension When referencing for read/write, unpacked dimensions come first, then packed dimensions Thursday, October. 18 th, 2018 6 /

Multidimensional Arrays Multidimensional Arrays Example logic [127:0] [63:0] multi_d_array [3:0]; assign multi_d_array[3][101] = 64 hffff_ffff; Explanation Old Verilog only allows one packed dimension SystemVerilog allows as many as you need We recommend packed arrays for most designs Thursday, October. 18 th, 2018 7 /

Multidimensional Arrays Multidimensional Arrays Example logic [:0] one_d_array; logic [15:0] [1:0] two_d_array; assign two_d_array = one_d_array; Explanation Packed arrays are laid out as a contiguous set of bits Allows easy copying from one array to another Thursday, October. 18 th, 2018 8 /

Unique and Priority Unique/priority if/case input a, b, c; input [1:0] sel; output z; case (sel) 2 b00: z = a; 2 b01: z = b; 2 b10: z = c; endcase How will the synthesis tool convert this design to hardware? Thursday, October. 18 th, 2018 9 /

Unique and Priority Unique/priority if/case input a, b, c; input [1:0] sel; output z; case (sel) 2 b00: z = a; 2 b01: z = b; 2 b10: z = c; endcase A latch will be generated, since a value for z was not specified when sel == 2 b11 Thursday, October. 18 th, 2018 10 /

Unique and Priority Unique/priority if/case What if you know sel will never equal 2 b11? You could add a dummy state, but that adds unnecessary logic and potentially hides errors SystemVerilog has a priority construct for exactly this problem Tells synthesis tool not to generate a latch Checks at run-time that each state is reachable Thursday, October. 18 th, 2018 11 /

Unique and Priority Unique/priority if/case input a, b, c; input [1:0] sel; output z; priority case (sel) 2 b00: z = a; 2 b01: z = b; 2 b10: z = c; endcase During behavioral simulation, if sel is 2 b11, a warning will be generated: RT Warning: No condition matches in priority case statement. Thursday, October. 18 th, 2018 12 /

Unique and Priority Unique/priority if/case Another code example: input [1:0] sel; output logic [1:0] z; if (sel[1]) z = a; else if (sel[0]) z = b; else z = c What hardware will be generated by this code? Thursday, October. 18 th, 2018 13 /

Unique and Priority Unique/priority if/case Another code example: input [1:0] sel; output logic [1:0] z; if (sel[1]) z = a; else if (sel[0]) z = b; else z = c Tool will give priority to higher bits, since it assumes multiple bits could be high? But what if we re using one-hot encoding? Thursday, October. 18 th, 2018 14 /

Unique and Priority Unique/priority if/case SystemVerilog has unique if/case statement input [1:0] sel; output logic [1:0] z; unique if (sel[1]) z = a; else if (sel[0]) z = b; else z = c Tells synthesis tool to assume one-hot encoding Ignores priority logic and doesn t generate any latches Generates simulation warning if zero or multiple bits are high Thursday, October. 18 th, 2018 15 /

Unique and Priority Unique/priority if/case Unique & Priority used for both if and case statements Replaces full_case and parallel_case pragmas from old Verilog Useful for simplifying logic and clarifying design choices Thursday, October. 18 th, 2018 16 /

Assertions Assertions Assertions Strategy for automated testing: check that certain conditions are true Statements declaring some kind of invariant Can be inserted in testbenches or RTL (ignored by synthesis) Two types: Immediate: directly called in code Concurrent: running in background Thursday, October. 18 th, 2018 17 /

Assertions Immediate Assertions Need to check that some expression is true... adder a1(a, b, c); initial begin if ((a+b)!= c) $display("error!"); end Better done by immediate assertion... adder a1(a, b, c); initial begin assert ((a+b) == c); end Thursday, October. 18 th, 2018 18 /

Assertions Concurrent Assertions Much more interesting (and challenging) Describe high-level functional correctness of your design......and have simulator check these invariants in the background SystemVerilog supports an entire assertion language (!) (beyond the scope of what we will do in class) Implication s1 -> s2 If s1 is true, then s2 must also be true Timing windows (a && b) -> ##[1:3] c; On the posedge of the clock, if a and b are true, then 1-3 cycles later, c will be true Thursday, October. 18 th, 2018 19 /

Assertions Assertions Assertions For more information on assertions, check out A Practical Guide to SystemVerilog Assertions Thursday, October. 18 th, 2018 20 /

For Loops For loops You want for loops? You can t handle for loops! We told you earlier in the semester that for loops are not a thing We lied, sort of... but they don t work the way they do in software In software we think about iterations of loops Iteration 1, then Iteration 2, then Iteration 3... etc... In hardware, loops need to unroll completely at design time Self-modifying hardware is still not a thing... So either everything runs in parallel (good) Or loop can break when a certain condition is true (can get ugly) Thursday, October. 18 th, 2018 21 /

For Loops For loops Does this make sense for actual hardware? logic parity = 0; for (int i=0; i<32; i++) begin if (in[i]) parity = ~parity; end Thursday, October. 18 th, 2018 22 /

For Loops For loops Designing synthesizable for loops For loops can be valuable, just different than software Just another way of doing combinational logic, not a replacement for sequential logic Very limited ability to change signals referenced in the loop Great for condensing repetitive code, because everything will be done in parallel Visualize how a loop can be built into hardware at synthesis time Watch out for circular logic! Thursday, October. 18 th, 2018 23 /

For Loops For loops Blocking assignment in loops always_comb begin for (int i=0; i<32; i++) a = i; end What will a equal?, because if we unrolled the loop, the assignment to would be last Thursday, October. 18 th, 2018 24 /

For Loops For loops Break Statements always_comb begin for (int i=0; i<32; i++) a = i; if (condition[i]) break; end Effect: break out of loop once condition is true Break statements are synthesizable, but be cautious: lots of hidden priority logic is required behind the scenes to make this work You will typically get better performance by building in a different (better) way Thursday, October. 18 th, 2018 25 /

For Loops For loops Max loop iterations Design Compiler sets a maximum number of loop iterations to prevent infinite loops This is configured to be 1024 by default If you need more, add this line to your.tcl file: set hdlin_while_loop_iterations (iterations) Final advice Remember: don t use Verilog as a way to avoid thinking about actual hardware This results in synthesis problems or overly complex designs First think about how to build the hardware, then think about the Verilog constructs that can allow you to describe your design easily Thursday, October. 18 th, 2018 26 /

Generate Blocks Generic Designs Goal: complex designs with a single parameter Want to make designs where we can easily change certain features For example, the number of ROB entries The multiplier in P2 could be modified using parameters We can build complex designs... remember module arrays? one_bit_adder add_8 [7:0] (.a(a),.b(b),.cin({carries, cin}),.sum(sum),.cout({cout, carries})); What if we could condense everything to a single parameter? An adder is simple, just an array of smaller adders What about more complex structures like the priority selectors from P1 that are trees of smaller selectors? Thursday, October. 18 th, 2018 27 /

Generate Blocks Generate Blocks Generate blocks give control Using a generate block to build hardware: generate genvar i; for (i=0; i<n; i++) begin one_bit_adder (.a(a[i]),.b(b[i]),.cin(carries[i]),.sum(sum[i]),.cout(carries[i+1])); end endgenerate Thursday, October. 18 th, 2018 28 /

Generate Blocks Generic Designs Goal: complex designs with a single parameter How does this work? The tool will elaborate the design Evaluate if statements and unroll for loops Important: all conditions must be deterministic at compile time Thursday, October. 18 th, 2018 29 /

Generate Blocks Generate Blocks Another example: the Priority selectors from P1: generate genvar i; for (i=0; i<n; i++) begin localparam left_right = i[0]; ps2 (.req (sub_reqs[i]),.en (sub_gnts[i/2][left_right]).gnt (sub_gnts[i]),.req_up (sub_reqs[i/2][left_right])) end endgenerate Thursday, October. 18 th, 2018 30 /

Assignment Lab Assignment Assignment is posted to the course website as Lab 6 Assignment. If you get stuck... Ask a neighbor, quietly Put yourself in the help queue When you finish the assignment, sign up in the help queue and mark that you would like to be checked off. If you are unable to finish today, the assignment needs to be checked off by a GSI in office hours before the end of next week. Thursday, October. 18 th, 2018 /