systemverilog中的bind

最早接触 bind 关键字是在assertion 当中,将assertion 与 dut 进行绑定连接,如下例子:

bind cpu fpu_props fpu_rules_1(a,b,c);
//cpu 是module 名字
//fpu_props 是内部包含 property 以及断言的模块,可以是 module 或者 program 甚至 interface
//fpu_rules_1 是 fpu_props 的实例名
//括号中的信号 a b c 是 cpu 的端口信号,并且连接到 fpu_props 的对应端口

来看下面一个将 interface bind 到 module 的例子:

interface range (input clk,enable, input int minval,expr);
    property crange_en;
        @(posedge clk) enable |-> (minval <= expr);
    endproperty
    range_chk: assert property (crange_en);
endinteface

bind cr_unit range r1(c_clk,c_en,v_low,(in1&&in2));

可以看到,包含断言的 interface ,其端口信号的方向均为 input ,也就是说 property 中包含的信号都是从 interface 的外部给进来的;

实际上, bind 不仅仅 可以进行 断言 与 dut 之间的连接,两个 module 之间也能进行连接,如下面例子:

有 dut.v :

 

猜你喜欢

转载自blog.csdn.net/bleauchat/article/details/127116581