[sv-ec] are constraints virtual like?

From: Daniel Mlynek <daniel.mlynek@aldec.com.pl>
Date: Wed Sep 08 2010 - 01:10:12 PDT

Please see the below code. I'm using constraints mode on a handle of base
class type pointing to child class. (there are constraints with same name in
base and child class)
My question is how it should behave.. Should it turn off only the constraint
from base class or both constraints or should it behave virtual like and
turn of child class constraint?
 
class C;
    rand int a;
    constraint con1{a==0;}
endclass

class D extends C;
    constraint con1{a==10;}
endclass

module top;
    C c;
    D d = new;
    initial begin
        c = d;
        c.con1.constraint_mode(0);
        
        c.randomize();
        $display(c.a);
                      
        d.randomize();
        $display(c.a);
    end
    
endmodule

 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Sep 8 01:10:28 2010

This archive was generated by hypermail 2.1.8 : Wed Sep 08 2010 - 01:10:54 PDT