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

Refactor MUL instruction #466

Merged
merged 1 commit into from
May 12, 2024
Merged

Conversation

Alasdair
Copy link
Collaborator

@Alasdair Alasdair commented May 9, 2024

It was brought to my attention that this instruction had a bit of a case of the 'boolean blindness' code smell, where the mul operation was represented as a triple of booleans. This commit refactors the implemention to use a struct with named fields for high, signed1, and signed2.

The C_MUL instruction in Zcb also needs to be changed appropriately

The mul_op struct was added in riscv_types

While I was there I did some light housekeeping w.r.t a comment about a workaround for Sail < 0.15.1, as this is no longer needed. I could split this into a separate commit, but not sure if it's worthwhile to do so.

Copy link

github-actions bot commented May 9, 2024

Test Results

712 tests  ±0   712 ✅ ±0   0s ⏱️ ±0s
  6 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit f852d65. ± Comparison against base commit 82acf05.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

Looks much nicer!

model/riscv_insts_mext.sail Outdated Show resolved Hide resolved
This instruction had a bit of a case of 'boolean blindness' code smell,
where the mul operation was represented as a triple of booleans. This
commit refactors the implemention to use a struct with named fields for
high, signed_rs1, and signed_rs2.

The C_MUL instruction in Zcb also needs to be changed appropriately

The mul_op struct was added in riscv_types

While there do some housekeeping w.r.t the comment about a workaround for
Sail < 0.15.1, as this is no longer needed.
@Alasdair
Copy link
Collaborator Author

I made the suggested change so signed1 is now signed_rs1 and likewise for signed2, as well as rebased to the latest commit.

@billmcspadden-riscv billmcspadden-riscv merged commit e1242d8 into riscv:master May 12, 2024
2 checks passed
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.

4 participants