Skip to content

Conversation

jackkoenig
Copy link
Contributor

I was working on something complicated and this would help a lot with development.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Feature (or new API)

Desired Merge Strategy

  • Squash

Release Notes

This is for debugging generated FIRRTL only--comments are ignored by the FIRRTL compiler.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash) and clean up the commit message.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

This is useful for debugging complex generators
@jackkoenig jackkoenig added this to the 7.0 milestone Jun 8, 2025
@jackkoenig jackkoenig requested a review from seldridge June 8, 2025 18:47
@jackkoenig jackkoenig added the Feature New feature, will be included in release notes label Jun 8, 2025
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

Nice. This seems useful for debugging generators.

In the future, I'm very open to figuring out how to have comments that are preserved to Verilog. This is a different beast, though.

Also in the future, consider an option that completely disables all comment emission from Chisel. This is an API which can cause problems for build caching depending on how people start to use this.

Comment on lines +303 to +310
while ({
val line = it.next()
b ++= "; "; b ++= line
if (it.hasNext) {
newLineAndIndent()
}
it.hasNext
}) ()
Copy link
Member

Choose a reason for hiding this comment

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

I know this is the correct approach given that Scala dropped do--while. It still looks weird to me, though... 🫠

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't love it but it is the most direct way to write this and I do prefer it to duplicating logic for first line vs. the rest 🤷‍♂️

@jackkoenig jackkoenig merged commit 046ae39 into main Jun 8, 2025
18 checks passed
@jackkoenig jackkoenig deleted the jackkoenig/firrtl-comment branch June 8, 2025 19:25
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