Hello All,
I am having a constraint in my transaction.
class A
bit 3:0 a;
constraint c_a { a<4 ; }
endclass
In my extended class, can I do constraint like (a> 4) without soft constraint?
Can I do something like, I make constraint off of the parent class and then write the constraint in extended class.?
Please let me know.
Thanks in Advance. :)
In reply to Dhanesh_Padia:
It is simpler than that. If you give the constraint the same name in the extended class, it overrides the constraint in the base class.
class B extends A;
constraint c_a { a>4 ; }
endclass
You can also do what you originally thought by turning off constraints in the base class and adding more
class B extends A;
function new;
c_a.constraint_mode(0);
endfunction
constraint c_b { a>4 ; }
endclass