返回介绍

19.9 对接口对象的访问

发布于 2020-09-09 22:55:56 字数 1149 浏览 1036 评论 0 收藏 0

Access to all objects declared in an interface is always available by hierarchical reference, regardless of whether or not the interface is connected through a port. When an interface is connected with a modport in either the module header or port connection, access by port reference is limited to only those objects listed in the modport, for only those types of objects legal to be listed in modports (nets, variables, tasks, and functions) All objects are still visible by hierarchical reference. For example:

interface ebus_i;
    integer I; // reference to I not allowed through modport mp
    typedef enum {Y,N} choice;
    choice Q;
    parameter True = 1;
    modport mp(input Q);
endinterface

module Top;
    ebus_i ebus;
    sub s1(ebus.mod);
endmodule

module sub(interface.mp i);
    typedef i.choice yes_no; // import type from interface
    yes_no P;
    assign P = i.Q; // refer to Q with a port reference

    initial
        Top.s1.Q = i.True; // refer to Q with a hierarchical reference

    initial
        Top.s1.I = 0; // referring to i.I would not be legal because
        // is not in modport mp
endmodule

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文