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

[WIP] add float conversion for arbitrary mantissa width and exponent width #104

Closed
wants to merge 0 commits into from

Conversation

saw235
Copy link

@saw235 saw235 commented Oct 9, 2024

No description provided.

@mkorbel1 mkorbel1 requested a review from desmonddak October 9, 2024 22:15
exponent.toInt() ==
computeMaxExponent(exponent.width) + computeBias(exponent.width) + 1;

bool isNaN() => isExponentAllOnes() && mantissa.toInt() == 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of converting to int, check if the value is zero using isZero so that you can support mantissas >64 bits

/// are counted from the most significant bit (bit width-1) towards
/// the least significant bit.
///
/// For example, the binary number 0b00101010 would return 3, as
Copy link
Contributor

Choose a reason for hiding this comment

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

aren't there 2?

///
/// For example, the binary number 0b00101010 would return 3, as
/// there are 3 leading zeroes.
int countLeadingZeroes(LogicValue value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is a good utility in a generic sense, maybe it should be an extension on LogicValue or even added to ROHD itself. If it's mostly just useful for this math stuff, let's keep it private (start name with _) so that it's not exposed as a public API

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

Successfully merging this pull request may close these issues.

2 participants