Checking 60% duty cycle clock

I am asserting to check whether the clock is meeting 60% duty cycle using following code (The code is working for my intention)

`define PERIOD 10ns

module tb;

    realtime TON = `PERIOD * 0.6;
    realtime TOFF = `PERIOD * 0.4;
    
    int clock;

    initial begin
        clock = 1;
    end
    always begin
        #6 clock = 0;
        #4 clock = 1;
    end 

    property check_ton(int ton_time);
        time current_time;
        (1, current_time = $realtime) |=> @(negedge clock) (ton_time == ($realtime-current_time));
    endproperty : check_ton

    property check_toff(int toff_time);
        time current_time;
        (1, current_time = $realtime) |=> @(posedge clock) (toff_time == ($realtime-current_time));
    endproperty : check_toff

    assert property ( @(posedge clock) check_ton(TON))
        $display($time," CHECK_TON : PASS");
    else $warning($time," CHECK_TON : FAIL");

    assert property ( @(negedge clock) check_toff(TOFF))
        $display($time," CHECK_TOFF : PASS\n");
    else $warning($time," CHECK_TOFF : FAIL\n");

    initial begin
        #50 $finish;
    end
endmodule :tb

There are 2 assertions: check_ton and check_toff.
I want to combine them into one assertion.
How should I write the code.

In reply to bachan21:

There is no reason to combine them into a single assertion.
The general recommendation is to write smaller simple assertions rather than complex fewer ones.

BTW, use realtime instead of time.

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448

  1. SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats | Verification Academy
  2. 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) Amazon.com
  3. Papers:

In reply to ben@SystemVerilog.us:

Thanks for the guidelines Ben

In reply to bachan21:

Hello Bachan,

Can u please explain how to generate the clock with 25MHZ frequency with 50% duty cycle without assertions.

Thanks in Advance,
Arshia J

In reply to Arshia:

You do not generate clocks with assertions. Bachan verified the clock periods with assertions.
The clock was generated with SV code using the always construct.

What gave the impression that assertions generate clocks. That is definitely no their purpose.
Ben

In reply to Arshia:

Hi Arshia,
As Ben explained, we cant use assertion for generating clock. In this problem, I used assertions to verify my clock.

If you want to generate 25 MHz clock, follow the below instructions.

Convert 25MHz into time period terms.
25 MHz → 40 ns in time period
As the duty cycle is 50%, the clock changes its value every 20 ns

Use the below code for 25 MHz clock

`timescale 1ns/1ps
module tb;
  bit clock;

  always 
    #20 clock = !clock;
endmodule