Regarding the assertion checking for setup and hold between strb and data

Question: Verification should apply an assertion check for setup and hold of 10 functional clocks between data and strobe.

I tried writing Following code, this is how I have written this question in code but I am getting following error(hint consequent of property hold_checker may be the reason for error )

Error-[SVA-SEQPROPEMPTYMATCH] Invalid sequence as property
/vobs/asic_adc_dac_testchip/hydra_t/SE/assertions/hydra_t_strobe_assertions.sv, 65
“($stable(data) [* HOLD_TIME])”
A sequence that is used as property must be non-degenerate and admit no
empty match.

NOTE: I would really appreciate if some could help me with this it would be a great learning for me.

`timescale 1ns/1ps

import uvm_pkg::*;
`include “uvm_macros.svh”

module DAC_ADC_Analog_Timing_checker( clk_in,strb_in, resetn, disable_assertion, data );

parameter SETUP_TIME = 3; // this vale will be passed from binding module which is written in the code below
parameter HOLD_TIME = 6; // this vale will be passed from binding module which is written in the code below
parameter CK_PERIOD = 1;
// parameter CK_EDGE_SEL = 1’b1; // 0: posedge, 1: negedge

define adc_wrapper_path hydra_t_hdl_top.dut.analog_adc_wrapper_inst define ADC_ANALOG_PATH hydra_t_hdl_top.dut.analog_adc_wrapper_inst.HYDRA_TADC_ANALOG_inst
define DAC_ANALOG_PATH hydra_t_hdl_top.dut.analog_dac_wrapper_inst.HYDRA_TDAC_ANALOG_inst define DAC_NCO_ANALOG_PATH hydra_t_hdl_top.dut.analog_dac_wrapper_inst.HYDRA_TNCO_ANALOG_inst

input clk_in;
input strb_in;
input resetn;
input disable_assertion;
input [63:0] data;

//=================================================
// Property Specification Layer
//=================================================
property hold_checker;
@(posedge clk_in)
disable iff (~resetn || disable_assertion)
$rose(strb_in) |-> ($stable(data)[*HOLD_TIME]); // Consequent is the reason i gueess for the error
endproperty

property setup_checker;
@(posedge clk_in)
disable iff (~resetn || disable_assertion)
$changed(data)|-> !strb_in[*SETUP_TIME];
endproperty

//=================================================
// This is how you use “assert”
//=================================================

setup_checker_Assert: assert property (setup_checker) $display($stime,"\t Pass :: Assertion passes setup_checker ");
else `ASSERT_ERROR( $sformatf("Fail :: Assertion fail the setup_checker "))

hold_checker_Assert: assert property (hold_checker) $display($stime,"\t Pass :: Assertion passes hold_checker ");
else `ASSERT_ERROR( $sformatf("Fail :: Assertion fail the hold_checker "))

//=================================================
// This is how you use “cover”
//=================================================

setup_checker_Assert_cover : cover property (setup_checker);
hold_checker_Assert_cover : cover property (hold_checker);

endmodule : DAC_ADC_Analog_Timing_checker

//--------------------------------------------------------------------------------------------------------------------
// Binding ADC module
//--------------------------------------------------------------------------------------------------------------------

module tadc_strobe_bindings;

define ADC_IF_PATH hydra_t_hdl_top.itf.misc_itf define ASSERT_ON

`ifdef ASSERT_ON

// ADC Fractional DLL interface
//Functional CLK (447.300 MHz)
//Type 1

bind `ADC_ANALOG_PATH DAC_ADC_Analog_Timing_checker
#(.CK_EDGE_SEL (1’b1), .SETUP_TIME(2), .HOLD_TIME(2)) ADC_fs144PHROT_STRB_checker(

   .clk_in(`ADC_ANALOG_PATH.o_refck) ,
   .strb_in(`ADC_ANALOG_PATH.i_fs144_phrot_strb_n),
   .resetn(`ADC_ANALOG_PATH.i_resetn),
   .disable_assertion(!`ADC_IF_PATH.en_global_assertion),
   .data({
          54'd0,
          `ADC_ANALOG_PATH.iv_fs144_phrot[9:0]
          })

);

endtadc_strobe_bindings

In reply to venkatasubbarao:
Looking at just the syntax, your code is OK; it compiles and elaborates OK.
BTW, when you post code, use the
angle_bracket_here systemverilog] CODE GOES HERE /angle_bracket_here slash systemverilog]


`timescale 1ns/1ps
import uvm_pkg::*; `include "uvm_macros.svh" 

module DAC_ADC_Analog_Timing_checker( clk_in,strb_in, resetn, disable_assertion, data );
    
    parameter SETUP_TIME = 3; // this vale will be passed from binding module which is written in the code below
    parameter HOLD_TIME = 6; // this vale will be passed from binding module which is written in the code below
    parameter CK_PERIOD = 1;
    // parameter CK_EDGE_SEL = 1'b1; // 0: posedge, 1: negedge
    `define ASSERT_ERROR $error
    `define adc_wrapper_path hydra_t_hdl_top.dut.analog_adc_wrapper_inst 
    `define ADC_ANALOG_PATH hydra_t_hdl_top.dut.analog_adc_wrapper_inst.HYDRA_TADC_ANALOG_inst
    `define DAC_ANALOG_PATH hydra_t_hdl_top.dut.analog_dac_wrapper_inst.HYDRA_TDAC_ANALOG_inst
    `define DAC_NCO_ANALOG_PATH hydra_t_hdl_top.dut.analog_dac_wrapper_inst.HYDRA_TNCO_ANALOG_inst
    
    input clk_in;
    input strb_in;
    input resetn;
    input disable_assertion;
    input [63:0] data;
    
    //=================================================
    // Property Specification Layer
    //=================================================
    property hold_checker;
        @(posedge clk_in)
        disable iff (~resetn || disable_assertion)
        $rose(strb_in) |-> ($stable(data)[*HOLD_TIME]);
         // Consequent is the reason i gueess for the error
    endproperty
    
    property setup_checker;
        @(posedge clk_in) 
        disable iff (~resetn || disable_assertion)
        $changed(data)|-> !strb_in[*SETUP_TIME];
    endproperty 
    
    //=================================================
    // This is how you use "assert"
    //=================================================
    
    setup_checker_Assert: assert property (setup_checker) $display($stime,"\t Pass :: Assertion passes setup_checker ");
    else `ASSERT_ERROR( $sformatf("Fail :: Assertion fail the setup_checker "));
    
    hold_checker_Assert: assert property (hold_checker) $display($stime,"\t Pass :: Assertion passes hold_checker ");
    else `ASSERT_ERROR( $sformatf("Fail :: Assertion fail the hold_checker "));
    
    //=================================================
    // This is how you use "cover"
    //=================================================
    
    setup_checker_Assert_cover : cover property (setup_checker);
    hold_checker_Assert_cover : cover property (hold_checker);
    
endmodule : DAC_ADC_Analog_Timing_checker

//--------------------------------------------------------------------------------------------------------------------
// Binding ADC module
//--------------------------------------------------------------------------------------------------------------------
/*
module tadc_strobe_bindings;
    
    `define ADC_IF_PATH hydra_t_hdl_top.itf.misc_itf
    `define ASSERT_ON
    
    `ifdef ASSERT_ON
    
    // ADC Fractional DLL interface
    //Functional CLK (447.300 MHz)
    //Type 1
    
    bind `ADC_ANALOG_PATH DAC_ADC_Analog_Timing_checker 
    #(.CK_EDGE_SEL (1'b1), .SETUP_TIME(2), .HOLD_TIME(2)) ADC_fs144PHROT_STRB_checker(
    
    .clk_in(`ADC_ANALOG_PATH.o_refck) ,
    .strb_in(`ADC_ANALOG_PATH.i_fs144_phrot_strb_n),
    .resetn(`ADC_ANALOG_PATH.i_resetn),
    .disable_assertion(!`ADC_IF_PATH.en_global_assertion),
    .data({
        54'd0,
        `ADC_ANALOG_PATH.iv_fs144_phrot[9:0]
    })
    );
    
    endtadc_strobe_bindings */ 
 

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions - SystemVerilog - Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    https://verificationacademy.com/verification-horizons/october-2013-volume-9-issue-3
  5. SVA in a UVM Class-based Environment
    https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment

In reply to ben@SystemVerilog.us:

Thank you very much for your response, this is my first time posting on forums I will keep that in mind.

if my code is correct then, how can I make a directed test so that I can pass and fail just to test the specification works according to the property following is my code


//=================================================
// Drive the input vectors to test assetion
//=================================================
initial begin
  // Init all the values
  resetn <= 0;
  strb_in<= 0;
  data <= 0;

// Cause assertion to pass  
repeat(10)  @(posedge clk_in);
  strb_in <= 1;
repeat(10)@ (posedge clk_in);
  strb_in <= 0;
  

// Cause assertion to fail
repeat(20)  @ (posedge clk_in);
  strb_in <= 1;
  repeat(2) @ (posedge clk_in);
  strb_in <= 1;
  
  #1000 $finish;
end
]

In reply to venkatasubbarao:

\I usually use the following template as a starting point to create constrained-random tests for my assertions. Adjust as needed for your variables and weighted constraints.


import uvm_pkg::*; `include "uvm_macros.svh" 
module top; 
  timeunit 1ns;     timeprecision 100ps;    
	bit clk, a, b;  
	default clocking @(posedge clk); endclocking
    initial forever #10 clk=!clk;  
    initial begin
      $timeformat(-9, 1, "ns", 8);
      $display("%t", $realtime);
   end 
    always  @(posedge clk)  begin 
    end 
    // Assertions IN THE MODULE 

    initial begin 
       bit va, vb; 
      repeat(200) begin 
        @(posedge clk);   
        if (!randomize(va, vb)  with 
        { va dist {1'b1:=1, 1'b0:=3}; // ADJUST WEIGHTS 
          vb dist {1'b1:=1, 1'b0:=2};      
      }) `uvm_error("MYERR", "This is a randomize error")
       a <= va; 
       b <= vb;
    end 
    $stop; 
  end 
endmodule    

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions | Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    October 2013 | Volume 9, Issue 3 | Verification Academy
  5. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy
*<font size=12>In reply to [ben@SystemVerilog.us](/forums/t/regarding-the-assertion-checking-for-setup-and-hold-between-strb-and-data/35197/4):</font>*

sir can we use if else in property, I did something as follows but it gives an error ? 

**code as follows**

[code]
property hold_checker;
   @(posedge clk_in)
   disable iff (~resetn || disable_assertion)
   
    	if(CK_EDGE_SEL)   
    	  begin
            $fell(strb_in)  |-> ##0 $stable(data)[*HOLD_TIME] //<-- use semicolon yes/no ?    
          end 
	 
	else    	 
	  begin
	    $rose(strb_in)  |-> ##0 $stable(data)[*HOLD_TIME];  
	  end 
endproperty

In reply to venkatasubbarao:
You need to look at the BNF syntax to know what is legal. From my book:

In general, I only write properties if they are reusable or if there is a need to use local variables, otherwise, I just write the assertions directly. I also prefer to use the default clocking and disable. I prefer smaller assertions and thus, would rewrite your assertions as:


default clocking @(posedge clk_in); endclocking
default disable iff (!resetn); // Use the logical negation instead of the bitwise invert
ap_NAME1: assert property( 
   ##1 CK_EDGE_SEL && $fell(strb_in)  |->  $stable(data)[*HOLD_TIME]);
ap_NAME2: assert property(##1 !CK_EDGE_SEL && $rose(strb_in)  |->  
                                                  $stable(data)[*HOLD_TIME]);  
// No need for the ##0 in |-> ##0
// Need for the ##1 in antecedent because of the $stable that assumes that at the 
// first clock edge $past(data) is the initial value of data. If that is not critical, 
// then you do not need the ##1 
 

On your “disable_assertion”, SVA provides assertion-control system tasks
4.2.4 Assertion-control system tasks from my book
SystemVerilog provides system tasks to control the evaluation of assertions (e.g., ON/OFF). In simulation, this can be very useful to disable property checking until the design under verification is in a stable initialized state. This feature allows the speedup in simulation when assertion checking is not needed and eliminates the need to use the disable iff (reset_n) to prevent false reporting when a user does not need to verify the assertions during initialization. The control system tasks are also useful for turning on/off assertions and cover statements based on the testbench, versus complex ifdefs or generates that evolve over time.
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions - SystemVerilog - Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    https://verificationacademy.com/verification-horizons/october-2013-volume-9-issue-3
  5. SVA in a UVM Class-based Environment
    https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment

In reply to ben@SystemVerilog.us:

I apologize for asking the questions again and again

  1. I am getting following warning when I am simulating the following properties i have to use ##0 at |-> ##0 $stable(data)[*HOLD_TIME]; otherwise its giving ERROR refer ERROR 1
  1. I am stuck in this loop and I am not understanding how to come out of this problem…?
  2. And when i am covering property how can i check it i am using DVE
  3. I would be a great learning to overcome this problem.

NOTE: I am using VCS simulator /opt/tools/tools/VCS_MXi/v_2017.12/bin/vcs

ERROR 1:
Error-[SVA-SEQPROPEMPTYMATCH] Invalid sequence as property
/vobs/asic_adc_dac_testchip/hydra_t/SE/assertions/hydra_t_strobe_assertions.sv, 114
“($stable(data) [* HOLD_TIME])”
A sequence that is used as property must be non-degenerate and admit no
empty match.

Warning Messages
Warning-[SVA-AITT] Unsatisfiable sequence in assertion
/vobs/asic_adc_dac_testchip/hydra_t/SE/assertions/hydra_t_strobe_assertions.sv, 117
Please note that assertion hold_checker_rose_Assert contains an
unsatisfiable sequence. The assertion may thus be either trivially true or
trivially false. It will not be simulated.

property hold_checker_fell;
   @(posedge clk_in)
   disable iff (!resetn || disable_assertion)
   
  	##1 CK_EDGE_SEL && $fell(strb_in)  |->  $stable(data)[*HOLD_TIME];
          //$fell(strb_in)  |-> ##0 $stable(data)[*HOLD_TIME];   //local_hold_seq;    //($stable(data)[*3]);
          //$rose(strobe) (temp=data)|-> (data==temp)[*10]

  endproperty
   
 
   property hold_checker_rose;
   @(posedge clk_in)
   disable iff (!resetn || disable_assertion)
   
  	
	##1 !CK_EDGE_SEL && $rose(strb_in)  |-> ##0 $stable(data)[*HOLD_TIME];

          //$fell(strb_in)  |-> ##0 $stable(data)[*HOLD_TIME];   //local_hold_seq;    //($stable(data)[*3]);
          //$rose(strobe) (temp=data)|-> (data==temp)[*10]

  endproperty
   
    
  property setup_checker_fell;
   @(posedge clk_in) 
            
   disable iff (!resetn || disable_assertion)
	
	##1 CK_EDGE_SEL && $fell(strb_in)  |-> ##0 $past(data)[*SETUP_TIME];
	
          //$fell(strb_in) |-> ##0 $past(data)[*SETUP_TIME] ;
	  //$changed(data)|-> ##0 !(strb_in)[*SETUP_TIME];

  endproperty 
  
  property setup_checker_rose;
   @(posedge clk_in) 
            
   disable iff (!resetn || disable_assertion)
	
	##1 !CK_EDGE_SEL && $rose(strb_in)  |-> ##0 $past(data)[*SETUP_TIME];
	
          //$fell(strb_in) |-> ##0 $past(data)[*SETUP_TIME] ;
	  //$changed(data)|-> ##0 !(strb_in)[*SETUP_TIME];

  endproperty
  
  //=================================================
// This is how you use "assert" $display($stime,"\t Pass  :: Assertion passes hold_checker "); 
//=================================================

hold_checker_fell_Assert:  assert property (hold_checker_fell) $display("time:%t assertion passed hold_checker_fell",$time);
					else `ASSERT_ERROR( $sformatf("Fail   :: Assertion fail the hold_checker_fell ")) 
					
hold_checker_rose_Assert:  assert property (hold_checker_rose) $display("time:%t assertion passed hold_checker_rose",$time);
					else `ASSERT_ERROR( $sformatf("Fail   :: Assertion fail the hold_checker_rose "))					
					
					  
  					
					
setup_checker_fell_Assert: assert property (setup_checker_fell) $display($stime,"\t Pass :: Assertion passes setup_checker_fell ");
					else`ASSERT_ERROR( $sformatf("Fail   :: Assertion fail the setup_checker_fell "))					
					
setup_checker_rose_Assert: assert property (setup_checker_rose) $display($stime,"\t Pass :: Assertion passes setup_checker_rose ");
					else`ASSERT_ERROR( $sformatf("Fail   :: Assertion fail the setup_checker_rose "))					
//=================================================
// This is how you use "cover"
//=================================================
  
hold_checker_fell_Assert_cover : cover property (hold_checker_fell);  
hold_checker_rose_Assert_cover : cover property (hold_checker_rose);
setup_checker_fell_Assert_cover: cover property (setup_checker_fell);
setup_checker_rose_Assert_cover: cover property (setup_checker_rose);

In reply to venkatasubbarao:
In this forum we do NOT discuss tools.
This property looks OK, as long as HOLD_TIM is set by elboration time.
##1 CK_EDGE_SEL && $fell(strb_in) |-> $stable(data)[*HOLD_TIME];

Try bringing this issue with your tool vendor at support.
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions | Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    October 2013 | Volume 9, Issue 3 | Verification Academy
  5. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy