如何在顶层模块(在测试台中)中使用参数声明虚拟接口?

How to declare virtual interface with params in the top module (in the testbench)?

我有以下参数化接口:

interface axi_interface #(parameter DATA_SIZE = 0)
  (input bit ACLK, input bit ARESETn);
   //write address channel signals
   logic [3:0]  AWID; //
   logic [31:0] AWADDR;
   .....
   .....
endinterface

我尝试在顶层模块(在测试台中)中将此接口声明为虚拟接口

module girobo2_tb_top;
   .....
   .....
   axi_interface #(.DATA_SIZE(63)) axi_vif(tb_axi_clk, axi_arstn);
   .....
   .....
endmodule

但是当我尝试 运行 模拟时出现以下错误:

** 错误:(vsim-7065) ../sv/girobo2_tb_top.sv(245):从类型 'interface axi_interface #(.DATA_SIZE(63))' 到类型 'virtual axi_interface' 的非法分配:Vir。 'axi_interface'接口必须分配一个匹配的接口或虚拟接口。

为了将参数化接口分配给虚拟接口,您也需要对虚拟接口进行参数化,例如:

virtual axi_interface #(.DATA_SIZE(63)) vif;

https://www.edaplayground.com/x/3KvL

你可能想在我公司的网站上观看这个 video tutorial,这是我刚刚看到的。您会在这里看到其他常规贡献者之一。