Modports are fundamental, interfaces are just their implementations

In SystemVerilog RTL design, you’re better off avoiding explicit interface names in port declarations, and instead only using the generic ‘interface‘ keyword.

module test(interface.MP ifc, ...); ... endmodule

A pair of modports is like a pair of plugs at the two ends of a cable. As long as the modports conform to standard APIs, the modules connected across them shouldn’t care which kind of interface instance gets passed in as the implementation.

An interface, for each of its two modports, declares some signals and an always block, plus it declares some cable-like internal signals to connect the two always blocks.

For example, an always block for a modport could be a little finite-state machine that a module reads from and writes to with API function calls as provided by that kind of modport. The FSM would provide the standard level of service for that kind of modport, such as waiting for a response from a shared resource, or queuing up requests, and so on. The particular interface implementation chosen to provide that service should not matter to the module.

If in the abstract, the object doesn’t look like a glorified cable with a modport plug on each end, then it’s not a job for an interface. For example, a computer bus is a complicated module that would have many modports plugged into it. It would be passed many interface instances, but would not itself be an interface.

Advertisements

2 Comments

  1. Can you detail a little more ? I thing I got the general idea “Don’t tie your unit to a specific interface name” but this misses out the point of common *interface*, as a single-source modification for both endpoints (“Cable plugs”), which is the “interface” declaration file, along with its modports. Your suggestion poses a risk of connecting a unit to the wrong interface, just because the (other) interface had similar name modports.
    GV.

    Like

    • Exactly. Many interfaces can define the same modports. If you re-use modport names in a design, you’re asking for trouble. Define the API of your modports, deliver a conforming implementation with an interface.

      Like

Tell me (anonymous OK)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s