Hi,
I want to implement implement below piece of code in form of assertions;
if(a==0)
{
for(i=0;i<=b; i++)
{
if(a==0) printf(“condition is satisfied”);
else printf(“condition is failed”);
}
}
i want to check if the signal remains in same position till the count value, how do i achive this through assertion please help.
user49
October 30, 2012, 5:48pm
22
module test_case2;
logic a=1'b1, clk=1'b0;
bit[0:2] b;
// if(a==0)
//{
//for(i=0;i<=b; i++)
//{
//if(a==0) printf("condition is satisfied");
//else printf("condition is failed");
//}
//}
//i want to check if the signal remains in same position till the count value,
// how do i achive this through assertion please help.
default clocking cb_ck1 @ (posedge(clk)); endclocking
property p_stable4n_0;
int v_b;
($fell(a), v_b=b) |=>
($stable(a), v_b=v_b-1)[*0:$] ##1 v_b==0 && $stable(a);
endproperty : p_stable4n_0
property p_stable4n;
int v_b;
($fell(a), v_b=b) |=> (a==1'b0, v_b=v_b-1)[*0:$] ##1 v_b==0 && a==1'b0;
endproperty :p_stable4n
ap_stable4n_0: assert property(p_stable4n_0);
ap_stable4n: assert property(p_stable4n);
initial forever #10 clk=!clk;
always_ff @ (posedge(clk)) begin
if(!randomize(a, b)) $error("randomization failure");
end
endmodule :test_case2
Ben Cohen, Design and verification expert (310) 997-2187
http://www.systemverilog.us/ ben@systemverilog.us
SystemVerilog Assertions Handbook, 3rd Edition, 2013 ISBN 0-9705394-3-6
A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 0-9705394-2-8
Component Design by Example, 2001 ISBN 0-9705394-0-1
VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115