Unconstrained UVM SystemVerilog Performance You may add your company logo to this page, ONLY Presented by Wes Queen Verifcation Manager IBM.

Slides:



Advertisements
Similar presentations
The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Advertisements

MATH 224 – Discrete Mathematics
4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
Unit 6 Assignment 2 Chris Boardley.
1 Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Procedural programming in Java
Recursion. Recursion is a powerful technique for thinking about a process It can be used to simulate a loop, or for many other kinds of applications In.
Working with Huge Digital Prototypes: Autodesk Inventor Large-Assembly Best Practices Dan Miles INCAT Autodesk Practice Manager =
Data Analytics and Dynamic Languages Lee E. Edlefsen, Ph.D. VP of Engineering 1.
Module: Definition ● A logical collection of related program entities ● Not necessarily a physical concept, e.g., file, function, class, package ● Often.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Binary Search Introduction to Trees. Binary searching & introduction to trees 2 CMPS 12B, UC Santa Cruz Last time: recursion In the last lecture, we learned.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 OpenMP -Example ICS 535 Design and Implementation.
CS 201 Functions Debzani Deb.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Programming Fundamentals (750113) Ch1. Problem Solving
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
SM3121 Software Technology Mark Green School of Creative Media.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
CS0007: Introduction to Computer Programming Introduction to Arrays.
Data Structures Introduction Phil Tayco Slide version 1.0 Jan 26, 2015.
Language Evaluation Criteria
MapleSim and the Advantages of Physical Modeling
Chocolate Bar! luqili. Milestone 3 Speed 11% of final mark 7%: path quality and speed –Some cleverness required for full marks –Implement some A* techniques.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
MAPLDDesign Integrity Concepts You Mean We’re Still Working On It? Sustaining a Design.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
224 3/30/98 CSE 143 Recursion [Sections 6.1, ]
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
J. Christiansen, CERN - EP/MIC
Iterative Constructs Review l What are named constants? Why are they needed? l What is a block? What is special about declaring a variable inside a block?
SE: CHAPTER 7 Writing The Program
27/05/ Iteration Loops Nested Loops & The Step Parameter.
CPS120: Introduction to Computer Science Lecture 14 Functions.
Version 5. ¿What is PAF? PAF is a tool to easily and quickly implement… …distributed analysis over ROOT trees. …by hiding as much as possible the inherent.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
ECEG-3202 Computer Architecture and Organization Chapter 7 Reduced Instruction Set Computers.
SVA Encapsulation in UVM enabling phase and configuration aware assertions by Mark Litterick Verification Consultant Verilab GmbH, Munich, Germany.
November 29, 2011 Final Presentation. Team Members Troy Huguet Computer Engineer Post-Route Testing Parker Jacobs Computer Engineer Post-Route Testing.
From the customer’s perspective the SRS is: How smart people are going to solve the problem that was stated in the System Spec. A “contract”, more or less.
Introduction to Algorithms. Algorithms Algorithms are ways of solving problems. There is a technical definition that basically says an algorithm is a.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Chapter 9: Coupling & Cohesion Omar Meqdadi SE 273 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 2: Primitive Data and Definite Loops.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Introduction to Algorithms
Software Processes (a)
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Un</br>able’s MySecretSecrets
Lecture 5: GPU Compute Architecture
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Chapter 5 - Functions Outline 5.1 Introduction
CSCI1600: Embedded and Real Time Software
Phil Tayco Slide version 1.0 Created Oct 2, 2017
Lecture 5: GPU Compute Architecture for the last time
Matlab as a Development Environment for FPGA Design
Yet Another Memory Manager
Yet Another Memory Manager
Programming Fundamentals (750113) Ch1. Problem Solving
Nested Loops & The Step Parameter
Introduction to Algorithms
The Challenge of Cross - Language Interoperability
Drawing complex figures
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Unconstrained UVM SystemVerilog Performance You may add your company logo to this page, ONLY Presented by Wes Queen Verifcation Manager IBM

Sponsored By: 2 of 15 Randomization Performance is Important! Randomization is an integral part of UVM –It is used most often in configuring the environment and in writing sequences A typical UVM environment can easily contain tens of thousands of randomize calls. –Large environments can contain orders of magnitudes more. Writing high performance constraints is not hard, but requires engineers to think about it. Start thinking about randomization performance from the beginning of the project.

Sponsored By: 3 of 15 Set some reasonable goals for randomization times Understand how constraints are used in the UVM environment –Configuration constraints – Test level constraints Only randomized a few times in a run Medium to very high complexity Can afford to run for longer times –Data Item constraints – data flow Used many, many times in a run Low to medium complexity Needs to be optimized to run very fast. Small performance differences can greatly impact simulation run times

Sponsored By: 4 of 15 Coding for Speed Relationships between variables cause the solver to work harder. Remove unnecessary relationships. Constraint expressions are often invoked many times. Simplifying expressions lets the solver run faster. –Move complex math out of constraint code. class item extends uvm_sequence_item; rand int x_pos, y_pos; int y_offset, var_a, var_b. var_c; constraint position_c { x_pos ==( (12 * (y_pos + y_offset) * (var_a + var_b) ) / var_c) - ( (var_a * var_b) /var_c); } endclass class item extends uvm_sequence_item; rand int x_pos, y_pos; int y_offset, var_a, var_b. var_c; constraint position_c { x_pos ==( (12 * (y_pos + y_offset) * (var_a + var_b) ) / var_c) - ( (var_a * var_b) /var_c); } endclass Note the lack of “rand”

Sponsored By: 5 of 15 Coding for Speed Use solve…before to simplify complex relationships –Constraints are bi-directional by default. –We often don’t expect them to be bi-directional. –Creating an order can greatly reduce the amount of work needed to solve. class meal extends uvm_sequence_item; rand day_t weekday; rand meal_t lunch; constraint lunch_choice_c { (weekday == TUESDAY) -> (lunch != PIZZA); (weekday == WEDNESDAY ) -> (lunch == SOUP); solve weekday before lunch; } endclass class meal extends uvm_sequence_item; rand day_t weekday; rand meal_t lunch; constraint lunch_choice_c { (weekday == TUESDAY) -> (lunch != PIZZA); (weekday == WEDNESDAY ) -> (lunch == SOUP); solve weekday before lunch; } endclass

Sponsored By: 6 of 15 Coding for Speed Understand the impact of arrays with foreach constraints –foreach constraints result a new constraint for each loop A few lines of foreach code can result in many new constraints –Especially watch out for foreach constraints that result in creating new dependencies class config extends uvm_sequence_item; rand int table[]; constraint table_values { table.size() == 50; foreach( table[i] ) { foreach( table[j] ) { if( i != j ) table[i] != table[j]; } endclass class config extends uvm_sequence_item; rand int table[]; constraint table_values { table.size() == 50; foreach( table[i] ) { foreach( table[j] ) { if( i != j ) table[i] != table[j]; } endclass Foreach better in procedural

Sponsored By: 7 of 15 Coding for Speed Use pre_randomize() and post_randomize() to assign values procedurally. Procedural code is most often less complex than similar looking constraint expressions Particularly useful in reducing the need for foreach constraints class config extends uvm_sequence_item; function void post_randomize(); foreach( table[i] ) { foreach( table[j] ) { if( i != j ) table[i] != table[j]; } endfunction endclass class config extends uvm_sequence_item; function void post_randomize(); foreach( table[i] ) { foreach( table[j] ) { if( i != j ) table[i] != table[j]; } endfunction endclass foreach moved from constraint block from previous slide

Sponsored By: 8 of 15 Coding for memory usage Speed is not the only measure of randomization performance. Large memory usage can drive slow solver performance. Very large memory usage can push 32bit simulations to 64bit mode, resulting in a double performance impact. Particular trouble spot - look out for classes randomizing large tables simultaneously.

Sponsored By: 9 of 15 Coding for productivity Organize your classes and constraints for re-use & ease of maintenance. Break up into units and features or algorithms –Crucial for large classes with many complex constraints Separate variables from constraint code. –As UVC’s evolve and grow, a clear separation makes it easier to upgrade and modify. Top Level Constraint Lower level constraint instantiation and constraint blocks Unit1 Algorithm1 Feature1

Sponsored By: 10 of 15 Coding for productivity Organize your constraints into multiple constraint blocks –A single large constraint block is harder for others to understand & debug. –Break constraints into blocks based on purpose. –This also makes it easier when classes are extended and constraint functionality is augmented or replaced. class device_config extends uvm_object; rand mode_type mode; rand int max_size; constraint half_mode_defaults { if( mode == HALF ) { max_size == 1024; } } constraint full_mode_defaults { if( mode == FULL ) { max_size == 512; } } endclass class device_config extends uvm_object; rand mode_type mode; rand int max_size; constraint half_mode_defaults { if( mode == HALF ) { max_size == 1024; } } constraint full_mode_defaults { if( mode == FULL ) { max_size == 512; } } endclass

Sponsored By: 11 of 15 Coding for productivity Use macros to replace repetitive code. –Simplification and readability constraint_macro_example { x inside {[-50:50]}; y inside {[-50:50]}; max_value inside {[ 0:100 ]}; if(x < 0 && y < 0 ) –x-y <= max_value; if(x > 0 && y < 0 ) x-y <= max_value; if(x 0 ) y-x <= max_value; if(x > 0 && y > 0 ) x+y <= max_value; } constraint_macro_example { x inside {[-50:50]}; y inside {[-50:50]}; max_value inside {[ 0:100 ]}; if(x < 0 && y < 0 ) –x-y <= max_value; if(x > 0 && y < 0 ) x-y <= max_value; if(x 0 ) y-x <= max_value; if(x > 0 && y > 0 ) x+y <= max_value; } `define ABS(value) (((value) < 0) ? (-(value)) : (value)) constraint_macro_example { x inside {[-50:50]}; y inside {[-50:50]}; max_value inside {[ 0:100 ]}; `ABS(x) + `ABS(y) <= max_value; } `define ABS(value) (((value) < 0) ? (-(value)) : (value)) constraint_macro_example { x inside {[-50:50]}; y inside {[-50:50]}; max_value inside {[ 0:100 ]}; `ABS(x) + `ABS(y) <= max_value; } Same as above with simplification through macros

Sponsored By: 12 of 15 Coding for productivity Avoid modifying random fields manually after randomization –There is a temptation to hand modify the results of a randomize call to achieve a specific result. –It can be difficult for users other than the original developer to understand what is happening. –Limit modification of rand variables to constraint expressions, and pre_/post_randomize calls. –If it is difficult to achieve a specific result, consider restructuring the problem – perhaps breaking it into a number of smaller expressions/ –Let the constraint solver do the work for you!

Sponsored By: 13 of 15 Coding for productivity Build stand alone environments to test classes with complex randomization. These environments can often be built in just a few minutes. They make it easier to: –Compile, build, and simulate –Prototype new code and try new experiments quickly –Run many more iterations than in a regular test These standalone environments can be placed in a regression suite to catch inadvertent errors caused by code changes.

Sponsored By: 14 of 15 Thank You! Developing fast, easy to work with randomization code in UVM environments is critical. By following simple rules, this is a straightforward process. Special thanks to the IBM Cores team for ideas, suggestions, and real world examples that have tested these concepts.