Hi everyone,
I'm not sure if this is the right place to post this. I have question regarding the usage of $past(...) and the other members of that family inside procedural code. The SV 2012 standard says the following: "The use of these functions is not limited to assertion features; they may be used as expressions in procedural code as well."
I've tried using a call to $past(...) with an explicit clocking event inside a class task. One of our simulators complained that this is only allowed in assertions and procedural blocks. The other one we use allows it. The standard is rather vague here. What constitutes procedural code? Hopefully someone from the SV Committee hangs out in this forum.
Here's the code I'm trying.
module top;
bit clk;
bit some_signal;
always #1 clk = ~clk;
class some_class;
task some_task();
bit foo;
foo = $past(some_signal,,,@(negedge clk));
$display("some_signal was %b at the last negedge", foo);
endtask
endclass
initial begin
automatic some_class obj = new();
@(posedge clk);
some_signal <= 1;
@(negedge clk);
some_signal <= 0;
@(posedge clk);
obj.some_task();
$finish();
end
endmodule