Clock Verification IP

Clock Verification IP

IP 参数及接口

IP 例化界面

相关函数

start_clock

systemverilog 复制代码
//产生时钟 
<hierarchy_path>.IF.start_clock

stop_clock

systemverilog 复制代码
//停止时钟 
<hierarchy_path>.IF.stop_clock

set_initial_value

systemverilog 复制代码
//设置时钟初始值为 0
<hierarchy_path>IF.set_initial_value(0)
//设置时钟初始值为 1
<hierarchy_path>IF.set_initial_value(1)

set_clk_prd

systemverilog 复制代码
//设置时钟周期、占空比、抖动是能、抖动范围
<hierarchy_path>IF.set_clk_prd(
    .user_period(200),
    .user_duty_cycle(0.3),
    .user_jitter_on(1),
    .user_jitter_min_range(0.0),
    .user_jitter_max_range(0.01)
    );

set_clk_frq

systemverilog 复制代码
//设置时钟频率、占空比、抖动是能、抖动范围
<hierarchy_path>IF.set_clk_prd(
    .user_frequency(10000000),
    .user_duty_cycle(0.3),
    .user_jitter_on(1),
    .user_jitter_min_range(0.0),
    .user_jitter_max_range(0.01)
    );

set_master_mode

systemverilog 复制代码
//设置 CLK_VIP 模式为 Master
< hierarchy_path>.set_master_mode();

set_passthrough_mode

systemverilog 复制代码
//设置 CLK_VIP 模式为 passthrough
< hierarchy_path>.set_passthrough_mode();

参考代码

systemverilog 复制代码
`timescale 1ps / 1ps
`include "clk_monitor.sv"


module clk_vip_0_exdes_tb(
  );

  wire                                                                     clk_out;

  //Declare monitor for master CLK VIP 
  clk_monitor#(10.0)                                       mst_monitor;
  //Declare monitor for passthrough CLK VIP 
  clk_monitor#(10.0)                                       passthrough_monitor;

  initial begin

    /*******************************************************************************************   
    *    The hierarchy path of the CLK VIP's interface is passed to the monitor when it is newed
    *    construct mst_monitor and assign the master clk vip interface to its virtual interface
    *    construct passthrough_monitor and assign the passthrough clk vip interface to its
    *    virtual interface
    *******************************************************************************************/
    mst_monitor =new("Clk mst_monitor",clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_mst.inst.IF);
    passthrough_monitor =new("Clk passthrough_monitor",clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF);

    /******************************************************************************************* 
    switch passthrough VIP into runtime master mode
    *     8.1 start clock-- this will generate the default clk with period(default passthrough clk
    *         vip period) with no jitter,  duty cycle 50%
    *     8.2 turn on mst_monitor clk check with expected clk settings
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.set_master_mode();
    #1ns;
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.set_initial_value(0);
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.start_clock();
    passthrough_monitor.enable_clk_check(
    .expected_period(10.0),
    .expected_duty_cycle(0.50),
    .expected_jitter(0.0)
    );
    #(10.0*10*1ns);
    /*******************************************************************************************  
    *     9.1 update clock by calling set_clk_prd with clock period, duty cycle,jitter on/off,
    *        jitter minmum range, jitter maximum range,if jitter is on,it means
    *        that the jitter is randomized picked between jitter minmum range and jitter maximum
    *        range)
    *     9.2 turn on the monitor check with expected clock period, duty cycle and jitter
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.set_clk_prd(
    .user_period(1000),
    .user_duty_cycle(0.3),
    .user_jitter_on(1),
    .user_jitter_min_range(0.0),
    .user_jitter_max_range(0.01)
    );
    passthrough_monitor.enable_clk_check(
    .expected_period(1000),
    .expected_duty_cycle(0.3),
    .expected_jitter(0.01)
    );
    #4000ns;
    /******************************************************************************************* 
    *   10.1 update clock by calling set_clk_frq with clock frequency, duty cycle,jitter on/off,
    *        jitter minmum range, jitter maximum range,if jitter is on,it means 
    *        that the jitter is randomized picked between jitter minmum range and jitter maximum
    *        range)
    *    10.2 turn on the monitor check with expected clock period, duty cycle and jitter
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.set_clk_frq(
    .user_frequency(10000000),
    .user_duty_cycle(0.7),
    .user_jitter_on(0),
    .user_jitter_min_range(0.0),
    .user_jitter_max_range(0.00)
    );
    passthrough_monitor.enable_clk_check(
    .expected_period(100),
    .expected_duty_cycle(0.7),
    .expected_jitter(0)
    );
    #810ns;
    /*******************************************************************************************  
    * update clock again with different period and duty cycle
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.set_clk_prd(
    .user_period(200),
    .user_duty_cycle(0.4),
    .user_jitter_on(1),
    .user_jitter_min_range(0.0),
    .user_jitter_max_range(0.02)
    );
    passthrough_monitor.enable_clk_check(
    .expected_period(200),
    .expected_duty_cycle(0.4),
    .expected_jitter(0.0)
    );
    #1080ns;
    /******************************************************************************************* 
    * stop clock and disable passthrough monitor
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.IF.stop_clock();
    passthrough_monitor.disable_clk_check();
    #1;
    /*******************************************************************************************  
    * set clk_vip_passthrough back into passthrough mode
    *******************************************************************************************/
    clk_vip_0_exdes_tb.DUT.ex_design.clk_vip_passthrough.inst.set_passthrough_mode();
    #(10*1ns);
    $display("EXAMPLE TEST DONE : Test Completed Successfully");
    $finish;
  end


  chip DUT(
  .clk_out(clk_out)
  );

endmodule

官方手册:pg291-clk-vip

相关推荐
szxinmai主板定制专家1 小时前
【国产NI替代】基于国产FPGA+兆易创新GD32F450的全国产16振动+2转速(24bits)高精度终端采集板卡
fpga开发
szxinmai主板定制专家3 小时前
【国产NI替代】基于FPGA的32通道(24bits)高精度终端采集核心板卡
大数据·人工智能·fpga开发
HIZYUAN8 小时前
AGM FPGA如何配置上拉或者下拉电阻
fpga开发
∑狸猫不是猫8 小时前
(13)CT137A- 简易音乐盒设计
fpga开发
ThreeYear_s14 小时前
基于FPGA 的4位密码锁 矩阵键盘 数码管显示 报警仿真
fpga开发·矩阵·计算机外设
Anin蓝天(北京太速科技-陈)20 小时前
252-8路SATAII 6U VPX高速存储模块
fpga开发
如何学会学习?1 天前
2. FPGA基础了解--全局网络
fpga开发
Anin蓝天(北京太速科技-陈)1 天前
271-基于XC7V690T的12路光纤PCIe接口卡
嵌入式硬件·fpga开发
碎碎思1 天前
FPGA新闻速览-WiMi开发基于FPGA的数字量子计算机验证技术
fpga开发·量子计算
hi942 天前
Vivado - 远程调试 + 远程综合实现 + vmWare网络配置 + NFS 文件共享 + 使用 VIO 核
嵌入式硬件·fpga开发·vivado 远程开发·vmware网络配置