40 lines
974 B
Systemverilog
40 lines
974 B
Systemverilog
|
`ifndef SVA_COMMON_SVH
|
||
|
`define SVA_COMMON_SVH
|
||
|
|
||
|
`ifdef SVA_ENABLE
|
||
|
`define SVA_DEF_CLK(clk) \
|
||
|
logic sva_clk; \
|
||
|
assign sva_clk = clk;
|
||
|
|
||
|
`define SVA_DEF_NRESET(nrst) \
|
||
|
logic sva_nreset; \
|
||
|
assign sva_nreset = nrst;
|
||
|
|
||
|
`define SVA_ASSERT_PROP(label, prop, err) \
|
||
|
property label``_prop; \
|
||
|
@(posedge sva_clk) disable iff (!nreset) \
|
||
|
(prop); \
|
||
|
endproperty \
|
||
|
label``_sva: assert property (label``_prop) else $display($sformatf("[%0t] %s", $time, err));
|
||
|
|
||
|
`define SVA_ASSERT_PROP_FATAL(label, prop, err) \
|
||
|
property label``_prop; \
|
||
|
@(posedge sva_clk) disable iff (!nreset) \
|
||
|
(prop); \
|
||
|
endproperty \
|
||
|
label``_sva: assert property (label``_prop) else begin \
|
||
|
$display($sformatf("[%0t] %s", $time, err)); \
|
||
|
$fatal(); \
|
||
|
end
|
||
|
|
||
|
`else /* SVA_ENABLE */
|
||
|
|
||
|
`define SVA_DEF_CLK(clk)
|
||
|
`define SVA_DEF_NRESET(nrst)
|
||
|
`define SVA_ASSERT_PROP(label, prop, err)
|
||
|
`define SVA_ASSERT_PROP_FATAL(label, prop, err)
|
||
|
|
||
|
`endif /* SVA_ENABLE */
|
||
|
|
||
|
`endif /* SVA_COMMON_SVH */
|