//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