Can we bind assertion module to system verilog interface

Hi,

can we bind assertion module to an interface just the way we bind it to the rtl module.Because I am writing coverage for AXI-VIP without RTL
Simulator threw an error.

I fixed it by instantiating the assertion module in the top tb and by manually teing the assertion signals to interface

     axi_if ino(clock);
 axi_assertions assertion_ip(.clk(ino.clk),
			    .Areset_n(ino.Aresetn),
			     ...); Is it in par with the standards

I JUST WANTED TO CONFIRM WITH THE STANDARD WAYS OF IMPLEMENTATION
As I am developing my testbench in UVM,there are two ways I can integrate my assertions into my VIP

1)Define the assertions in the module and Instantiate the assertion module by manually mapping the signals in the TOP tb.
2)Define the assertions in the class and collect the interface from the config db and evalute assertions.
New the assertion class in top tb…
What would be the best way to implement…

Thanks,
Shilpa

can we bind assertion module to an interface

No. However, you can bind a checker to a SV interface.
Your checker can have assertions (actually, that is the intent).
I describe the 1800’12 checkers in my SVA 3rd edition book.

2)Define the assertions in the class

It is illegal to have concurrent assertions in classes.
Your best bet is to either user the checkers or write the assertions in the interface, or in a module (or checker) bound to t.
Ben Cohen systemverilog.us

In reply to ben@SystemVerilog.us:

Hi,

Thank you for the inputs…

When u say checker …does it mean another class(If so, we can’t have assertions defined in clss). In UVM we pass interface to a class via config_db while in SV we pass it through constructor…nowhere I have come across binding of interface either to class or to a module.Could u please elaborate.

Currently, I have my assertions in module that I instantiate at the top to which I pass the interface through config db…

In the top:

       axi_assertions assertion_ip();
       initial
    begin
	uvm_config_db #(virtual axi_if)::set(null,"*","vif",ino);

IN ASSERTION MODULE:
initial
begin
#0
if(!uvm_config_db #(virtual axi_if)::get(null,“”,“vif”,vif))
`uvm_fatal(“ASSERTION MONULE”, “cannot get() m_cfg from config_db, did you set()”)
assign AWID = vif.Awid;

property AXI4_ERRM_AWADDR_BOUNDARY;
@(posedge clk) !($isunknown({AWVALID,AWBURST,AWADDR})) &
AWVALID & (AWBURST == 2’b01)
|-> (AWADDR + (AWLEN * (2 ** AWSIZE) == AWADDR[31:12]))
endproperty

THIS IS WORKING!!! just wanted to check if it is in par with the standards…

Thanks

In reply to shilpa v:

When u say checker …does it mean another class

A checker is a new SystemVerilog construct, and has nothing to do with classes.

  1. Checkers
    17.1 Overview
    Assertions provide building blocks to validate the behavior of the design. In many cases there is a need to
    group several assertions together into bigger blocks having a well-defined functionality. These verification
    blocks may also need to contain modeling code to compute values of auxiliary variables used in assertions or
    covergroup instances to be integrated with cover statements. The checker construct in SystemVerilog was
    specifically created to represent such verification blocks encapsulating assertions along with the modeling
    code. The intended use of checkers is to serve as verification library units, or as building blocks for creating abstract auxiliary models used in formal verification.
    The modeling mechanism in checkers is similar to the modeling mechanism in modules and interfaces,
    though several limitations apply. For example, no nets can be declared and assigned in checkers. On the
    other hand, checkers allow nondeterministic modeling, which does not exist in modules and interfaces. Each
    variable declared in a checker may be either deterministic or random. Checker modeling is explained in
    17.7. Random variables are useful to build abstract nondeterministic models for formal verification.
    Reasoning about nondeterministic models is sometimes much easier than reasoning about deterministic RTL
    models.

I explain the application of 1800’2012 checkers in my SystemVerilog Assertions Handbook, 3rd Edition VhdlCohen Publishing
Below is an untested dummy model of a checker bound to an SV interface.

module rtl (
	input logic clk, reset, request, ack, 
	input logic[7:0] data_in, 
	output logic[7:0] data_out);
	timeunit 1ns;   timeprecision 100ps;
	logic done;  // done is to test_rtl 
	// .. 
endmodule : rtl

checker handshake_chk (input logic clk, reset_n, request, ack, done);
	timeunit 1ns;   timeprecision 100ps;
	//..
  	property p_req_ack (clk, a, b, c);
		@ (posedge clk) $rose(a) |-> ##[1:2] b ##1 c; 
	endproperty : p_req_ack
	
	ap_req_ack : assert property  (p_req_ack(clk, request, ack, done)) else 
		$display ("%m 1 Request-acknowledge failure");
endchecker : handshake_chk

interface req2send_if (input bit clk, reset_n);
  timeunit 1ns; timeprecision 100ps;
  logic request, ack, done; // signals belonging to interface
  logic [7:0] source_data, data_out; // signals belonging to interface
  // Define a clocking for the properties and IO ports
  clocking reqclk @(posedge clk);
    input ack, data_out, done;
    output request, source_data;
  endclocking : reqclk
  // Define port direction for a module that sends data
  modport sendmode_if (output ack, data_out, done,
            input request, source_data);

endinterface : req2send_if

        
module test3_tb;
	timeunit 1ns;   timeprecision 100ps;
	logic clk, reset_n, request, ack; // signals local to testbench 
	logic[7:0] data_in, data_out;
    req2send_if req2send_if1 (.*);
    
    	// perform 2 instantiations of test_rtl, using 2 styles 
	rtl rtl_1(clk, reset, request, ack, data_in, data_out);
	rtl rtl_2(.*);
  
	bind req2send_if // interface 
	  handshake_chk     // cheker containing the properties
	  handshake_chk_1(.*); // instance of handshake_chk that contains the properties.
endmodule : test3_tb

I fail to understand the relationship of UVM configuration and assertions, particualrly since config is about classes, and concurrent assertions cannot be in classes.
Ben Cohen systemverilog.us

In reply to ben@SystemVerilog.us:

Thanks Ben! it is quite informative…