Lect 31 - Directed Radom Test

Download Report

Transcript Lect 31 - Directed Radom Test

Directed Random Test
10/2/08 - Directed Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
1
Lecture overview

Open discussion of Verification Plan on
Project A




Verification Plans are living documents ???
Generation of Random Stimulus
Directed Random Tests
An Example
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
2
Generation of Random Stimulus



“Random stimulus is created by a random
generator that can be constrained according to
the verification plan.”
Often used for automatic generation of test
stimulus.
And easy way to generate many test cases
(transactions) easily.
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
3
Totally Random vs Constrained Random

Consider the Floating Point Adder

If the 32 bits are randomly generated



Most likely a normalized number (probability very
high)
Occurrences of NaN, +/- Inif, and 0 will be very
minimal – some may not even occur over several
thousand vectors
Constrain the random generation so that all cases
are adequately covered.
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
4
Testing the Floating Point Adder

Step 1 – have adequate test of each class +/each other class

Nan and each of





+/- Inifity
+/- 0
+/- Normalized number
+/- Denormalized number
For the case of normalized and denormalized
must have adequate number of case to insure
conficence
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
5
Continuing the tests

For +/- Inifinity




For +/- 0



+/- 0
+/- Normalized numbers
+/- Denormalized
+/- Normalized numbers
+/- Denormalized
As there + and – representations must do the tests
for both and across an adequate number of
vectors for each case to insure confidence
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
6
The real work


Special cases covered – Nan, Inif, and 0 are
specific formats and limited to just 6 vectors
Normalized and denormalized vectors make
up the rest of the 264 vector space with
normalized number making up the bulk of that
space.
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
7
Specific tests for these

Special cases that you want to test for – and you want
more than testing one instance




You add two large normalized numbers and the result is
the largest representable normalized number
You add two large normalized numbers and the result
overflows to Inifinity
You add a large normalized number and a small
normalized number and the result is the largest
representable normalized number
You add a large normalized numbers and a small
normalized number and the result overflows to Infinity
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
8
Test for the other boundary

Test for the normalized/denormalized
boundary

Add/Subtract two normalized numbers with the
result being



The smallest normalized number
The largest denormalized number
Add/Subtract a normalized number and a
denormalized number with the result beign


10/2/08 - Directed
Random Test
The smallest normalized number
The largest denormalized number
Copyright 2008 - Joanne DeGroat, ECE, OSU
9
More test for the boundary

Add/Subtract two denormalized numbers with
the result beign



The smallest normalized number
The largest denormalized number
One you are confident you have the boundary
conditions covered you can now use random
test generation
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
10
The bulk of the operational space




These special cases are less than 1% of the total
test space.
Need to apply vectors such that your confidence
is high that all parts of the unit have been
sufficiently exercised.
Can design test vectors to specifically test having
a result with a leading 1 bit in each position.
Can have test vectors that result in no carry
ripple and those that have maximum carry ripple
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
11
The use of random


Can use constrained random to generate a lot of
test.
For normalized number operation - Start by
breaking up vector into fields.




The sign, the exponent and the fractional part
Generate the exponents randomly between 1 and 254
Generate the fractional part randomly – knowing you
have the assumed 1.
For Denormalized

Here only need the fractional part
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
12
Constraining the random

Want to subtract a normalized and
denormalized to get either a normalized or
denorm result.


Set the exponent and sign
Generate the fractional part randomly but
constrain the range of the random value generated
such that the result will be in a range to realized
the test objective.
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
13
Generation of Random Vectors

Numerous ways to generate the random
vectors




C or C++ program
MATLAB script or program
By hand (but only for very limited cases)
A combination of these and others
10/2/08 - Directed
Random Test
Copyright 2008 - Joanne DeGroat, ECE, OSU
14