Testing for unknowns or don't cares 
Author Message
 Testing for unknowns or don't cares

I am currently building a test bench which reads in output check vectors
from a system file into a memory array on the bench. Some of the vectors
are don't cares or unknowns e.g.
XXXXXXXXXXXX

I'd like to be able to check for vectors like 12'bXXXXXXXXXXXX but my
test doesn't seem to pick them up. Is testing for unknown values
impossible. Here's the offending piece of code:


  if (YReRef == 12'bXXXXXXXXXXXX | YImRef == 12'bXXXXXXXXXXXX |
      YReRef == 12'bxxxxxxxxxxxx | YImRef == 12'bxxxxxxxxxxxx) CheckY <=
1'b0;
  else CheckY <= 1'b1;

I'd really appreciate it if anyone could tell me whether this ought to
work or not.

Thanks

Rick



Mon, 03 Jun 2002 03:00:00 GMT  
 Testing for unknowns or don't cares

Quote:

> I am currently building a test bench which reads in output check vectors
> from a system file into a memory array on the bench. Some of the vectors
> are don't cares or unknowns e.g.
> XXXXXXXXXXXX

> Rick

Keep in mind following tables, as seen in 'Verilog Designer's Library'
by
Zeidmann:

==      |       'b0     'b1     'bX     'bZ
-------------------------------------------
'b0     |       'b1     'b0     'bX     'bX
'b1     |       'b0     'b1     'bX     'bX
'bX     |       'bX     'bX     'bX     'bX
'bZ     |       'bX     'bX     'bX     'bX

===     |       'b0     'b1     'bX     'bZ
-------------------------------------------
'b0     |       'b1     'b0     'b0     'b0
'b1     |       'b0     'b1     'b0     'b0
'bX     |       'b0     'b0     'b1     'b0
'bZ     |       'b0     'b0     'b0     'b1

Check out, what your tool will do with '===' ;-)

regards,
hsank.



Mon, 03 Jun 2002 03:00:00 GMT  
 Testing for unknowns or don't cares

Quote:

> I am currently building a test bench which reads in output check vectors
> from a system file into a memory array on the bench. Some of the vectors
> are don't cares or unknowns e.g.
> XXXXXXXXXXXX

> I'd like to be able to check for vectors like 12'bXXXXXXXXXXXX but my
> test doesn't seem to pick them up. Is testing for unknown values
> impossible. Here's the offending piece of code:


>   if (YReRef == 12'bXXXXXXXXXXXX | YImRef == 12'bXXXXXXXXXXXX |
>       YReRef == 12'bxxxxxxxxxxxx | YImRef == 12'bxxxxxxxxxxxx) CheckY <=
> 1'b0;
>   else CheckY <= 1'b1;

> I'd really appreciate it if anyone could tell me whether this ought to
> work or not.

> Thanks

> Rick

A real simple way to check for unknowns in a vector is to see if the
vector is not equal to itself.  In verilog, all logical comparisons
fail in the presense of an X or a Z. Therefore the code

        if ( A == A ) ; else $display("A has unknown values: %b",A);

will catch the case where A is 4'bxxxx, or 4'b00z0, or similar.

--

  _    //     Verisity Design              408-374-4100 x 100
   \  //      <http://www.verisity.com>    408-374-4174 FAX
    \//erisity                 Formerly SureFire Verification
--------------------------------------------------------------
Get my verilog emacs mode from
                  <http://www.surefirev.com/verilog-mode.html>



Mon, 03 Jun 2002 03:00:00 GMT  
 Testing for unknowns or don't cares
Testing for X and Z values is possible, but you need to use ===
and !== rather than == and !=

== will never return true on a comparison against X.

Neal.



Tue, 18 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. UnInit, Weak Unknown, Don't Care Signals

2. don't care the dryers strongly, mould them partly

3. don't care the dryers strongly, mould them partly

4. don't care the dryers strongly, mould them partly

5. Don't care states in decoders

6. Don't Care in a with...select?

7. Don't cares in expressions

8. Don't care in VHDL ???

9. How to deal with Don't cares

10. don't care in vhdl..

11. Don't cares in std_logic_vector

12. Don't care for integer?

 

 
Powered by phpBB® Forum Software