In reply to shravani_k:
//verilog code for counting pulse not edges (posedge-->negedge, negedge-->posedge)
// My interpretation of the requirements:
// Increment the count when signal d goes from a 0 to a 1.
// In SystemVerilog
module pulse_counter(input bit clk, rst_n, enable, d,
output int count);
always @(posedge clk)
if (!rst_n) count<=8'b0;
else if (enable && $rose(d))
count<=count + 1'b1;
ap: assert property(@(posedge clk) disable iff(rst_n==0)
$rose(d) |-> ##1 count==$past(count) +1'b1);
endmodule
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home.html
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
…
- SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats | Verification Academy
- Free books: Component Design by Example FREE BOOK: Component Design by Example … A Step-by-Step Process Using VHDL with UART as Vehicle | Verification Academy
Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb - Papers:
- Understanding the SVA Engine,
Verification Horizons - July 2020 | Verification Academy - SVA Alternative for Complex Assertions
Verification Horizons - March 2018 Issue | Verification Academy - SVA in a UVM Class-based Environment
SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy