In reply to ben@SystemVerilog.us:
Be cause you have an analog type of requirement (the 120ns). I would use tasks, as described in my paper,link below.
task automatic t_AB;
bit status;
int count:
if ($fell(a))
fork
begin : the120ns
#120ns
end
begin : thecount
// count the b's
Statis=1: // under count values
end
join_any
assert(status);
endtask
always @(posedge clk)
fork t_AB();
join_none
Above is a framework for your code, you need to tune it.
See my paper 1) SVA Alternative for Complex Assertions
Browse all content in Verification Academy: Articles, Cookbooks, Resources, Sessions, and Tracks
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home
- 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 978-1539769712
- 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
- Browse all content in Verification Academy: Articles, Cookbooks, Resources, Sessions, and Tracks
- SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy
- SVA in a UVM Class-based Environment
SVA in a UVM Class-based Environment
Hi Ben,
In your code I see that on every posedge clk, the task is called under a fork. This will just create multiple threads. Instead of this can’t we just move the alywas @posedge clk internal to the mutiple processes running inside fork .join. something like this:
task automatic t_AB;
bit status;
int count:
bit a_fall;
always@(posedge clock) begin: block_to_disable
if ($fell(a)) begin
a_fall = 1;
disable block_to_disable;
end
fork
begin
begin : the120ns
#120ns: //wait till timeout (excute a delay sequence here that waits till 120ns)
end
begin : thecount
// count the b’s
always@(posegde clk)
$rose(b)|->(count ++);
end
end
end
join_any
assert(count>=2);
endtask
fork t_AB();
join_none