Skip to content

Conversation

seldridge
Copy link
Member

Factor out a utility for constructing distinctive messages from the CIRCT phase and into the firrtl package. This was always the plan, however, I forgot about it for years.

This is being moved and made public so that I can use it when constructing Chiselsim error messages.

Release Notes

  • Add firrtl.options.StageUtils.dramaticMessage utility for constructing distinctive error messages that do not print to stdout.

Factor out a utility for constructing distinctive messages from the CIRCT
phase and into the firrtl package.  This was always the plan, however, I
forgot about it for years.

This is being moved and made public so that I can use it when constructing
Chiselsim error messages.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
@seldridge seldridge added the Feature New feature, will be included in release notes label Feb 12, 2025
Copy link
Contributor

@jackkoenig jackkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internally, Chisel has logic to disable color use:

private[chisel3] object UseColor {

Is it possible to hook into that somehow here?

@seldridge
Copy link
Member Author

Is it possible to hook into that somehow here?

Probably in a follow-on. I'm only delaying it as this patch only adds the non-color version.

Did we ever try to do this in the normal way? I.e., most tools have a --color=[when] option where when can be one of never|always|auto where auto is the default and it means to "use color if stdout reports that it can handle it". (This then does what you usually want and will strip color if piped, but show it on the terminal.) It's kind of hard to get that information into Chisel, but that can certainly happen with that environment variable with those three settings.

@seldridge seldridge merged commit 9ba0d1c into main Feb 13, 2025
15 checks passed
@seldridge seldridge deleted the dev/seldridge/add-use-dramaticMessage branch February 13, 2025 02:31
@jackkoenig
Copy link
Contributor

jackkoenig commented Feb 13, 2025

Probably in a follow-on. I'm only delaying it as this patch only adds the non-color version.

That's reasonable.

Did we ever try to do this in the normal way?

Normalish. Chisel detects if it should use color [1], unfortunately the JVM doesn't let you check just stdout so it will only be color if all of stdin/out/err are "interactive" but it's something. Chisel also uses environment variable CHISEL_USE_COLOR to let the user specify, but yeah it doesn't take it as a CLI argument.

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