The “($rose(clk1)” clocked with @(posedge clk1 means that @(posedge clk1) you are sampling the signal clk1 one delta time (i.e., just before) the posedge clk1. At that time, the sampling of clk1 has a value of ZERO!!! Also, you are using |-> (i.e., in the same cycle), thus the assertion will fail at $fell(A).
For my understanding, I understood the first part:
p_2cloks: assert property(@(posedge clk1) $fell(A) |=>
The following :
strong(1[*2])
Does this ensure clk1 is available for atleast 2 clocks when A transition from 1->0.
The assertion to be coded was “When A transition from 1->0, clk1 must be present for atleast 2 more clks”
Note: Signal A becomes 1 and 0 multiple times in the simulation. It is synchronous to clk1.
Also any pointers for understanding strong keyword.
The “assert property(@(posedge clk1) $fell(A) |=> strong(1[*2]);”
says "For every attempt. at (posedge clk1, if there is a $fell(A) then there must be 2 next posedge clk1.
If the simulation ends and that last attempt succeeded and started, but there were no 2 more posedge clk1, then that assertion fails because it is strong. Without the strong, it is ignored. Note that for each successful attempt, the assertion terminates and succeeds when there are 2 more posedge clk1. You can have Signal A becomes 1 and 0 multiple times in the simulation, and for each one, a new assertion thread is initiated.
Does that make sense?
Ben Cohen
Perhaps there is a misunderstanding in “CLK1 must be available for 2 clocks”. I have never seen a requirement written like that. Usually it is “must be at least 2 clocks before something else is allowed to happen”. What is that something else?
Agreed,it is odd. I took as some sort of ending condition with an enable for 2 more clocks. Weird, though! The author’s initial solution makes a good quizz about what’s wrong with the property.
Dave_59:
There can be cases in which “A” is a control signal which essentially could be a datavalid which could be consumed by an external module or block which buffer data and do some stuff with that.
Now since clk1 is the clk used to sample the data inside the external module, there might be requirement from the external module to provide the clk1 for at least some more clk(here its 2 clk1 clocks) for the external module to process the data/end the pipeline logic. This could be the scenario from which the property comes “A(control signal) when transition from 1->0 ensure at least 2 clk1 clocks are available”.
Given the requirements you have, a better solution that counts the number of successes and displays failures would be to use something as shown below where the lack of 2 clocks is flagged immediately because there is another path that fails if no 2 clocks. The concurrent assertions I wrote depends on the clocks, and the assertion would pass if, for instance, you get a fell(a) and no clocks for 10 seconds, and then 2 clocks.
module test;
bit a;
bit clk; // continuous clock
bit io_clk; // clock from io, in reponse to $fell(a)
event e;
always @(posedge clk)
if($fell(a)) -> e;
always begin
wait (e);
fork
begin
repeat(2) @ (posedge io_clk);
ap_pass2clocks: assert(1); // tool keeps count of successes
end
begin
repeat(3) @ (posedge clk);
ap_no2clocks: assert(0) else $display("did not receive expected IO clocks");
end
join_any
end
endmodule
always@(posedge clk1) begin
if(rst) begin
count_2_clk <=2’d0;
end
else if($fell(a)) begin
count_2_clk<=count_2_clk+1;
if(count_2_clk==2’d2)begin
count_2_clk<=2’d0;
end
end
end