In reply to gani:
If it is the case,it is same for all other timing checks right?,Then what is the point of verifying these checks using timing checks.?
This check is only valid threshold < (timecheck time) - (timestamp time) < limit
We are verifying only half of it rt?if i am wrong please let me know.
I suggest that you carefully read 1800::31.4 Timing checks for clock and control signals
*** Below, I am using** $skew** that checks time between 2 pulses. ***
That may be what you need.
2)Please explain this equation // threshold < (timecheck time) - (timestamp time) < limit
timecheck_time is the time of the reference event signal with opposite edge (in the case, the negedge clk).
Thus, if @(posedge clk) occurs at 100ns and @ the next (nextsedge clk)occurs at 160ns and threshold is 2ns, assume a limit of 50ns, then
2ns must be < (160 - 100)ns < 50ns
`timescale 1ns/1ps
module setup_time_check(input clk);
bit notifier0, notifier1, notifier2, notifier3, notifier4;
specify
//1)Expected to PASS ----------------->Ok no issue
$width(posedge clk,50);
$skew(posedge clk, negedge clk, 50, notifier0);
$period(posedge clk,100);
//2)Expected to FAIl ------------------>I am not seeing any failure why??????????
// $width(posedge clk,10, 0, notifier1);
$skew(posedge clk, negedge clk, 10, notifier1);
// $period(posedge clk,20, 0, notifier2);
//3)Expected to FAIl ------------------> Seen failure ok.
$width(posedge clk,60, 0, notifier3);
endspecify
/* # ** Error: temp22.sv(13): $skew( posedge clk:50 ns, negedge clk:100 ns, 10 ns );
# Time: 100 ns Iteration: 1 Instance: /top/setup_time_check_i
# ** Error: temp22.sv(16): $width( posedge clk:50 ns, :100 ns, 60 ns );
# Time: 100 ns Iteration: 1 Instance: /top/setup_time_check_i
# ** Error: temp22.sv(13): $skew( posedge clk:150 ns, negedge clk:200 ns, 10 ns );
# Time: 200 ns Iteration: 1 Instance: /top/setup_time_check_i
# ** Error: temp22.sv(16): $width( posedge clk:150 ns, :200 ns, 60 ns ); */
endmodule
Bottom line, play with the various system calls.
The following timing checks are discussed in this subclause:
$setup $hold $setuphold
$recovery $removal $recrem
These checks accept two signals, the reference event and the data event, and define a time window with
respect to one signal while checking the time of transition of the other signal with respect to the window. In
general, they all perform the following steps:
a) Define a time window with respect to the reference signal using the specified limit or limits.
b) Check the time of transition of the data signal with respect to the time window.
c) Report a timing violation if the data signal transitions within the time window.
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
- SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
- 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