chipsalliance / firrtl-spec

The specification for the FIRRTL language
38 stars 27 forks source link

[minor] Add ABI to public module, extmodule #202

Open seldridge opened 4 months ago

seldridge commented 4 months ago

Add a way to specify the port lowering ABI of a public module or an external module. This uses syntax like the following:

public module<v1> Foo:

extmodule<v2> Bar:

This includes language that indicates that the "v1" ABI is used if no ABI is specified. This makes this change fully backwards compatible with older FIRRTL versions (and thereby a "minor" change).

Fixes #171.

seldridge commented 4 months ago

Also, note that this is intended to not conflict with a future syntax for parameters or type parameters which would look similar, but would be located after the module name and not placed on the module keyword. Spitballing:

public module<v2> Foo<x: Int, y: String>:
seldridge commented 2 months ago

Do instances need to specify this?

They do not. It would also create some complications if they did as a single public module could then have different conventions requiring using the convention as part of the resulting module's name (this would affect the ABI of the module name and not just expectations around its ports).

mmaloney-sf commented 2 months ago

Absolute bikeshed: For the syntax, could we add a Java/Scala-style annotation syntax?

Eg:

@abi("v1")
public module Foo:

@abi("v2")
extmodule Bar: