below code i write assertion for to check two clock are same for thought the simulation but in below code assertion not is at all working other than assertion i can able to see all the display what i write inside always block
this is the output i am getting in my log file : but two frequency and TON_local _clk1 is not equal to TON_local_clk2 but still assertion is not throwing the error. could you please help me to slove this one
time t3 6250
clock ON pulse of clk2 TON_local_clk1 = 6250
time t4 6250
time t2 7500
clock on pulse of clk2 TOFF_local_clk1 = 1250
time pulse of the clock Tpulse_clk1 = 7500
frequency of the clock F_clk1 = 0.000133
time t6 7500
clock on pulse of clk2 TON_local_clk2 = 1250
time t5 8750
clock OFF pulse of clk2 TOFF_local_clk2 = 1250
time pulse of the clock Tpulse_clk2 = 2500
frequency of the clock F_clk2 = 0.000400
module ccd_clock_check(local_clk1,local_clk2,enable);
input enable;
input bit local_clk1, local_clk2;
reg clock_check_event_on,clock_check_event_off;
int count,count1,count2,count3;
real t1,t2,t3,t4,t5,t6;
real Tpulse_clk1,Tpulse_clk2,F_clk1,F_clk2;
real TON_local_clk1,TON_local_clk2,TOFF_local_clk1,TOFF_local_clk2;
initial begin
clock_check_event_on = 1'b0;
clock_check_event_off = 1'b0;
enable = 0;
// local_clk1 = 0;
// local_clk2 = 0;
end
//always @(posedge clk iff reset == 0)
//-------------------------------------------------------------------------
//`ifdef CLOCK_CHECK
always@(posedge local_clk1 or posedge local_clk2) begin
assert (local_clk1 == local_clk2)
$display("local_clk1 is equal to local_clk2");
else
$error("local_clk1 is not mattched local_clk2");
end
always @(posedge local_clk1 iff enable) begin
// if(rst) return;
if($isunknown(local_clk1)) begin
$error("scan_driver", "clk1 changed or is unkonwn");
//return;
end
end
always @(posedge local_clk2 iff enable) begin
// if(rst) return;
if($isunknown(local_clk2)) begin
$error("scan_driver", "clk2 changed or is unkonwn");
// return;
end
end
property p_local_clk1_hi;
realtime v;
@(posedge local_clk1) (enable, v=$realtime) |-> @(negedge local_clk1) ($realtime-v)==TON_local_clk1;
endproperty
ap_local_clk1_hi: assert property(p_local_clk1_hi);
property p_local_clk1_lo;
realtime v;
@(negedge local_clk1) (enable, v=$realtime) |-> @(posedge local_clk1) ($realtime-v)==TOFF_local_clk1;
endproperty
ap_local_clk1_lo: assert property(p_local_clk1_lo);
property p_local_clk2_hi;
realtime v1;
@(posedge local_clk2) (enable, v1=$realtime) |-> @(negedge local_clk2) ($realtime-v1)==TON_local_clk2;
endproperty
ap_local_clk2_hi: assert property(p_local_clk2_hi);
property p_local_clk2_lo;
realtime v1;
@(negedge local_clk2) (enable, v1=$realtime) |-> @(posedge local_clk2) ($realtime-v1)==TOFF_local_clk2;
endproperty
ap_local_clk2_lo: assert property(p_local_clk2_lo);
always @(posedge local_clk1 iff enable) begin
count = count+1;
if (count == 1) begin
t1= $realtime;
$display("time t1 %t", t1);
end
if (count == 2) begin
t2 = $realtime;
$display("time t2 %t", t2);
TOFF_local_clk1 = t2-t3;
$display("clock on pulse of clk2 TOFF_local_clk1 = %t", TOFF_local_clk1);
Tpulse_clk1 = t2 - t1;
F_clk1 = (1/Tpulse_clk1);
$display("time pulse of the clock Tpulse_clk1 = %t", Tpulse_clk1);
$display("frequency of the clock F_clk1 = %f", F_clk1);
end
end
always @(negedge local_clk1 iff enable) begin
count1 = count1+1;
if (count1 == 1) begin
t3= $realtime;
$display("time t3 %t", t3);
TON_local_clk1 = t3-t1;
$display("clock ON pulse of clk2 TON_local_clk1 = %t", TON_local_clk1);
end
end
always @(posedge local_clk2 iff enable) begin
count2 = count2+1;
if (count2 == 1) begin
t4= $realtime;
$display("time t4 %t", t4);
end
if (count2 == 2) begin
t5 = $realtime;
$display("time t5 %t", t5);
TOFF_local_clk2 = t5-t6;
$display("clock OFF pulse of clk2 TOFF_local_clk2 = %t", TOFF_local_clk2);
clock_check_event_off = 1'b1;
Tpulse_clk2 = t5 - t4;
F_clk2 = (1/Tpulse_clk2);
$display("time pulse of the clock Tpulse_clk2 = %t", Tpulse_clk2);
$display("frequency of the clock F_clk2 = %f", F_clk2);
end
end
always @(negedge local_clk2 iff enable) begin
count3 = count3+1;
if (count3 == 1) begin
t6= $realtime;
$display("time t6 %t", t6);
TON_local_clk2 = t6- t4;
$display("clock on pulse of clk2 TON_local_clk2 = %t", TON_local_clk2);
clock_check_event_on = 1'b1;
end
end
always @(posedge clock_check_event_on) begin
assert (TON_local_clk1 == TON_local_clk2)
$display("TON pulse time of clk1 is equal to clk2");
else
$error("TON pulse time of clk2 is not equal to clk2");
end
always @(posedge clock_check_event_off) begin
assert (TOFF_local_clk1 == TOFF_local_clk2)
$display("TOFF pulse time of clk1 is equal to clk2");
else
$error("TOFF pulse time of clk1 is not equal to clk2");
end
//`endif
endmodule