0

我正在尝试编写 sytemverilog 断言以确定时钟周期(140MHz),任意 + 或 - 值为 0.001ns,在此 systemverilog 属性中,此 systemverilog 属性使用“或”运算符(||)用于时间周期的 +/- 偏差/变化,但输出不符合预期,任何人都可以解释这个的确切原因是什么?对于 clk_prd 的任何值,断言都会被断言,这不是预期的,还请提及这个的最佳解决方案是什么?

下面的代码片段,

module clock_gen();
    timeunit 1ns;
    timeprecision 100ps;  
    bit clk;
    realtime clk_prd =1000/340.0ns; //2.9411764
    //realtime clk_prd =1000/140.0ns; //7.1428571
    property SVA_clk(real clk_prd);
      time current_time;
      (('1,current_time=$realtime) |=> 
        (clk_prd <= $realtime-(current_time - 0.001ns)) ||
        (clk_prd >= $realtime-(current_time + 0.001ns))); 
    endproperty

    assert_period:assert property (@(posedge clk)SVA_clk(clk_prd))
      $display("clk pass : %0t ",$realtime); 
    else
      $warning("clk fail : %0t",$realtime);
    initial forever #7.1428 clk=!clk; 
    initial begin 
      repeat(15) @(posedge clk); 
      $finish; 
    end
    endmodule : clock_gen

电流输出:

clk pass : 213 
clk pass : 355 
clk pass : 497 
clk pass : 639 
clk pass : 781 
clk pass : 923 
clk pass : 1065 
clk pass : 1207 
clk pass : 1349 
clk pass : 1491 
clk pass : 1633 
clk pass : 1775 
clk pass : 1917 

预期产出

clk fail : 213 
clk fail : 355 
clk fail : 497 
clk fail : 639 
clk fail : 781 
clk fail : 923 
clk fail : 1065 
clk fail : 1207 
clk fail : 1349 
clk fail : 1491 
clk fail : 1633 
clk fail : 1775 
clk fail : 1917  

(参考链接

4

1 回答 1

1

你的代码有很多问题

  1. timeprecision应该在1ps编写的代码中
  2. current_time应声明为realtime
  3. 你的时钟发生器周期是 14.2,但你应该写#(7.1428ns/2)
  4. 你要么已经+/-反转,要么<=/>=反转。
于 2017-07-25T15:16:37.030 回答