4、连接设计和测试平台
1、 测试平台模仿设计的整个运行环境。如处理器模型需要连接到不同的总线和器件,则总线和器件在测试平台中就被建模成总线功能模型。V端口繁琐需要一种更高层次的方法来和设计建立通信--接口。 需要可靠的时序方法在正确的时间点驱动和采样同步信号,避免竞争-----时钟块
2/、接口信号必须使用非阻塞赋值来驱动
3、 在模块和程序块之外声明接口变量,否则接口变化曾局部变量,对设计其他部分不可见
4、 接口interface连接端口port,端口已定义方向信息。
module top; bit clk; always #5 clk=~clk; arb_if arbif(clk); arb_port a1(.rst(arbif.rst)); test t1(arbif); endmodul
5、 modport:给信号分组并定义方向
interface arb_if(input bit clk); logic [1:0]grant,request; logic rst; modport TEST(output request,rst, input grant,clk); modport DUT(input request,rst,clk, output grant); modport MONITOR (input request,grant,rst,clk); endinterface module arb(arb_if.DUT arbif); ...//仲裁器模型 endmodule module test (arb_if.TEST arbif); ...//测试平台模型 endmodule module monitor (arb_if.MONITOR arbif); ...//接口使用mordport的监视器模型 endmodul
5、 总线设计中使用modport。接口需要为主设备、从设备和仲裁其定义三个modport,此外还需要一个监视modport。
6、 接口的优缺点