2015-03-31 46 views
2

實例當接口通常實例化modports都可以訪問Modport無法訪問時,界面與陣列

如:

interface intf1; 
    reg a3, c3; 
    modport mp3 (output a3, c3); 
    assign c3 = a3; 
endinterface 

interface intf2(intf1.mp3 p2); 
assign p2.a3 = 1'b1; // access to modports available 
endinterface 

module top(input din,output reg dout); 
assign dout = din; 
    intf1 INTF1(); 
    intf2 INTF2 (INTF1); 
endmodule 

但當inerface與陣列intantiated,我無法訪問modports接口intf2,是有一種方法可以訪問intf2中的多實例interfaes的moport?

interface intf1; 
    reg a3, c3; 
    modport mp3 (output a3, c3); 
    assign c3 = a3; 
endinterface 

interface intf2(intf1.mp3 p2[3]); 
//assign p2[3].a3 = 1'b1; // compiler reports Invalid bounds count 
endinterface 

module top(input din,output reg dout); 
assign dout = din; 
    intf1 INTF1 [3:1](); 
    intf2 INTF2 (INTF1); 
endmodule 
+0

p2 [2] .a3'是否有效?我猜想元素索引從0到2. – 2015-03-31 08:52:18

+0

無法使用p2 [2]或p2 [1]錯誤作爲無效初始化 – Emman 2015-03-31 09:11:04

回答

1

檢查數組使用它們這

 interface intf2(intf1.mp3 p2[3]); 
     assign p2[0].a3 = 1'b1; 
     assign p2[1].a3 = 1'b1; 
     assign p2[2].a3 = 1'b1; // compiler reports Invalid bounds count 
    endinterface 

還要檢查以下鏈接。現在它似乎工作正常。

http://www.edaplayground.com/x/PJ7