For the following class:
class CPacket;
int offset;
rand bit [3:0] sa, da;
int lo = 2, hi = 10;
constraint LimitA {
sa inside {[lo:hi]};
da inside {[lo:hi]};
}
function void pre_randomize();
if(this.offset) begin
lo = lo + offset;
hi = hi + offset;
end
endfunction
endclass
If I want to run this:
CPacket pkt = new();
pkt.offset = 100;
pkt.randomize();
Will it fail because that offset value makes the new lo and hi define a range of values that does not match 4-bit vector width?
Will it succeed and take the 4 LSBs of the new lo and hi to define the range of values that sa and da can have?
What happens in this situation?