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 support for the Zvk* ISA extensions #333

Merged
merged 8 commits into from
Jul 19, 2024

Conversation

cmuellner
Copy link
Contributor

@cmuellner cmuellner commented Apr 9, 2023

This patch introduces support for the RISC-V Zvk* ISA extensions:

  • Zvkb
  • Zvkg
  • Zvkned
  • Zvknh[a,b]
  • Zvksh
  • Zvksed

The Zvk* extensions are not frozen yet, but
The implementation follows the version 20230303 of the specification,
which can be found here:
https://github.com/riscv/riscv-crypto/releases/tag/v20230303

There is an updated version available which introduces significant changes (e.g. new instructions),
but public patchset for Binutils, GCC, QEMU, Spike and SAIL only support the spec version, that this
PR supports.

There is zero support for vector instructions in this repository or any related repo (e.g. riscv-ctg).
Therefore, this PR introduces new helper macros in the first commit (inspired by the existing ones).

All tests have been hand-written.

Description

Provide a detailed description of the changes performed by the PR.

Related Issues

Please list all the issues related to this PR. Use NA if no issues exist

Ratified/Unratified Extensions

  • Ratified
  • Unratified

List Extensions

List the extensions that your PR affects. In case of unratified extensions, please provide a link to the spec draft that was referred to make this PR.

Reference Model Used

  • SAIL
  • Spike
  • Other - < SPECIFY HERE >

Mandatory Checklist:

  • All tests are compliant with the test-format spec present in this repo ?
  • Ran the new tests on RISCOF with SAIL/Spike as reference model successfully ?
  • Ran the new tests on RISCOF in coverage mode
  • Link to Google-Drive folder containing the new coverage reports (See this for more info): < SPECIFY HERE >
  • Link to PR in RISCV-ISAC from which the reports were generated : < SPECIFY HERE >
  • Changelog entry created with a minor patch

Optional Checklist:

  • RISCV-V CTG PR link if tests were generated using it : < SPECIFY HERE >
  • Were the tests hand-written/modified ?
  • Have you run these on any hard DUT model ? Please specify name and provide link if possible in the description
  • If you have modified arch_test.h Please provide a detailed description of the changes in the Description section above.

This patch includes initial vector support for ACT.
It defines a couple of new macros that allow to test
vector instructions.

Key features:
- defines four GPRs that have be reserved
- enablement code for vector unit
- helper macro to update test signatures
- support for all SEW configurations (8, 16, 32, 64 bits)
- support for all immediate AVL values (0..31 elements)
- If VLENB indicates that a test can't be executed, then it will be skipped
- Support for several instruction formats (VV, VVR, VVU, VVV with and
  without vm bit set)

Known limitations:
- Vector configuration will be set with vsetivli x0, AVL, eSEW, m1, ta, ma
- No tests for invalid configurations (that would trigger exceptions)

Signed-off-by: Christoph Müllner <[email protected]>
@pawks
Copy link
Collaborator

pawks commented Apr 10, 2023

The tests do look good. However, this PR does not indicate any coverage information. Tests cannot be merged without corresponding coverage reports/support.

@pawks
Copy link
Collaborator

pawks commented Apr 10, 2023

Additionally, I see that the tests in rv32 are also replicated for rv64. If the same assembly file is relevant for both rv32 and rv64 then it should be present only once under the rv32 directory.

When a test is applicable for multiple extensions, it is placed under the repository corresponding to the extension which occurs first canonically.

@cmuellner
Copy link
Contributor Author

I'm not sure how you envision coverage reports without vector support in the riscv-ctg repo.
I would claim that generic vector support cannot be part of this PR.

Anyway, I've created a PR with initial ctg files for Zvk: riscv-software-src/riscv-ctg#61

This patch introduces support for Zvkb:
- vandn.[vv,vx]
- vbrev8.v
- vclmul.[vv,vx]
- vclmulh.[vv,vx]
- vrev8.v

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
This patch introduces support for Zvkg:
- vghsh.vv
- vgmul.vv

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
This patch introduces support for Zvkned:
- vaesdf.[vs,vv]
- vaesdm.[vs,vv]
- vaesef.[vs,vv]
- vaesem.[vs,vv]
- vaeskf1.vi
- vaeskf2.vi
- vaesz.vs

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
This patch introduces support for Zvknh[a,b]:
- vsha2ch.vv
- vsha2cl.vv
- vsha2ms.vv

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
This patch introduces support for Zvksed:
- vsm4k.vi
- vsm4r.vv
- vsm4r.vs

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
This patch introduces support for Zvksh
- vsm3c.vi
- vsm3me.vv

Support for RV32 and RV64 is added, but both versions are identical.

Signed-off-by: Christoph Müllner <[email protected]>
@cmuellner
Copy link
Contributor Author

PR has been updated: the duplicated rv64 tests have been removed.

@charmitro
Copy link

Test reports for the following can be found here:

  • Zvkned
  • Zvksed
  • Zvksh
  • Zvkg

@allenjbaum
Copy link
Collaborator

allenjbaum commented Jun 14, 2023 via email

@UmerShahidengr
Copy link
Collaborator

Its pre-req PR at CTG (PR#61) has been reviewed, and it is good to go. Tests are also good, happy to merge this one.

@UmerShahidengr UmerShahidengr merged commit 02aa1d4 into riscv-non-isa:dev Jul 19, 2024
2 checks passed
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.

7 participants