Skip to content

Conversation

@seldridge
Copy link
Member

Dramatically increase the power of the '--module' argument to 'circt.stage.ChiselMain'. This adds support for constructing modules with parameters using reflection as demonstrated elsewhere [1].

This is long missing support that I intended to add when both the original reflective construction was added [2] and turned on [3]. At the time, I didn't know how to do reflective construction of arbitrary modules and left that feature unfinished for the next 5 years.

This is done to move 'ChiselMain' more in the direction of being a command line utility for running Chisel generators. This is related to the discussions of a hypothetical 'chisel-cli' that has been discussed on #4351.

This commit changes the API such that any class constructed this way must take a trailing '()'. Anything without this will be interpreted as a string. This is a change to how '--module' used to work where the argument was assumed to be a class.

This commit changes the API such that any class constructed this way must
take a trailing '()'. Anything without this will be interpreted as a
string. This is a change to how '--module' used to work where the
argument was assumed to be a class.

Release Notes

Improve ChiselMain so that it can accept parameters. This provides a command-line entrypoint to build Chisel modules without having to create a dedicated main function. E.g., things like scala-cli run -M circt.stage.ChiselMain Foo.scala -- --module Foo(42,"hello") --target systemverilog --split-verilog --target-dir build are now possible. Previously, only parameter-less modules could be constructed this way.

Dramatically increase the power of the '--module' argument to
'circt.stage.ChiselMain'.  This adds support for constructing modules with
parameters using reflection as demonstrated elsewhere [[1]].

This is long missing support that I intended to add when both the original
reflective construction was added [[2]] and turned on [[3]].  At the time,
I didn't know how to do reflective construction of arbitrary modules and
left that feature unfinished for the next 5 years.

This is done to move 'ChiselMain' more in the direction of being a command
line utility for running Chisel generators.  This is related to the
discussions of a hypothetical 'chisel-cli' that has been discussed on

This commit changes the API such that any class constructed this way must
take a trailing '()'.  Anything without this will be interpreted as a
string.  This is a change to how '--module' used to work where the
argument was assumed to be a class.

[1]: https://github.com/seldridge/reflective-builder
[2]: a423db5
[3]: 4eff16b

Signed-off-by: Schuyler Eldridge <[email protected]>
@seldridge seldridge added Feature New feature, will be included in release notes API Modification and removed API Modification labels Aug 18, 2024
@seldridge seldridge merged commit da4cb2d into main Aug 18, 2024
@seldridge seldridge deleted the dev/seldridge/the-return-of-chisel-main branch August 18, 2024 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature, will be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants