Skip to content

Zvkned: add infrastructure for Zvkned #752

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.old
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ SAIL_DEFAULT_INST += riscv_insts_zvbc.sail
SAIL_DEFAULT_INST += riscv_insts_zimop.sail
SAIL_DEFAULT_INST += riscv_insts_zcmop.sail

SAIL_DEFAULT_INST += riscv_insts_zvkned.sail

SAIL_SEQ_INST = $(SAIL_DEFAULT_INST) riscv_jalr_seq.sail
SAIL_RMEM_INST = $(SAIL_DEFAULT_INST) riscv_jalr_rmem.sail riscv_insts_rmem.sail

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ For booting operating system images, see the information under the
- Zvbb extension for vector basic bit-manipulation, v1.0
- Zvbc extension for vector carryless multiplication, v1.0
- Zvkb extension for vector cryptography bit-manipulation, v1.0
- Zvkned extension for vector cryptography NIST Suite: Vector AES Block Cipher, v1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you put Zvkned after Zvknha ? In the spec Zvknh[ab] comes after Zvkned

- Zvknha and Zvknhb extensions for vector cryptography NIST Suite: Vector SHA-2 Secure Hash, v1.0
- Machine, Supervisor, and User modes
- Smcntrpmf extension for cycle and instret privilege mode filtering, v1.0
Expand Down
3 changes: 3 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
"Zvbc": {
"supported": true
},
"Zvkned": {
"supported": true
},
"Zvknha": {
"supported": true
},
Expand Down
1 change: 1 addition & 0 deletions model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ foreach (xlen IN ITEMS 32 64)
"riscv_insts_zvbb.sail"
"riscv_insts_zvbc.sail"
"riscv_insts_zvknhab.sail"
"riscv_insts_zvkned.sail"
# Zimop and Zcmop should be at the end so they can be overridden by earlier extensions
"riscv_insts_zimop.sail"
"riscv_insts_zcmop.sail"
Expand Down
3 changes: 3 additions & 0 deletions model/riscv_extensions.sail
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ function clause hartSupports(Ext_Zvknha) = config extensions.Zvknha.supported

enum clause extension = Ext_Zvknhb
function clause hartSupports(Ext_Zvknhb) = config extensions.Zvknhb.supported
// NIST Suite: Vector AES Block Cipher
enum clause extension = Ext_Zvkned
function clause hartSupports(Ext_Zvkned) = config extensions.Zvkned.supported

// Count Overflow and Mode-Based Filtering
enum clause extension = Ext_Sscofpmf
Expand Down
11 changes: 11 additions & 0 deletions model/riscv_insts_vext_utils.sail
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ function write_velem_quad(vd, SEW, input, i) = {
write_single_element(SEW, 4 * i + j, vd, slice(input, j * SEW, SEW));
}

/* Extracts 4 consecutive vector elements starting from index 4*i and returns a vector */
val get_velem_quad_vec : forall 'n 'm 'p, 'n > 0 & 8 <= 'm <= 64 & 'p >= 0 & 4 * 'p + 3 < 'n. (vector('n, bits('m)), int('p)) -> vector(4, bits('m))
function get_velem_quad_vec(v, i) = [ v[4 * i + 3], v[4 * i + 2], v[4 * i + 1], v[4 * i] ]

/* Writes each of the 4 elements from the input vector to the vector register vd, starting at position 4 * i */
val write_velem_quad_vec : forall 'p 'n, 8 <= 'n <= 64 & 'p >= 0. (vregidx, int('n), vector(4, bits('n)), int('p)) -> unit
function write_velem_quad_vec(vd, SEW, input, i) = {
foreach(j from 0 to 3)
write_single_element(SEW, 4 * i + j, vd, input[j]);
}

/* Get the starting element index from csr vtype */
val get_start_element : unit -> result(nat, unit)
function get_start_element() = {
Expand Down
Loading
Loading