Skip to content
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

Extend constants in probe.force and probe.forceInitial methods. #3418

Merged
merged 7 commits into from Jul 18, 2023

Conversation

debs-sifive
Copy link
Contributor

@debs-sifive debs-sifive commented Jul 12, 2023

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

  • Bugfix

Desired Merge Strategy

  • Squash: The PR will be squashed and merged (choose this if you have no preference).

Release Notes

Properly extend forced values in probe.force and probe.forceInitial methods. Error out on unknown widths.

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.5.x, 3.6.x, or 5.x depending on impact, API modification or big change: 6.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 with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@debs-sifive debs-sifive added the Bugfix Fixes a bug, will be included in release notes label Jul 12, 2023
@jackkoenig jackkoenig added this to the 6.0 milestone Jul 12, 2023
@@ -83,7 +93,7 @@ package object probe extends SourceInfoDoc {
/** Override existing driver of a writable probe. */
def force(clock: Clock, cond: Bool, probe: Data, value: Data)(implicit sourceInfo: SourceInfo): Unit = {
requireHasWritableProbeTypeModifier(probe, "Cannot force a non-writable Probe.")
pushCommand(ProbeForce(sourceInfo, clock.ref, cond.ref, probe.ref, value.ref))
pushCommand(ProbeForce(sourceInfo, clock.ref, cond.ref, probe.ref, padData(value, probe.width.get).ref))
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if the width of a Probe itself is unknown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Repeating from the conversation on slack, firtool errors out if the probe width does not eventually compute to the force value width. So I have decided for now to just error if either of these widths are unknown, though for future purposes this may be too strict.

Comment on lines 81 to 82
case Some(w) =>
if (w > probeWidth) Builder.error(s"Data width $w is larger than $probeWidth.")
Copy link
Contributor

Choose a reason for hiding this comment

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

If probe width is unknown, but data width is known, there's an extra error being generated that is unnecessary. I think you should tweak this like so:

Suggested change
case Some(w) =>
if (w > probeWidth) Builder.error(s"Data width $w is larger than $probeWidth.")
case Some(w) =>
if (probe.widthOption.exists(w > _)) Builder.error(s"Data width $w is larger than $probeWidth.")

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.

Looks good but there is 1 minor issue where 1 error will cause an extra one to be reported and the 2nd one is wrong, please fix then feel free to merge!

@debs-sifive debs-sifive added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Jul 18, 2023
@mergify mergify bot merged commit 6370990 into main Jul 18, 2023
17 checks passed
@mergify mergify bot deleted the probe-const-ext branch July 18, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Fixes a bug, will be included in release notes Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants