SlideShare a Scribd company logo
Preeti Punia
12ECP035
VLSI Design (3rd Semester)
RANDOMIZATION
Introduction
 Creating environment for CRT (constrained-random tests)
takes more work than creating one for directed tests
 CRT requires an environment to predict the result, using a reference
model, transfer function, or other techniques, plus functional
coverage to measure the effectiveness of the stimulus
 Once this environment is in place, you can run hundreds of tests
without having to hand-check the results, thereby improving your
productivity
 This tradeoff of test-authoring time (your work) for CPU time
(machine work) is what makes CRT so valuable
Continued…
 When the number of features increases on a
project, it is difficult to write directed test cases.
 A directed test finds the bugs you think are there,
but a CRT( Constrained Random Tests) finds
bugs you never thought about by giving random
stimulus.
 Constraints are applied according to the interest
and valid restrictions.
 A CRT is made of two parts: the test code that uses a stream of random
values to create input to the DUT, and a seed to the pseudo-random
number generator (PRNG)
What to Randomize
All design inputs:
 Device configuration
 Environment configuration
 Primary input data
 Encapsulated input data
 Protocol exceptions
 Errors and violations
 Delays
 Transaction status
What to Randomize
Device and Environment Configuration
 Environment contains other components
 Randomize the entire environment configuration,
including the length of the simulation, number of
devices, and how they are configured
 Other environment parameters include test length,
error injection rates, and delay modes
Primary Input Data
 All the inputs to the DUT must be randomized
What to Randomize
Encapsulated Input Data
 Many devices process multiple layers of stimulus
 Example, a device may create TCP traffic that is then
encoded in the IP protocol, and finally sent out inside
Ethernet packets
 Each level has its own control fields that can be
randomized to try new combinations
 So you are randomizing the data and the layers that
surround it
 You need to write constraints that create valid control
fields but that also allow injecting errors
What to Randomize
Protocol Exceptions, Errors, and Violations
 PC or cell phone locks up. Many times, the only cure is to shut it
down and restart because deep inside the product there is a piece of
logic that experienced some sort of error condition from which it
could not recover and thus prevented the device from working
correctly
 If something can go wrong in the real hardware, you should try to
simulate it. Look at all the errors that can occur
 You can disable the code that stops simulation on error so that you
can easily test error handling
Delays and Synchronization
 How fast should your test bench send in stimulus?
 Coordinate the various drivers so they can communicate at different
timing rates
Randomization in SystemVerilog
Simple Class with Random Variables
Randomization in SystemVerilog
 Four random variables:
 First three use the rand modifier, so that every time you
randomize the class, the variables are assigned a value
 kind variable is randc , which means random cyclic, so that the
random solver does not repeat a random value until every
possible value has been assigned
 Constraint expression is grouped using curly braces: {} because
this code is declarative, not procedural, which uses begin…end
 The randomize function returns 0 if a problem is found with the
constraints
 The code checks the result and stops simulation with $finish if
there is a problem
Randomization in SystemVerilog
 You should not randomize an object in the class constructor
 Your test may need to turn constraints on or off, change weights,
or even add new constraints before randomization
 The constructor is for initializing the object’s variables, and if
you called randomize at this early stage, you might end up
throwing away the results
 Variables in your classes should be random and public. This
gives your test the most control over the DUT’s stimulus and
control
Randomization in SystemVerilog
Checking the Result from Randomization
 Randomization check macro and example
Randomization in SystemVerilog
The Constraint Solver
 Solver chooses values that satisfy the constraints
 Values come from SystemVerilog’s PRNG, that is started with an
initial seed
 Same seed and the same testbench always produce the same results
 Changing the tool version or switches such as debug level can
change results
 Solver is specific to the simulation vendor, and a constrained-random
test may not give the same results when run on different simulators,
or even on different versions of the same tool
 SystemVerilog standard specifies the meaning of the expressions,
and the legal values that are created, but does not detail the precise
order in which the solver should operate
Constraint Details
Constraint Introduction
 Constrained-random class
Constraint Details
Inside Operator
 Create sets of values with the inside operator
 Inverted random set constraint
Constraint Details
Using an Array in a Set
 Random set constraint for an array
 Choose any value except those in an array
Constraint Details
Bidirectional Constraints
 Constraints are solved bi-directionally, which means that the
constraints on all random variables are solved concurrently
 Adding or removing a constraint on any one variable affects the
value chosen for all variables that are related directly or
indirectly
Constraint Details
 Solutions for bidirectional constraint
Implication Constraints
 There are two implication operators, -> and if
Constraint Details
 Constraint block with implication operator
 Implication operator
Constraint Details
 Constraint block with if implication operator
 Constraint block with if-else operator
Constraint Details
Equivalence Operator
 <-> is bidirectional
 A<−>B is defined as ((A->B) && (B->A))
 Equivalence constraint
 When d is true, e must also be true, and when d is false, e must
also be false
 So this operator is the same as a logical XNOR
Solution Probabilities
 Class Unconstrained
 Solutions for Unconstrained class
Solution Probabilities
 Class with implication constraint
 Solutions for Imp1 class
Solution Probabilities
 Class with implication and solve…before
 Solutions for solve x before y constraint
In-Line Constraints
 Many tests only randomize objects at one place in the code
 You can add extra constraint using randomize with . This is equivalent to
adding an extra constraint to any existing ones in effect
Building a Bathtub Distribution
 Bathtub shaped distribution; high on both ends,
and low in the middle
Building a Bathtub Distribution
Random Number Functions
 $random — Flat distribution, returning signed 32-bit random
 $urandom — Flat distribution, returning unsigned 32-bit random
 $urandom_range — Flat distribution over a range
 $dist_exponential — Exponential decay
 $dist_normal — Bell-shaped distribution
 $dist_poisson — Bell-shaped distribution
 $dist_uniform — Flat distribution
$urandom range usage
Constraints with Variables
 This class creates random lengths between 1 and
100.
 By changing the variable max_length , you can
vary the upper limit.
Using Nonrandom Values
 rand_mode function
When you call this method with the argument 0
for a random variable, the rand or randc qualifier
is disabled and the variable’s value is no longer
changed by the random solver.
 Setting the random mode to 1 turns the qualifier
back on so the variable can changed by the
solver
Checking Values Using
Constraints
 handle.randomize(null)
SystemVerilog treats all variables as nonrandom
and just ensures that all constraints are satisfied,
i.e all expressions are true.
 If any constraints are not satisfied, the randomize
function returns 0.
Randomizing Individual
Variables
 If you want to randomize a few variables inside a
class, You can call randomize with the subset of
variables
Turn Constraints Off and On
 constraint_mode:- You can control a single
constraint with handle. constraint. constraint_mode
(arg).
Specifying a Constraint in a Test with External
Constraints
 The body of a constraint does not have to be defined
within the class, just as a routine body can be defined
externally
 Advantage over in-line constraints is that it can be
reused between tests.
Common Randomization
Problems
Use Signed Variables with Care
 you may be tempted to use the int, byte , or other
signed datatypes.
 Don’t use them in random constraints unless you
really want signed values
 you could get pairs of values such as (32, 32) and
(2, 62).
 (−63, 127) can also be a solution of the equation.
 To avoid meaningless values such as negative
lengths, use only unsigned random variables
Thank you

More Related Content

What's hot

UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
Arrow Devices
 
System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
Nirav Desai
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
Azad Mishra
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
Amal Khailtash
 
ASIC design verification
ASIC design verificationASIC design verification
ASIC design verification
Gireesh Kallihal
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
Akhil Srivastava
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
Rohit Kumar Pathak
 
System verilog important
System verilog importantSystem verilog important
System verilog important
elumalai7
 
Data types in verilog
Data types in verilogData types in verilog
Data types in verilog
Nallapati Anindra
 
UVM TUTORIAL;
UVM TUTORIAL;UVM TUTORIAL;
UVM TUTORIAL;
Azad Mishra
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification
Usha Mehta
 
Coverage and Introduction to UVM
Coverage and Introduction to UVMCoverage and Introduction to UVM
Coverage and Introduction to UVM
Dr. Shivananda Koteshwar
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
Vinchipsytm Vlsitraining
 
PCIe
PCIePCIe
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
Jamal EL HAITOUT
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
Ramdas Mozhikunnath
 
Introduction about APB Protocol
Introduction about APB ProtocolIntroduction about APB Protocol
Introduction about APB Protocol
Pushpa Yakkala
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
Dhaval Kaneria
 
AMBA 2.0 PPT
AMBA 2.0 PPTAMBA 2.0 PPT
AMBA 2.0 PPT
Nirav Desai
 

What's hot (20)

UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
 
System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
ASIC design verification
ASIC design verificationASIC design verification
ASIC design verification
 
Uvm presentation dac2011_final
Uvm presentation dac2011_finalUvm presentation dac2011_final
Uvm presentation dac2011_final
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 
System verilog important
System verilog importantSystem verilog important
System verilog important
 
Data types in verilog
Data types in verilogData types in verilog
Data types in verilog
 
UVM TUTORIAL;
UVM TUTORIAL;UVM TUTORIAL;
UVM TUTORIAL;
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification
 
Coverage and Introduction to UVM
Coverage and Introduction to UVMCoverage and Introduction to UVM
Coverage and Introduction to UVM
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
 
PCIe
PCIePCIe
PCIe
 
Uvm dac2011 final_color
Uvm dac2011 final_colorUvm dac2011 final_color
Uvm dac2011 final_color
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
 
Introduction about APB Protocol
Introduction about APB ProtocolIntroduction about APB Protocol
Introduction about APB Protocol
 
Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)Serial Peripheral Interface(SPI)
Serial Peripheral Interface(SPI)
 
AMBA 2.0 PPT
AMBA 2.0 PPTAMBA 2.0 PPT
AMBA 2.0 PPT
 

Viewers also liked

Methods of randomization final
Methods of randomization finalMethods of randomization final
Methods of randomization final
dollie22
 
Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4
Sanchit Rastogi
 
Clinical trials Phase3 ppt
Clinical trials Phase3 pptClinical trials Phase3 ppt
Clinical trials Phase3 ppt
SUDEEP
 
Randomisation techniques
Randomisation techniquesRandomisation techniques
Randomisation techniques
Urmila Aswar
 
Randomized Controlled Trial
Randomized Controlled Trial Randomized Controlled Trial
Randomized Controlled Trial
Sumit Das
 
Randomised controlled trials
Randomised controlled trialsRandomised controlled trials
Randomised controlled trials
Hesham Gaber
 
Tests of significance
Tests of significanceTests of significance
Tests of significance
Shubhanshu Gupta
 
Randomization
Randomization Randomization
Randomization
Bhaswat Chakraborty
 
Sample size
Sample sizeSample size
Sample size
zubis
 

Viewers also liked (9)

Methods of randomization final
Methods of randomization finalMethods of randomization final
Methods of randomization final
 
Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4
 
Clinical trials Phase3 ppt
Clinical trials Phase3 pptClinical trials Phase3 ppt
Clinical trials Phase3 ppt
 
Randomisation techniques
Randomisation techniquesRandomisation techniques
Randomisation techniques
 
Randomized Controlled Trial
Randomized Controlled Trial Randomized Controlled Trial
Randomized Controlled Trial
 
Randomised controlled trials
Randomised controlled trialsRandomised controlled trials
Randomised controlled trials
 
Tests of significance
Tests of significanceTests of significance
Tests of significance
 
Randomization
Randomization Randomization
Randomization
 
Sample size
Sample sizeSample size
Sample size
 

Similar to Ch 6 randomization

ppt.pptx
ppt.pptxppt.pptx
ppt.pptx
ssuser700244
 
5 black box and grey box testing
5   black box and grey box testing5   black box and grey box testing
5 black box and grey box testing
Yisal Khan
 
Testing
TestingTesting
Testing
nazeer pasha
 
SWE-6 TESTING.pptx
SWE-6 TESTING.pptxSWE-6 TESTING.pptx
SWE-6 TESTING.pptx
prashant821809
 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test
Gregory Solovey
 
Machine learning Mind Map
Machine learning Mind MapMachine learning Mind Map
Machine learning Mind Map
Ashish Patel
 
prova4
prova4prova4
prova4
mbsoftware
 
provalast
provalastprovalast
provalast
mbsoftware
 
test3
test3test3
test
testtest
prova2
prova2prova2
prova2
mbsoftware
 
testsfw2
testsfw2testsfw2
prova2
prova2prova2
prova2
mbsoftware
 
testsfw3
testsfw3testsfw3
test2
test2test2
finalelocale
finalelocalefinalelocale
finalelocale
lmscollaborative2
 
testsfw7
testsfw7testsfw7
testsfw4
testsfw4testsfw4
domenica3
domenica3domenica3

Similar to Ch 6 randomization (20)

ppt.pptx
ppt.pptxppt.pptx
ppt.pptx
 
5 black box and grey box testing
5   black box and grey box testing5   black box and grey box testing
5 black box and grey box testing
 
Testing
TestingTesting
Testing
 
SWE-6 TESTING.pptx
SWE-6 TESTING.pptxSWE-6 TESTING.pptx
SWE-6 TESTING.pptx
 
Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test Model Driven Testing: requirements, models & test
Model Driven Testing: requirements, models & test
 
Machine learning Mind Map
Machine learning Mind MapMachine learning Mind Map
Machine learning Mind Map
 
prova4
prova4prova4
prova4
 
provalast
provalastprovalast
provalast
 
test3
test3test3
test3
 
test
testtest
test
 
prova2
prova2prova2
prova2
 
testsfw2
testsfw2testsfw2
testsfw2
 
prova2
prova2prova2
prova2
 
testsfw3
testsfw3testsfw3
testsfw3
 
 
test2
test2test2
test2
 
finalelocale
finalelocalefinalelocale
finalelocale
 
testsfw7
testsfw7testsfw7
testsfw7
 
testsfw4
testsfw4testsfw4
testsfw4
 
domenica3
domenica3domenica3
domenica3
 

More from Team-VLSI-ITMU

Intermediate Fabrics
Intermediate FabricsIntermediate Fabrics
Intermediate Fabrics
Team-VLSI-ITMU
 
RTX Kernal
RTX KernalRTX Kernal
RTX Kernal
Team-VLSI-ITMU
 
CNTFET
CNTFETCNTFET
scripting in Python
scripting in Pythonscripting in Python
scripting in Python
Team-VLSI-ITMU
 
Placement in VLSI Design
Placement in VLSI DesignPlacement in VLSI Design
Placement in VLSI Design
Team-VLSI-ITMU
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagram
Team-VLSI-ITMU
 
Nmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolNmos design using synopsys TCAD tool
Nmos design using synopsys TCAD tool
Team-VLSI-ITMU
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
Team-VLSI-ITMU
 
CAD: Floorplanning
CAD: Floorplanning CAD: Floorplanning
CAD: Floorplanning
Team-VLSI-ITMU
 
CAD: Layout Extraction
CAD: Layout ExtractionCAD: Layout Extraction
CAD: Layout Extraction
Team-VLSI-ITMU
 
CAD: introduction to floorplanning
CAD:  introduction to floorplanningCAD:  introduction to floorplanning
CAD: introduction to floorplanning
Team-VLSI-ITMU
 
Computer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionComputer Aided Design: Layout Compaction
Computer Aided Design: Layout Compaction
Team-VLSI-ITMU
 
Computer Aided Design: Global Routing
Computer Aided Design:  Global RoutingComputer Aided Design:  Global Routing
Computer Aided Design: Global Routing
Team-VLSI-ITMU
 
floor planning
floor planningfloor planning
floor planning
Team-VLSI-ITMU
 
Cmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technologyCmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technology
Team-VLSI-ITMU
 
SRAM- Ultra low voltage operation
SRAM- Ultra low voltage operationSRAM- Ultra low voltage operation
SRAM- Ultra low voltage operation
Team-VLSI-ITMU
 
All opam assignment2_main
All opam assignment2_mainAll opam assignment2_main
All opam assignment2_main
Team-VLSI-ITMU
 
MOSFET Small signal model
MOSFET Small signal modelMOSFET Small signal model
MOSFET Small signal model
Team-VLSI-ITMU
 
twin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCADtwin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCAD
Team-VLSI-ITMU
 

More from Team-VLSI-ITMU (19)

Intermediate Fabrics
Intermediate FabricsIntermediate Fabrics
Intermediate Fabrics
 
RTX Kernal
RTX KernalRTX Kernal
RTX Kernal
 
CNTFET
CNTFETCNTFET
CNTFET
 
scripting in Python
scripting in Pythonscripting in Python
scripting in Python
 
Placement in VLSI Design
Placement in VLSI DesignPlacement in VLSI Design
Placement in VLSI Design
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagram
 
Nmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolNmos design using synopsys TCAD tool
Nmos design using synopsys TCAD tool
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
CAD: Floorplanning
CAD: Floorplanning CAD: Floorplanning
CAD: Floorplanning
 
CAD: Layout Extraction
CAD: Layout ExtractionCAD: Layout Extraction
CAD: Layout Extraction
 
CAD: introduction to floorplanning
CAD:  introduction to floorplanningCAD:  introduction to floorplanning
CAD: introduction to floorplanning
 
Computer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionComputer Aided Design: Layout Compaction
Computer Aided Design: Layout Compaction
 
Computer Aided Design: Global Routing
Computer Aided Design:  Global RoutingComputer Aided Design:  Global Routing
Computer Aided Design: Global Routing
 
floor planning
floor planningfloor planning
floor planning
 
Cmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technologyCmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technology
 
SRAM- Ultra low voltage operation
SRAM- Ultra low voltage operationSRAM- Ultra low voltage operation
SRAM- Ultra low voltage operation
 
All opam assignment2_main
All opam assignment2_mainAll opam assignment2_main
All opam assignment2_main
 
MOSFET Small signal model
MOSFET Small signal modelMOSFET Small signal model
MOSFET Small signal model
 
twin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCADtwin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCAD
 

Recently uploaded

VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
PIMR BHOPAL
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
morris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdfmorris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdf
ycwu0509
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
CVCSOfficial
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
mahaffeycheryld
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 

Recently uploaded (20)

VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
morris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdfmorris_worm_intro_and_source_code_analysis_.pdf
morris_worm_intro_and_source_code_analysis_.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
Generative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdfGenerative AI Use cases applications solutions and implementation.pdf
Generative AI Use cases applications solutions and implementation.pdf
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 

Ch 6 randomization

  • 1. Preeti Punia 12ECP035 VLSI Design (3rd Semester) RANDOMIZATION
  • 2. Introduction  Creating environment for CRT (constrained-random tests) takes more work than creating one for directed tests  CRT requires an environment to predict the result, using a reference model, transfer function, or other techniques, plus functional coverage to measure the effectiveness of the stimulus  Once this environment is in place, you can run hundreds of tests without having to hand-check the results, thereby improving your productivity  This tradeoff of test-authoring time (your work) for CPU time (machine work) is what makes CRT so valuable
  • 3. Continued…  When the number of features increases on a project, it is difficult to write directed test cases.  A directed test finds the bugs you think are there, but a CRT( Constrained Random Tests) finds bugs you never thought about by giving random stimulus.  Constraints are applied according to the interest and valid restrictions.  A CRT is made of two parts: the test code that uses a stream of random values to create input to the DUT, and a seed to the pseudo-random number generator (PRNG)
  • 4. What to Randomize All design inputs:  Device configuration  Environment configuration  Primary input data  Encapsulated input data  Protocol exceptions  Errors and violations  Delays  Transaction status
  • 5. What to Randomize Device and Environment Configuration  Environment contains other components  Randomize the entire environment configuration, including the length of the simulation, number of devices, and how they are configured  Other environment parameters include test length, error injection rates, and delay modes Primary Input Data  All the inputs to the DUT must be randomized
  • 6. What to Randomize Encapsulated Input Data  Many devices process multiple layers of stimulus  Example, a device may create TCP traffic that is then encoded in the IP protocol, and finally sent out inside Ethernet packets  Each level has its own control fields that can be randomized to try new combinations  So you are randomizing the data and the layers that surround it  You need to write constraints that create valid control fields but that also allow injecting errors
  • 7. What to Randomize Protocol Exceptions, Errors, and Violations  PC or cell phone locks up. Many times, the only cure is to shut it down and restart because deep inside the product there is a piece of logic that experienced some sort of error condition from which it could not recover and thus prevented the device from working correctly  If something can go wrong in the real hardware, you should try to simulate it. Look at all the errors that can occur  You can disable the code that stops simulation on error so that you can easily test error handling Delays and Synchronization  How fast should your test bench send in stimulus?  Coordinate the various drivers so they can communicate at different timing rates
  • 8. Randomization in SystemVerilog Simple Class with Random Variables
  • 9. Randomization in SystemVerilog  Four random variables:  First three use the rand modifier, so that every time you randomize the class, the variables are assigned a value  kind variable is randc , which means random cyclic, so that the random solver does not repeat a random value until every possible value has been assigned  Constraint expression is grouped using curly braces: {} because this code is declarative, not procedural, which uses begin…end  The randomize function returns 0 if a problem is found with the constraints  The code checks the result and stops simulation with $finish if there is a problem
  • 10. Randomization in SystemVerilog  You should not randomize an object in the class constructor  Your test may need to turn constraints on or off, change weights, or even add new constraints before randomization  The constructor is for initializing the object’s variables, and if you called randomize at this early stage, you might end up throwing away the results  Variables in your classes should be random and public. This gives your test the most control over the DUT’s stimulus and control
  • 11. Randomization in SystemVerilog Checking the Result from Randomization  Randomization check macro and example
  • 12. Randomization in SystemVerilog The Constraint Solver  Solver chooses values that satisfy the constraints  Values come from SystemVerilog’s PRNG, that is started with an initial seed  Same seed and the same testbench always produce the same results  Changing the tool version or switches such as debug level can change results  Solver is specific to the simulation vendor, and a constrained-random test may not give the same results when run on different simulators, or even on different versions of the same tool  SystemVerilog standard specifies the meaning of the expressions, and the legal values that are created, but does not detail the precise order in which the solver should operate
  • 14. Constraint Details Inside Operator  Create sets of values with the inside operator  Inverted random set constraint
  • 15. Constraint Details Using an Array in a Set  Random set constraint for an array  Choose any value except those in an array
  • 16. Constraint Details Bidirectional Constraints  Constraints are solved bi-directionally, which means that the constraints on all random variables are solved concurrently  Adding or removing a constraint on any one variable affects the value chosen for all variables that are related directly or indirectly
  • 17. Constraint Details  Solutions for bidirectional constraint Implication Constraints  There are two implication operators, -> and if
  • 18. Constraint Details  Constraint block with implication operator  Implication operator
  • 19. Constraint Details  Constraint block with if implication operator  Constraint block with if-else operator
  • 20. Constraint Details Equivalence Operator  <-> is bidirectional  A<−>B is defined as ((A->B) && (B->A))  Equivalence constraint  When d is true, e must also be true, and when d is false, e must also be false  So this operator is the same as a logical XNOR
  • 21. Solution Probabilities  Class Unconstrained  Solutions for Unconstrained class
  • 22. Solution Probabilities  Class with implication constraint  Solutions for Imp1 class
  • 23. Solution Probabilities  Class with implication and solve…before  Solutions for solve x before y constraint
  • 24. In-Line Constraints  Many tests only randomize objects at one place in the code  You can add extra constraint using randomize with . This is equivalent to adding an extra constraint to any existing ones in effect
  • 25. Building a Bathtub Distribution  Bathtub shaped distribution; high on both ends, and low in the middle
  • 26. Building a Bathtub Distribution
  • 27. Random Number Functions  $random — Flat distribution, returning signed 32-bit random  $urandom — Flat distribution, returning unsigned 32-bit random  $urandom_range — Flat distribution over a range  $dist_exponential — Exponential decay  $dist_normal — Bell-shaped distribution  $dist_poisson — Bell-shaped distribution  $dist_uniform — Flat distribution $urandom range usage
  • 28. Constraints with Variables  This class creates random lengths between 1 and 100.  By changing the variable max_length , you can vary the upper limit.
  • 29. Using Nonrandom Values  rand_mode function When you call this method with the argument 0 for a random variable, the rand or randc qualifier is disabled and the variable’s value is no longer changed by the random solver.  Setting the random mode to 1 turns the qualifier back on so the variable can changed by the solver
  • 30.
  • 31. Checking Values Using Constraints  handle.randomize(null) SystemVerilog treats all variables as nonrandom and just ensures that all constraints are satisfied, i.e all expressions are true.  If any constraints are not satisfied, the randomize function returns 0.
  • 32. Randomizing Individual Variables  If you want to randomize a few variables inside a class, You can call randomize with the subset of variables
  • 33. Turn Constraints Off and On  constraint_mode:- You can control a single constraint with handle. constraint. constraint_mode (arg).
  • 34. Specifying a Constraint in a Test with External Constraints  The body of a constraint does not have to be defined within the class, just as a routine body can be defined externally  Advantage over in-line constraints is that it can be reused between tests.
  • 36. Use Signed Variables with Care  you may be tempted to use the int, byte , or other signed datatypes.  Don’t use them in random constraints unless you really want signed values
  • 37.  you could get pairs of values such as (32, 32) and (2, 62).  (−63, 127) can also be a solution of the equation.  To avoid meaningless values such as negative lengths, use only unsigned random variables