Systemverilog assertion

Hello I’m working on assertion macro for the first time and trying to write the following assertion But I’m facing an error Illegal macro instance syntax at the `assert line. I’m passing “data” as the argument that needs to be substituted in place of in_data in the macro. Please help!

define assert_in_data_not_unknown_p(in_data) \ property ``in_data``_not_unknown_p(in_data); \ @(posedge clk) disable iff(rstn) \ !$isunknown(in_data); \ endproperty \ \ assert property (``in_data``_not_unknown_p(in_data)) begin uvm_info(“PROPERTY”,$sformatf(“in_data data:%0h”,in_data) ,UVM_NONE) end else begin`uvm_error(“PROPERTY”,$sformatf(“in_data data:%0h”,in_data) end;

`assert_in_data_not_unknown_p(data)

In reply to Nimisha Varadkar:
Why are you using a `define?
Use a SystemVerilog checker instead.
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:

I have use the assertions across multiple blocks, so it needs to be as a macro only and not checker.

Is there anything I’m missing out in the syntax or is it because of the usage of `uvm_info which itself is a macro which is causing a problem?

In reply to Nimisha Varadkar:
Am I missing something here?
A checker can be instantiated within a block or it can be bound to a block.

Am not a fan of the `define, too many `` (not sure about the meaning).

Try to explore the use of checker.
Ben systemverilog.us

For reference, the problem was due to the $sformatf, it can be resolved by using $psprintf instead.

In reply to Nimisha Varadkar:

This is interesting since $psprintf isn’t part of the LRM. I think there are other underlying issues that you aren’t addressing.