firrtl-spec icon indicating copy to clipboard operation
firrtl-spec copied to clipboard

Add Lowering Convention to External, Public Modules

Open seldridge opened this issue 1 year ago • 0 comments

Both external and public modules need to specify their port lowering convention. Currently, this is underspecified and left up to a compiler to implement (with annotations or a global option).

Some constraints:

  • The syntax should be similar for both external and public modules.
  • This should by optional in the syntax with a default convention (v1) assumed if not defined. This provides backwards compatibility with the current behavior.
  • The syntax shouldn't cause problems or confusion when trying to implement parameters later.
  • enablelayer currently goes after the module name

The following are some syntax ideas:

String after "public"

public v2 module Foo:

This is slightly problematic as it is incongruent with external modules which don't have the public keyword. We could add the public keyword to them:

public v1 extmodule Bar:

Use a string that starts with v after the module name:

public module Foo v2 enablelayer A:
extmodule Bar v1:

Use brackets, parentheses, or something like that

public module<v2> Foo:
extmodule<v1> Bar:

I expect that parameters will eventually show up as Foo<x: Int> type syntax, so this may not conflict too badly.

Make the convention port-like

public module Foo:
  convention v2
extmodule Bar:
  convention v1

Use an attribute dictionary-like syntax

public module Foo enablelayer A {convention = v2}:
extmodule Bar {convention = v1}:

seldridge avatar Feb 11 '24 05:02 seldridge