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

[prim] Add mubix_logic_test_true_strict function #26500

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

Conversation

martin-velay
Copy link
Contributor

  • this function is similar to mubix_test_true_strict, but takes a logic as input instead of a mubix_t type.

@martin-velay martin-velay requested a review from rswarbrick March 4, 2025 11:15
@martin-velay martin-velay self-assigned this Mar 4, 2025
@martin-velay martin-velay marked this pull request as ready for review March 4, 2025 11:15
@martin-velay
Copy link
Contributor Author

@rswarbrick, FYI this PR should be merged before #26446 to avoid to break the master

// The strict version of this function requires
// the multibit value to equal True.
function automatic logic mubi${nbits}_logic_test_true_strict(logic [${nbits-1}:0] val);
return MuBi${nbits}True === mubi${nbits}_t'(val);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you need this cast? I think SV will consider the enum value as a bit vector without it (which is what we want). It doesn't really matter, but this avoids casting a possibly-bogus bit vector to the enum type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I though I need it, but finally you're right I don't ! Thanks. I have pushed the change. BTW in case you haven't noticed I have preferred to check for a strict equivalence === just in case as the input is a logic.

- this function is similar to mubix_test_true_strict, but takes a logic
  as input instead of a mubix_t type.

Signed-off-by: Martin Velay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants