-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Probes to .toString Data methods #4478
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the way, i personally think (how I usually do this when i put a comment about the type) to have it as
Probe[A]<BundleTest>
case None => addProbeModifier(chiselType) | ||
// Handle DontCares specially as they are "literal-like" but not actually literals | ||
case Some(DontCareBinding()) => s"$chiselType(DontCare)" | ||
case Some(topBinding) => | ||
val binding: String = thiz._bindingToString(topBinding) | ||
val name = thiz.earlyName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sort of surprised the test is below is working:
Wire(probe.Probe(UInt(1.W))).toString should be("BoundDataModule.?: Wire[Probe<UInt<1>>]")
A Wire of probe should have a top binding...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does have a top binding? Not sure I understand..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should have top binding, this does not make sense to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I missed that you also had addProbeModifier
below.
I think it would be better to only do that once, will suggest above.
def addProbeModifier(chiselType: String): String = { | ||
probeInfo match { | ||
case None => chiselType | ||
case Some(ProbeInfo(writeable, layer)) => | ||
val layerString = layer.map(x => s"[${x.fullName}]").getOrElse("") | ||
(if (writeable) "RWProbe" else "Probe") + s"$layerString<$chiselType>" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def addProbeModifier(chiselType: String): String = { | |
probeInfo match { | |
case None => chiselType | |
case Some(ProbeInfo(writeable, layer)) => | |
val layerString = layer.map(x => s"[${x.fullName}]").getOrElse("") | |
(if (writeable) "RWProbe" else "Probe") + s"$layerString<$chiselType>" | |
} | |
} | |
val chiselTypeWithModifier = | |
probeInfo match { | |
case None => chiselType | |
case Some(ProbeInfo(writeable, layer)) => | |
val layerString = layer.map(x => s"[${x.fullName}]").getOrElse("") | |
(if (writeable) "RWProbe" else "Probe") + s"$layerString<$chiselType>" | |
} |
Then use chiselTypeWithModifier
below anywhere chiselType
was being used.
* Add probe string to .toString Data methods * Update chisel tests with new probe toString (cherry picked from commit 8c718b2) # Conflicts: # core/src/main/scala/chisel3/Data.scala # src/test/scala/chisel3/TypeEquivalenceSpec.scala # src/test/scala/chiselTests/LayerSpec.scala # src/test/scala/chiselTests/ProbeSpec.scala
Thanks! |
* Add probe string to .toString Data methods * Update chisel tests with new probe toString (cherry picked from commit 8c718b2)
* Add probe string to .toString Data methods * Update chisel tests with new probe toString (cherry picked from commit 8c718b2) Co-authored-by: Adam Izraelevitz <[email protected]>
Contributor Checklist
docs/src
?Type of Improvement
Desired Merge Strategy
Release Notes
Probe chisel types now include the kind of probe and layer in their
.toString
methodReviewer Checklist (only modified by reviewer)
3.6.x
,5.x
, or6.x
depending on impact, API modification or big change:7.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.