qemu/target/riscv/insn_trans/trans_rvzimop.c.inc
LIU Zhiwei 6eab278d38 target/riscv: Add zimop extension
Zimop extension defines an encoding space for 40 MOPs.The Zimop
extension defines 32 MOP instructions named MOP.R.n, where n is
an integer between 0 and 31, inclusive. The Zimop extension
additionally defines 8 MOP instructions named MOP.RR.n, where n
is an integer between 0 and 7.

These 40 MOPs initially are defined to simply write zero to x[rd],
but are designed to be redefined by later extensions to perform some
other action.

Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Deepak Gupta <debug@rivosinc.com>
Message-ID: <20240709113652.1239-2-zhiwei_liu@linux.alibaba.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2024-07-18 12:00:42 +10:00

37 lines
1.2 KiB
C++

/*
* RISC-V translation routines for May-Be-Operation(zimop).
*
* Copyright (c) 2024 Alibaba Group.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2 or later, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define REQUIRE_ZIMOP(ctx) do { \
if (!ctx->cfg_ptr->ext_zimop) { \
return false; \
} \
} while (0)
static bool trans_mop_r_n(DisasContext *ctx, arg_mop_r_n *a)
{
REQUIRE_ZIMOP(ctx);
gen_set_gpr(ctx, a->rd, ctx->zero);
return true;
}
static bool trans_mop_rr_n(DisasContext *ctx, arg_mop_rr_n *a)
{
REQUIRE_ZIMOP(ctx);
gen_set_gpr(ctx, a->rd, ctx->zero);
return true;
}