chipsalliance / firrtl-spec

The specification for the FIRRTL language
44 stars 28 forks source link

Add Lowering Convention to External, Public Modules #171

Open seldridge opened 8 months ago

seldridge commented 8 months ago

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 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}: