In reply to feiphung:
I don’t see the issue here.
module m;
`include "uvm_macros.svh"
import uvm_pkg::*;
bit clk;
bit[3:0] a=4, b=5, c;
initial forever #10 clk=!clk;
always_comb begin
for (int i=0; i<=3; i++) begin
assert(a[i] > b[i]) else $display("i a[i] b[i]", i, a[i], b[i]);
ap_ab: assert property(@ (posedge clk) a[i] |=> b[i]);
end
end
initial begin
repeat(20) begin
@(posedge clk);
if (!randomize(a, b) with
{ a dist {1'b1:=1, 1'b0:=1};
b dist {1'b1:=1, 1'b0:=2};
}) `uvm_error("MYERR", "This is a randomize error");
end
$finish;
end
endmodule
...
# KERNEL: i a[i] b[i] 100
# KERNEL: i a[i] b[i] 200
# KERNEL: i a[i] b[i] 300
# KERNEL: i a[i] b[i] 000
# KERNEL: i a[i] b[i] 100
# KERNEL: i a[i] b[i] 200
# KERNEL: i a[i] b[i] 300
# ASSERT: Error: ASRT_0005 testbench.sv(10): Assertion "ap_ab" FAILED at time: 50ns (3 clk), scope: m, start-time: 30ns (2 clk)
# ASSERT: Error: ASRT_0005 testbench.sv(10): Assertion "ap_ab" FAILED at time: 70ns (4 clk), scope: m, start-time: 50ns (3 clk)
Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact http://cvcblr.com/home.html
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
…
- SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy
- Free books: Component Design by Example https://rb.gy/9tcbhl
Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb - Papers:
- Understanding the SVA Engine,
Verification Horizons - SVA Alternative for Complex Assertions
https://verificationacademy.com/news/verification-horizons-march-2018-issue - 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