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

Update width-inference.md #3809

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mwachs5
Copy link
Contributor

@mwachs5 mwachs5 commented Feb 1, 2024

Fix the computation for Fill width and clarify what is meant by maxNum. Clean up formatting

Contributor Checklist

  • [N/A] Did you add Scaladoc to every public function/method?
  • [N/A] 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

  • Documentation or website-related

Desired Merge Strategy

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

Release Notes

Clarify width inference documentation.

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), 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.

Fix the computation for Fill width and clarify what is meant by maxNum. Clean up formatting
@mwachs5 mwachs5 added the Documentation Only changing documentation label Feb 1, 2024
@mwachs5 mwachs5 added this to the 3.6.x milestone Feb 1, 2024
| `z = Cat(x, y)` | `w(z) = w(x) + w(y)` |
| `z = Fill(n, x)` | `w(z) = w(x) * n` |

>where for instance `w(z)` is the bit width of wire `z`, `maxNum(n)` is the maximum number representable
Copy link
Member

Choose a reason for hiding this comment

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

Can we define minNum while visiting?

Copy link
Member

Choose a reason for hiding this comment

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

n for these shifts must be unsigned, is that right? Curious if minNum(n) is ever non-zero.

If n is 5 is maxNum(n) 5 or is it 7 (largest 3-bit number, where 3 is width of n)?

Copy link

Choose a reason for hiding this comment

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

If n is 5 is maxNum(n) 5 or is it 7 (largest 3-bit number, where 3 is width of n)?

Is there a way to check this? Cause I think when using Fill(6, 1.U), I saw a width of z to be 7.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per @dtzSiFive comment I think we should use a different thing for the last number in Fill, as there it's an Int n not a UInt-that-has-a-width n

@@ -16,22 +16,22 @@ The width of a conditionally valid expression is the width of its input expressi

Hardware operators have output widths as defined by the following set of rules:
Copy link
Member

Choose a reason for hiding this comment

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

PDF link above for firrtl spec is a 404, just noting since noticed 👍 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Only changing documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants