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 Zvkb extension #236

Open
wants to merge 15 commits into
base: vector-dev
Choose a base branch
from

Conversation

charmitro
Copy link
Contributor

Implements the Zvkb (Vector Bit-manipulation used in Cryptography) extension, as of version Draft: 20230303

The following instructions are included:

  • vclmul.[vv,vx]
  • vclmulh.[vv,vx]
  • vrol.[vv,vx]
  • vror.[vv,vx,vi]
  • vbrev8.v
  • vrev8.v
  • vandn.[vv,vx]

All instructions were tested with VLEN & ELEN being manually adjusted; results were compared with QEMU results of each instruction.

Current revision is rebased with the latest changes of vector-dev branch.

XinlaiWan and others added 3 commits March 22, 2023 09:01
…iscv#191)

* V extension general framework and configuration setting instructions

* Update model/riscv_insts_vext_utils.sail

fix a typo

Co-authored-by: Nicolas Brunie <nibrunie@gmail.com>
Signed-off-by: BrighterW <xinlai.w@rioslab.org>

* Update model/riscv_insts_vext_vset.sail

* Revisions after Nov 22 meeting

* Update effect matching for functions in riscv_vlen.sail

* Fix code formatting issues

* Update model/riscv_insts_vext_utils.sail

Co-authored-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Xinlai Wan <xinlai.w@rioslab.org>

* Fix coding style issues

* Update vset instructions

Signed-off-by: BrighterW <xinlai.w@rioslab.org>
Signed-off-by: Xinlai Wan <xinlai.w@rioslab.org>
Co-authored-by: Nicolas Brunie <nibrunie@gmail.com>
Co-authored-by: Jessica Clarke <jrtc27@jrtc27.com>
* Add vector load / store instructions

* Modify the implementation of SEW, LMUL, VLEN and avoid real numbers in the code

* Update vstart setting in vector load / store instructions

* Remove unnecessary assert statements in vector instructions

* Fix bugs in vleff instructions and revise coding styles

* Add guards for vector encdec clauses, Avoid redundant memory access after vector load/store failure
* Add vector arithmetic & mask instructions

* Update vector EEW and EMUL checking function

* Add vector instruction illegal check functions

* Adjust code formatting for vector instruction illegal check functions

Merge approved by team at tech-golden-model meeting on 2023-03-14.
@charmitro
Copy link
Contributor Author

Updated the PR:

  • Correction on iterating based on the specification
  • Correctly Load & Store from/to vector registers

* Add vector floating-point instructions

* Update vector floating-point conversion instructions

* Update copyright headers for vector extension code

---------

Co-authored-by: xwan <xinlai.wan@rivai.ai>
@charmitro
Copy link
Contributor Author

Rebased from vector-dev branch.

@charmitro
Copy link
Contributor Author

Updated the patchset:

  • Make sure we are running in sizeof(xlen) == 64bit

@nibrunieAtSi5
Copy link

nibrunieAtSi5 commented May 25, 2023

Since this extension was later split into Zvbb + Zvbc and extended with new instructions, is the plan to review / merge it as it is and then update the SAIL with a new PR or to update that PR ?

XinlaiWan and others added 11 commits June 12, 2023 14:28
* Add vector mask and reduction instructions

* Fix register overlap check in vector mask instructions

---------

Co-authored-by: xwan <xinlai.wan@rivai.ai>
To support the implementation of Zvkb extensions in SAIL, this
creates the necessary infrastructure(i.e., a file to hold it, and the
extension macro), preparing the tree for the Zvkb implementation.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Vector rotate left by vector(.vv) or scalar(.vx).

The elements in vs2 are rotated left by the rotate amount
specified by either the cotrresponding elements of vs1 (vector-vector),
or integer register rs1 (vector-scalar). Only the low log2(SEW) bits
of the rotate-amount value are used, all other bits are ignored

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Vector rotate right by vector/scalar/immediate.

The elements in vs2 are rotated right by the rotate amount
specified by either the corresponding elements of vs1 (vector-vector),
integer register rs1 (vector-scalar), or an immediate value
(vector-immediate). Only the low log2(SEW) bits of the rotate-amount
value are used, all other bits are ignored.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Vector Reverse Bits in Bytes, a bit reversal is
performed on the bits of each byte.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Vector Reverse Bytes

A byte reversal is performed on each element of vs2, effectively
performing an endian swap.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Bitwise And-Not.

Each bit of Op1 is inverted and logically ANDed with the
corresponding bits in vs2. In the vector- scalar version,
"Op1" is the sign-extended or truncated value in scalar register
rs1. In the vector-vector version, Op1 is vs1.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Produces the low half of 128-bit carry-less product.

Each 64-bit element in the vs2 vector register is carry-less
multiplied by either each 64-bit element in vs1 (vector-vector), or
the 64-bit value from integer register rs1 (vector-scalar). The
result is the least significant 64 bits of the carry-less product.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
Vector Carry-less Multiply by vector or scalar - returning
high half of product.

Each 64-bit element in the vs2 vector register is carry-less
multiplied by either each 64-bit element in vs1 (vector-vector), or
the 64-bit value from integer register rs1 (vector-scalar). The
result is the most significant 64 bits of the carry-less product.

Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu>
@github-actions
Copy link

Unit Test Results

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

Results for commit 1b71422. ± Comparison against base commit 5872908.

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