In reply to dave_59:
In reply to ssureshg_:
Your solution always starts a 0.
In reply to ranju.ranjitha555@gmail.com:
You probably should add a constraint that prevents the increment from overflowing based on the number of times you expect to call randomize.
class A;
rand bit [15:0] data, increment;
constraint c_incr {
(const'(increment) != 0) -> {
increment == const'(increment);
data == const'(data) + increment;
}
increment inside {[1:10]};
}
endclass
module top;
A a = new();
initial repeat(10) begin
assert(a.randomize());
$display("%p",a);
end
endmodule
Hi Dave this if this need to be achieved without const keyword how could this be done
Is this const keyword is feasible with other simulators except Mentor questa?
As i tried to execute this with other simulators i’m seeing Error related to const.Can u suggest me how this can be resolved?