Re: [sv-bc] Access to interfaces through methods rather than objects

From: Dave Rich <David.Rich@synopsys.com>
Date: Wed Mar 31 2004 - 08:48:54 PST

Peter,

The language does not require that interface members be listed in
modports if they are used by imported methods. In this way interfaces
are like classes that keep members private and allow access only through
their methods.

However, a synthesis style might require them because of the way it
in-lines the methods. That is an issue for the tool.

Dave

Peter Jensen wrote:

>Hi,
>
>When using interface methods (functions/tasks) to access objects (e.g.
>variables) within interfaces, it is clear that such methods should be listed
>in the modport using the import keyword. But should the objects be listed as
>well?
>
>Example:
>
>interface intf;
> bit a, b, q;
>
> function void f_calc();
> q = a & b;
> endfunction
>
> modport mp1 (import function f_calc());
> modport mp2 (input a, input b, output q, import function f_calc());
>endinterface
>
>module m1;
> intf intf_i ();
> m2 m2_i (.intf_i(intf_i.mp1));
>endmodule;
>
>module m2 (interface intf_i);
> always_comb
> intf_i.f_calc();
>endmodule
>
>
>Question:
>Should modport m1 or m2 be used when connecting the interface to m2?
>
>If m1 cannot be used, the use of real generic interfaces is partly
>inhibited, as the objects a, b, q also can be accessed by the interface
>client. Modport m1 forces the interface client to access the interface by
>methods.
>
>An EDA tool used for synthesis required that m2 was used in this example.
>
>
>---
>Peter Jensen
>SyoSil Consulting
>Himmelev Bygade 53
>DK-4000 Roskilde
>Tel/Fax +45 46 36 11 32
>Mobile +45 40 58 10 00
>mailto:peter@syosil.dk
>
>
>
>
>

-- 
--
David.Rich@Synopsys.com
Technical Marketing Consultant and/or
Principal Product Engineer
http://www.SystemVerilog.org
tele:  650-584-4026
cell:  510-589-2625
Received on Wed Mar 31 08:49:09 2004

This archive was generated by hypermail 2.1.8 : Wed Mar 31 2004 - 08:49:34 PST