关于我的UVM验证的第一个程序

这是我写的第一个测试

首先这个程序是TPO516的RX方向的一个component 我们管这个部分叫做FAS Regen. 它的作用就是给一个overhead被破坏掉的OTN frame重新插入正确的fas信号既f6f6f6282828,一共48bit.

这个程序一共有4部分组成,分别是:fas regen_env下的fasregen_checker和otu4_data_interface;在顶层中的otu_top_harness,以及top test case:FASRegenTest。

这个程序用了一个叫做two kingdom factory的trick 他的目的是利用OTU4DataInterface::type_id::set_type_override(FASRegenInterface::get_type());这句话来overide out4data_interface.即叫做custmize function。

第一步,借鉴别人的datainterface code:

/×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

`ifndef OTU4DataInterface_sv
`define OTU4DataInterface_sv


class OTU4DataInterface extends uvm_component;
  `uvm_component_utils(OTU4DataInterface)
  
  function new(string name = "", uvm_component parent = null);
    super.new(name, parent);
  endfunction
  
  virtual task sync();
    
  endtask
  
  virtual task read(output bit [319:0] data, output bit enable);
    
  endtask 
  
endclass


`endif //OTU4DataInterface_sv

//可以看到在这个code中,sync()和 read()function都是空的 方便以后override。

××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××/

第二步 在图—top— harness里面写入FasRegenInterface.这个程序是用来override datapathinterface的function。首先这个方程需要找到两个来个ntc_otu_top_320的接口。一个为enable一个为inpute data。在top320中RX PATH,INSERT FAS BYTE中enable 信号为rx_lite_frm_oof_fas_en,data为fas regen data. 将这两个信号赋给harness中的readfunction的 data和enable,这样就完成了data的进入dut的这个过程。这个语句always @(posedge sys_clk) fas_regen_enable <= dut.rx_lite_frm_oof_fas_en;使fas—en比regen—enable早一拍。

/×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

logic fas_regen_enable;


  always @(posedge sys_clk) fas_regen_enable <= dut.rx_lite_frm_oof_fas_en;


  class FASRegenInterface extends OTU4DataInterface;
    `uvm_compon

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值