-
Notifications
You must be signed in to change notification settings - Fork 217
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
adding a Plusargs Bridge, with unit tests and TutorialSuite tests #1291
Conversation
…ala docs and doxygen
1572c59
to
6c708e9
Compare
std::string name = name_orig; | ||
|
||
// remove all leading white space | ||
while (name.at(0) == ' ') { |
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.
Breaking from convention, would it be possible to do such argument parsing outside the bridge constructor? Not necessarily in this PR, but maybe in the future. If exceptions will be disabled, there will be no way to report errors from constructors without exiting right away.
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.
Yeah, that makes a ton of sense. The whole +arg managements needs a rework (better scoping, better discoverability etc...) and pulling the parsing out of the bridge constructor would play nicely into that.
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.
The scala bridge code looks great -- i mostly have nits. My main concern is with the ScalaTests for the target-side of the bridge which could be cleaned up some and made dry-er.
sim/midas/src/test/scala/midas/widgets/PlusargsBridgeSpec.scala
Outdated
Show resolved
Hide resolved
sim/midas/src/test/scala/midas/widgets/PlusargsBridgeSpec.scala
Outdated
Show resolved
Hide resolved
sim/midas/src/test/scala/midas/widgets/PlusargsBridgeSpec.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: David Biancolin <david.biancolin@sifive.com>
Co-authored-by: David Biancolin <david.biancolin@sifive.com>
…dge.scala Co-authored-by: David Biancolin <david.biancolin@sifive.com>
Co-authored-by: David Biancolin <david.biancolin@sifive.com>
Co-authored-by: David Biancolin <david.biancolin@sifive.com>
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 really shaping up!
Mostly just nits now
@@ -67,7 +74,7 @@ class SimUtilsSpec extends AnyFlatSpec { | |||
portIntRef.copy(component = Seq(TargetToken.Field("bits"))) | |||
), | |||
) | |||
require(data.typeEquivalent(UInt(32.W))) | |||
require(DataMirror.checkTypeEquivalence(data, UInt(32.W))) |
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.
Why did you have to change these? I feel like nandor got them already?
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 changed these by grabbing from nandor's commit directly because his commit was waiting to be merge to master. I could have waited and rebased instead
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.
If you want, I can rebase before we merge. However because I pulled the files exactly the squash merge should identify the files as same and not generate any conflicts
sim/midas/src/test/scala/midas/widgets/PlusArgsBridgeSpec.scala
Outdated
Show resolved
Hide resolved
*/ | ||
class PlusArgsDUT(implicit val p: Parameters) extends Module { | ||
|
||
def testGroup0(): PlusArgsBridgeParams = { |
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.
In the future you could use an enum-like thing to capture more semantic information about each test in the type itself.
e.g.:
sealed trait PlusArgTest { def params: PlusArgsBridgeParams}
case object WidePlusArgTest extends PlusArgTest { def params = PlusArgsBridgeParams(name = "plusar_v=%d", default = BigInt("276783146634859761135"), width = 68)}
...
case object PlusArgsTestTypeKey extends Field[PlusArgTest]
etc...
Co-authored-by: David Biancolin <david.biancolin@sifive.com>
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.
One final thing -- you probably want to add a few instantiations to firesim_top.cc
Otherwise ship it!
Adding a Plusargs Brige. Currently only the
%d
format is supported.Related PRs / Issues
UI / API Impact
Verilog / AGFI Compatibility
This shouldn't change any existing code, but adds compatibilty with
Contributor Checklist
changelog:<topic>
label?ci:fpga-deploy
label?Please Backport
label?Reviewer Checklist (only modified by reviewer)
Note: to run CI on PRs from forks, comment
@Mergifyio copy main
and manage the change from the new PR.changelog:<topic>
label?