I need assertions about 2 asynchronous reset signal,they will be set at rtl module(verilog),two signals’ reset must has an overlap,so there will be 6 permitted situations or more,3 of them are below,the other 3 are src and dst signals swapped.I believe Immediate Assertions must be used since there is no clk,and the flag logic added,but I cannot handle it.
I really do not understand your requirements, but you can use this type of template to design your VF code. Essentially, you fire an autimatic task upon the detect of edges and values of “cond” that provides info about past history.
Then you test whiuchh edge can me first or last and write an immediate assertion.
module m;
bit a, b;
bit[2:0] cond, stat;
task automatic ta_falls(); // afall, then bfall brise arise
bit stat0, stat1;
fork
begin
@(negedge b) stat0=1;
end
begin
@(posedge b( stat0=1;
end
join_any
// based on set status bit do something
cond=2;
am_label: assert (stat==stat0);
endtask
always @(negedge a) if(cond==1) ta_falls();
endmodule
let me know how thius would work for you
Sorry for my poor expression,and thanks for your generous help,ben!
I saw your fork join_any magic,and I wrote my solution base on yours below.
module m;
bit src_rst_n,dst_rst_n;
task automatic t_src_falls();
bit dst_rst_n_fell_before_src_rst_n_rose = 0;
fork
begin
@(negedge dst_rst_n) dst_rst_n_fell_before_src_rst_n_rose=1;
End
begin
@(posedge src_rst_n) dst_rst_n_fell_before_src_rst_n_rose=0;
end
join_any
// based on set status bit do something
must_fell: assert(dst_rst_n_fell_before_src_rst_n_rose == 1);
must_an_overlap_1_timeslot:assert final(dst_rst_n_fell_before_src_rst_n_rose == 1);
endtask
task automatic t_dst_falls();
bit src_rst_n_fell_before_dst_rst_n_rose = 0;
fork
begin
@(negedge src_rst_n) src_rst_n_fell_before_dst_rst_n_rose =1;
End
begin
@(posedge dst_rst_n) src_rst_n_fell_before_dst_rst_n_rose =0;
end
join_any
// based on set status bit do something
must_fell: assert(src_rst_n_fell_before_dst_rst_n_rose == 1);
must_an_overlap_1_timeslot:assert final(src_rst_n_fell_before_dst_rst_n_rose == 1);
endtask
always @(negedge src_rst_n) if(dst_rst_n) t_src_falls();
always @(negedge dst_rst_n) if(src_rst_n) t_dst_falls();
Did I missing anything else?Did I do something wrong?I guess there are more things in your code I did not realize.
And also , did I use deferred assertion correctly? I wanna assert there will be 1 timeslot longer overlap between two signals.