SlideShare ist ein Scribd-Unternehmen logo
1 von 38
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

Weitere ähnliche Inhalte

Was ist angesagt?

System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertionsHARINATH REDDY
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology TutorialArrow Devices
 
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_verificationUsha Mehta
 
Basic concepts in Verilog HDL
Basic concepts in Verilog HDLBasic concepts in Verilog HDL
Basic concepts in Verilog HDLanand hd
 
System verilog control flow
System verilog control flowSystem verilog control flow
System verilog control flowPushpa Yakkala
 
verification_planning_systemverilog_uvm_2020
verification_planning_systemverilog_uvm_2020verification_planning_systemverilog_uvm_2020
verification_planning_systemverilog_uvm_2020Sameh El-Ashry
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummaryAmal Khailtash
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation finalAnkur Gupta
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?Sameh El-Ashry
 
Challenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelChallenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelDVClub
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0Azad Mishra
 

Was ist angesagt? (20)

System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertions
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
 
CPU Verification
CPU VerificationCPU Verification
CPU Verification
 
system verilog
system verilogsystem verilog
system verilog
 
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
 
Basic concepts in Verilog HDL
Basic concepts in Verilog HDLBasic concepts in Verilog HDL
Basic concepts in Verilog HDL
 
Ovm vs-uvm
Ovm vs-uvmOvm vs-uvm
Ovm vs-uvm
 
System verilog control flow
System verilog control flowSystem verilog control flow
System verilog control flow
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
verification_planning_systemverilog_uvm_2020
verification_planning_systemverilog_uvm_2020verification_planning_systemverilog_uvm_2020
verification_planning_systemverilog_uvm_2020
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation final
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?How to create SystemVerilog verification environment?
How to create SystemVerilog verification environment?
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
 
axi protocol
axi protocolaxi protocol
axi protocol
 
ASIC design verification
ASIC design verificationASIC design verification
ASIC design verification
 
Challenges in Using UVM at SoC Level
Challenges in Using UVM at SoC LevelChallenges in Using UVM at SoC Level
Challenges in Using UVM at SoC Level
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 

Andere mochten auch

Methods of randomization final
Methods of randomization finalMethods of randomization final
Methods of randomization finaldollie22
 
Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4Clinical Trial Phase 3 And 4
Clinical Trial Phase 3 And 4Sanchit Rastogi
 
Clinical trials Phase3 ppt
Clinical trials Phase3 pptClinical trials Phase3 ppt
Clinical trials Phase3 pptSUDEEP
 
Randomisation techniques
Randomisation techniquesRandomisation techniques
Randomisation techniquesUrmila 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 trialsHesham Gaber
 
Sample size
Sample sizeSample size
Sample sizezubis
 

Andere mochten auch (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
 

Ähnlich wie 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
 
test2
test2test2
test2
 
domenica3
domenica3domenica3
domenica3
 
provoora
provooraprovoora
provoora
 
remoto2
remoto2remoto2
remoto2
 
provacompleta2
provacompleta2provacompleta2
provacompleta2
 
finalelocale2
finalelocale2finalelocale2
finalelocale2
 
domenica2
domenica2domenica2
domenica2
 
provarealw4
provarealw4provarealw4
provarealw4
 
test2
test2test2
test2
 
prova3
prova3prova3
prova3
 
prova1
prova1prova1
prova1
 

Mehr von Team-VLSI-ITMU

Placement in VLSI Design
Placement in VLSI DesignPlacement in VLSI Design
Placement in VLSI DesignTeam-VLSI-ITMU
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagramTeam-VLSI-ITMU
 
Nmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolNmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolTeam-VLSI-ITMU
 
CAD: Layout Extraction
CAD: Layout ExtractionCAD: Layout Extraction
CAD: Layout ExtractionTeam-VLSI-ITMU
 
CAD: introduction to floorplanning
CAD:  introduction to floorplanningCAD:  introduction to floorplanning
CAD: introduction to floorplanningTeam-VLSI-ITMU
 
Computer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionComputer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionTeam-VLSI-ITMU
 
Computer Aided Design: Global Routing
Computer Aided Design:  Global RoutingComputer Aided Design:  Global Routing
Computer Aided Design: Global RoutingTeam-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 technologyTeam-VLSI-ITMU
 
SRAM- Ultra low voltage operation
SRAM- Ultra low voltage operationSRAM- Ultra low voltage operation
SRAM- Ultra low voltage operationTeam-VLSI-ITMU
 
All opam assignment2_main
All opam assignment2_mainAll opam assignment2_main
All opam assignment2_mainTeam-VLSI-ITMU
 
MOSFET Small signal model
MOSFET Small signal modelMOSFET Small signal model
MOSFET Small signal modelTeam-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 TCADTeam-VLSI-ITMU
 

Mehr von 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
 

Kürzlich hochgeladen

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 

Kürzlich hochgeladen (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 

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