mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target/riscv: Add Zvksed ISA extension support
This commit adds support for the Zvksed vector-crypto extension, which consists of the following instructions: * vsm4k.vi * vsm4r.[vv,vs] Translation functions are defined in `target/riscv/insn_trans/trans_rvvk.c.inc` and helpers are defined in `target/riscv/vcrypto_helper.c`. Signed-off-by: Max Chou <max.chou@sifive.com> Reviewed-by: Frank Chang <frank.chang@sifive.com> [lawrence.hunter@codethink.co.uk: Moved SM4 functions from crypto_helper.c to vcrypto_helper.c] [nazar.kazakov@codethink.co.uk: Added alignment checks, refactored code to use macros, and minor style changes] Signed-off-by: Max Chou <max.chou@sifive.com> Message-ID: <20230711165917.2629866-16-max.chou@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
f5f3a9152a
commit
8b045ff454
6 changed files with 184 additions and 1 deletions
|
@ -561,3 +561,46 @@ static bool vghsh_check(DisasContext *s, arg_rmrr *a)
|
|||
}
|
||||
|
||||
GEN_VV_UNMASKED_TRANS(vghsh_vv, vghsh_check, ZVKG_EGS)
|
||||
|
||||
/*
|
||||
* Zvksed
|
||||
*/
|
||||
|
||||
#define ZVKSED_EGS 4
|
||||
|
||||
static bool zvksed_check(DisasContext *s)
|
||||
{
|
||||
int egw_bytes = ZVKSED_EGS << s->sew;
|
||||
return s->cfg_ptr->ext_zvksed == true &&
|
||||
require_rvv(s) &&
|
||||
vext_check_isa_ill(s) &&
|
||||
MAXSZ(s) >= egw_bytes &&
|
||||
s->sew == MO_32;
|
||||
}
|
||||
|
||||
static bool vsm4k_vi_check(DisasContext *s, arg_rmrr *a)
|
||||
{
|
||||
return zvksed_check(s) &&
|
||||
require_align(a->rd, s->lmul) &&
|
||||
require_align(a->rs2, s->lmul);
|
||||
}
|
||||
|
||||
GEN_VI_UNMASKED_TRANS(vsm4k_vi, vsm4k_vi_check, ZVKSED_EGS)
|
||||
|
||||
static bool vsm4r_vv_check(DisasContext *s, arg_rmr *a)
|
||||
{
|
||||
return zvksed_check(s) &&
|
||||
require_align(a->rd, s->lmul) &&
|
||||
require_align(a->rs2, s->lmul);
|
||||
}
|
||||
|
||||
GEN_V_UNMASKED_TRANS(vsm4r_vv, vsm4r_vv_check, ZVKSED_EGS)
|
||||
|
||||
static bool vsm4r_vs_check(DisasContext *s, arg_rmr *a)
|
||||
{
|
||||
return zvksed_check(s) &&
|
||||
!is_overlapped(a->rd, 1 << MAX(s->lmul, 0), a->rs2, 1) &&
|
||||
require_align(a->rd, s->lmul);
|
||||
}
|
||||
|
||||
GEN_V_UNMASKED_TRANS(vsm4r_vs, vsm4r_vs_check, ZVKSED_EGS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue