Skip to content

Commit 0f0286b

Browse files
Refactor Zvkned extension
Co-authored-by: KotorinMinami <[email protected]>
1 parent 920a502 commit 0f0286b

File tree

5 files changed

+201
-224
lines changed

5 files changed

+201
-224
lines changed

Makefile.old

-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ SAIL_DEFAULT_INST += riscv_insts_zcmop.sail
7474

7575
SAIL_DEFAULT_INST += riscv_insts_zvkned.sail
7676

77-
SAIL_DEFAULT_INST += riscv_insts_zvkned.sail
78-
7977
SAIL_SEQ_INST = $(SAIL_DEFAULT_INST) riscv_jalr_seq.sail
8078
SAIL_RMEM_INST = $(SAIL_DEFAULT_INST) riscv_jalr_rmem.sail riscv_insts_rmem.sail
8179

model/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ foreach (xlen IN ITEMS 32 64)
8484
"riscv_insts_zbkx.sail"
8585
"riscv_insts_zicond.sail"
8686
${vext_srcs}
87-
"riscv_insts_zvkned.sail"
8887
"riscv_insts_zicbom.sail"
8988
"riscv_insts_zicboz.sail"
9089
"riscv_insts_zvbb.sail"
@@ -182,7 +181,6 @@ foreach (xlen IN ITEMS 32 64)
182181
"riscv_mem.sail"
183182
${sail_vm_srcs}
184183
# Shared/common code for the cryptography extension.
185-
"riscv_zvk_utils.sail"
186184
"riscv_types_kext.sail"
187185
"riscv_zvk_utils.sail"
188186
"riscv_inst_retire.sail"

model/riscv_insts_vext_utils.sail

+11
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,17 @@ function write_velem_quad(vd, SEW, input, i) = {
191191
write_single_element(SEW, 4 * i + j, vd, slice(input, j * SEW, SEW));
192192
}
193193

194+
/* Extracts 4 consecutive vector elements starting from index 4*i and returns a vector */
195+
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))
196+
function get_velem_quad_vec(v, i) = [ v[4 * i + 3], v[4 * i + 2], v[4 * i + 1], v[4 * i] ]
197+
198+
/* Writes each of the 4 elements from the input vector to the vector register vd, starting at position 4 * i */
199+
val write_velem_quad_vec : forall 'p 'n, 8 <= 'n <= 64 & 'p >= 0. (vregidx, int('n), vector(4, bits('n)), int('p)) -> unit
200+
function write_velem_quad_vec(vd, SEW, input, i) = {
201+
foreach(j from 0 to 3)
202+
write_single_element(SEW, 4 * i + j, vd, input[j]);
203+
}
204+
194205
/* Get the starting element index from csr vtype */
195206
val get_start_element : unit -> result(nat, unit)
196207
function get_start_element() = {

0 commit comments

Comments
 (0)