Can anyone help to write assertion for 200MHz clk check?

I want to write assertion for 200 Mhz clock frequency

1 Like

This can help: SVA to check clock frequency - THETECHIEBLOG

Here check this code

`timescale 1ns/1ps

module tb;
  bit clk = 1;

  realtime t_on = 2.5;
  realtime t_off = 2.5;

  initial begin
    forever begin
      #2.5 clk = 0;
      #2.5 clk = 1;
    end
  end

  property p1(realtime t_on_time);
    realtime current_time;
    @(posedge clk) (1, current_time = $realtime) |=> @(negedge clk)
    ((($realtime-current_time)==t_on_time)<$realtime);
  endproperty

  property p2(realtime t_off_time);
    realtime current_time;
    @(negedge clk) (1, current_time = $realtime) |=> @(posedge clk)
    ((($realtime-current_time)==t_off_time)<$realtime);
  endproperty

 
  a1: assert property(p1(t_on))
    $display("T_ON PASS at %t", $realtime);
  else
    $display("T_ON FAIL at %t", $realtime);

  a2: assert property(p2(t_off))
    $display("T_OFF PASS at %t", $realtime);
  else
    $display("T_OFF FAIL at %t", $realtime);

  initial begin
    $dumpfile("dump.vcd");
    $dumpvars();
  end

  initial begin
    #50;
    $finish;
  end
endmodule
1 Like