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

Add bitmanip extension support #525

Merged
merged 9 commits into from
Dec 23, 2024

Conversation

visitorckw
Copy link
Collaborator

Add support for the RISC-V bitmanip extensions Zba, Zbb, Zbc, and Zbs. These extensions optimize bitwise operations such as memory addressing, bitfield manipulation, counting leading/trailing zeros, and extracting subfields. All implementations have been validated through architectural tests, ensuring their correctness and reliability in emulating these operations.

Introduce the rv_ctz() function to compute the count of trailing zeros
in a 32-bit integer. This function serves as a prerequisite for
implementing the ctz instruction in the RISC-V Zbb extension.
Introduce the rv_popcount() function to compute the population count
(number of set bits) in a 32-bit integer. This function is a
prerequisite for implementing the cpop instruction in the RISC-V Zbb
extension.
Add support for the RISC-V Zba address generation extension. These
instructions combine shift and addition operations, enabling efficient
address calculation in pointer arithmetic and memory access patterns.

Supporting the Zba extension improves compatibility with the RISC-V
specification and enables optimized handling of address generation
tasks.
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Benchmarks

Benchmark suite Current: 73dea0c Previous: e7ded18 Ratio
Dhrystone 1337 Average DMIPS over 10 runs 1301 Average DMIPS over 10 runs 0.97
Coremark 975.043 Average iterations/sec over 10 runs 977.65 Average iterations/sec over 10 runs 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Update the top-level README.md as well.

src/decode.c Outdated Show resolved Hide resolved
Add support for the RISC-V Zbb basic bit-manipulation extension. This
extension introduces fundamental bitwise operations such as bit
counting, bit field extraction, and bit rotation, enabling efficient
data manipulation and low-level computation.

Supporting the Zbb extension improves compatibility with the RISC-V
specification and enables optimized handling of bitwise operations in a
wide range of applications.
Add support for the RISC-V Zbc carry-less multiplication extension.
This extension introduces instructions for carry-less multiplication,
enabling efficient operations in cryptographic algorithms,
error-correcting codes, and other specialized applications.

Supporting the Zbc extension improves compatibility with the RISC-V
specification and enables optimized handling of carry-less
multiplication tasks.
Add support for the RISC-V Zbs single-bit instructions extension. This
extension introduces instructions for efficient manipulation of
individual bits, enabling optimized operations in bit-level processing
and control.

Supporting the Zbs extension improves compatibility with the RISC-V
specification and enhances performance in tasks requiring precise
single-bit operations.
Update the RISC-V architectural test to include support for testing the
Zba, Zbb, Zbc, and Zbs extensions.

With this change, users can run tests for these extensions using the
following command:

make arch-test RISCV_DEVICE=IMZbaZbbZbcZbs
Add tests for the Zba, Zbb, Zbc, and Zbs extensions to the CI pipeline,
ensuring that these extensions are validated automatically during
continuous integration.
Update the README to include details about the RISC-V Zba, Zbb, Zbc,
and Zbs bit manipulation extensions.
@visitorckw visitorckw force-pushed the add-bitmanip-extension-support branch from e7ded18 to 73dea0c Compare December 23, 2024 13:33
@jserv jserv added this to the release-2024.2 milestone Dec 23, 2024
@jserv jserv merged commit f69d9dd into sysprog21:master Dec 23, 2024
8 checks passed
@jserv
Copy link
Contributor

jserv commented Dec 23, 2024

Thank @visitorckw for contributing!

@visitorckw visitorckw deleted the add-bitmanip-extension-support branch December 23, 2024 18:06
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.

3 participants