[sv-ec] implication example


Subject: [sv-ec] implication example
From: Arturo Salz (Arturo.Salz@synopsys.com)
Date: Fri Mar 14 2003 - 11:07:50 PST


Just to close the discussion we had, here's an example of the
implication constraint we discussed, and 10 random solutions.

--------------------------------------------------------------------------------

class Implication;
    rand bit a, b;

    constraint foo { (a == 0) => (b == 0); }
endclass

program test;
    Implication p = new;

    repeat(10)
        if( p.randomize() )
            $display("a=%b b=%b\n", p.a, p.b );
        else
            $display("randomization failed\n");
endprogram

--------------------------------------------------------------------------------

The generates:
a=0 b=0
a=1 b=1
a=1 b=1
a=1 b=0
a=0 b=0
a=0 b=0
a=1 b=0
a=1 b=1
a=1 b=0
a=0 b=0

--------------------------------------------------------------------------------



This archive was generated by hypermail 2b28 : Fri Mar 14 2003 - 11:07:29 PST