chisel
                                
                                 chisel copied to clipboard
                                
                                    chisel copied to clipboard
                            
                            
                            
                        Fix ChiselStage and Builder handling of logging (backport #3895)
This is an automatic backport of pull request #3895 done by Mergify. Cherry-pick of 88d147d90ca09dc98039071acd7d83489225dff1 has failed:
On branch mergify/bp/3.6.x/pr-3895
Your branch is up to date with 'origin/3.6.x'.
You are currently cherry-picking commit 88d147d90.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
	new file:   src/main/scala/circt/stage/Shell.scala
Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
	both modified:   core/src/main/scala/chisel3/internal/Builder.scala
	both modified:   docs/src/cookbooks/cookbook.md
	deleted by us:   docs/src/explanations/warnings.md
	deleted by us:   firrtl/src/main/scala/logger/Logger.scala
	both modified:   src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
	both modified:   src/main/scala/chisel3/stage/phases/Elaborate.scala
	both modified:   src/main/scala/circt/stage/ChiselStage.scala
	both modified:   src/test/scala/circtTests/stage/ChiselStageSpec.scala
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
- @Mergifyio refreshwill re-evaluate the rules
- @Mergifyio rebasewill rebase this PR on its base branch
- @Mergifyio updatewill merge the base branch into this PR
- @Mergifyio backport <destination>will backport this PR on- <destination>branch
Additionally, on Mergify dashboard you can:
- look at your merge queues
- generate the Mergify configuration with the config editor.
Finally, you can contact us on https://mergify.com
Original PR Body
I originally set out just to fix the minor issue of Chisel not doing Logger.withScope, that ended up being more involved than I expected.
Long-term, we should probably ditch our Logger code and switch to a more robust solution, probably scribe or scribe + a thin wrapper around it. But this fix is needed for anything using firtool-resolver, otherwise it's really painful for the user to debug what is going wrong with that.
Contributor Checklist
- [ ] Did you add Scaladoc to every public function/method?
- [x] Did you add at least one test demonstrating the PR?
- [x] Did you delete any extraneous printlns/debugging code?
- [x] Did you specify the type of improvement?
- [x] Did you add appropriate documentation in docs/src?
- [x] Did you request a desired merge strategy?
- [x] Did you add text to be included in the Release Notes for this change?
Type of Improvement
- Bugfix
Desired Merge Strategy
- Squash
Release Notes
- Adds support for --log-leveltocirct.stage.ChiselStage
- Previously, object circt.stage.ChiselStagewas ignoring the Logger.
- Also, Chisel was not creating its own logger scope which could lead to clobbering of the Console when running invoking Chisel in the same process multiple times.
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, or6.xdepending 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), clean up the commit message, and label withPlease Merge.
- [ ] Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.
 
- [ ] Squash: You/ the contributor 
Cherry-pick of 88d147d90ca09dc98039071acd7d83489225dff1 has failed:
On branch mergify/bp/3.6.x/pr-3895
Your branch is up to date with 'origin/3.6.x'.
You are currently cherry-picking commit 88d147d90.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
	new file:   src/main/scala/circt/stage/Shell.scala
Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
	both modified:   core/src/main/scala/chisel3/internal/Builder.scala
	both modified:   docs/src/cookbooks/cookbook.md
	deleted by us:   docs/src/explanations/warnings.md
	deleted by us:   firrtl/src/main/scala/logger/Logger.scala
	both modified:   src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
	both modified:   src/main/scala/chisel3/stage/phases/Elaborate.scala
	both modified:   src/main/scala/circt/stage/ChiselStage.scala
	both modified:   src/test/scala/circtTests/stage/ChiselStageSpec.scala
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
This backport needs https://github.com/chipsalliance/chisel/commit/f1b5efff4a30734c5e8f838d1d8384c15e8d5112