[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 07/55] target/mips: Add emulation of nanoMIPS 16-
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PATCH v4 07/55] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions |
Date: |
Tue, 24 Jul 2018 19:31:19 +0200 |
From: Yongbok Kim <address@hidden>
Add emulation of LWXS16, LB16, SB16, LBU16, LH16, SH16, LHU16, LW16, LWSP16,
LW4X4, SW4X4, LWGP16, SWSP16, SW16, and SWGP16 instructions.
Signed-off-by: Yongbok Kim <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Markovic <address@hidden>
---
target/mips/translate.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 076637c..191bb15 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -16583,6 +16583,13 @@ static int decode_nanomips_opc(CPUMIPSState *env,
DisasContext *ctx)
}
break;
case NM_P16C:
+ switch (ctx->opcode & 1) {
+ case NM_POOL16C_0:
+ break;
+ case NM_LWXS16:
+ gen_ldxs(ctx, rt, rs, rd);
+ break;
+ }
break;
case NM_P16_A1:
switch (extract32(ctx->opcode, 6, 1)) {
@@ -16666,24 +16673,123 @@ static int decode_nanomips_opc(CPUMIPSState *env,
DisasContext *ctx)
}
break;
case NM_P16_LB:
+ {
+ uint32_t u = extract32(ctx->opcode, 0, 2);
+ switch (((ctx->opcode) >> 2) & 0x03) {
+ case NM_LB16:
+ gen_ld(ctx, OPC_LB, rt, rs, u);
+ break;
+ case NM_SB16:
+ {
+ int rt = decode_gpr_gpr3_src_store(
+ NANOMIPS_EXTRACT_RD(ctx->opcode));
+ gen_st(ctx, OPC_SB, rt, rs, u);
+ }
+ break;
+ case NM_LBU16:
+ gen_ld(ctx, OPC_LBU, rt, rs, u);
+ break;
+ default:
+ generate_exception_end(ctx, EXCP_RI);
+ break;
+ }
+ }
break;
case NM_P16_LH:
+ {
+ uint32_t u = extract32(ctx->opcode, 1, 2) << 1;
+ switch ((((ctx->opcode >> 3) & 1) << 1) | (ctx->opcode & 1)) {
+ case NM_LH16:
+ gen_ld(ctx, OPC_LH, rt, rs, u);
+ break;
+ case NM_SH16:
+ {
+ int rt = decode_gpr_gpr3_src_store(
+ NANOMIPS_EXTRACT_RD(ctx->opcode));
+ gen_st(ctx, OPC_SH, rt, rs, u);
+ }
+ break;
+ case NM_LHU16:
+ gen_ld(ctx, OPC_LHU, rt, rs, u);
+ break;
+ default:
+ generate_exception_end(ctx, EXCP_RI);
+ break;
+ }
+ }
break;
case NM_LW16:
+ {
+ int u = extract32(ctx->opcode, 0, 4) << 2;
+ gen_ld(ctx, OPC_LW, rt, rs, u);
+ }
break;
case NM_LWSP16:
+ {
+ int rt = NANOMIPS_EXTRACT_RD5(ctx->opcode);
+ int u = extract32(ctx->opcode, 0, 5) << 2;
+
+ gen_ld(ctx, OPC_LW, rt, 29, u);
+ }
break;
case NM_LW4X4:
+ {
+ int rt = (extract32(ctx->opcode, 9, 1) << 3) |
+ extract32(ctx->opcode, 5, 3);
+ int rs = (extract32(ctx->opcode, 4, 1) << 3) |
+ extract32(ctx->opcode, 0, 3);
+ int u = (extract32(ctx->opcode, 3, 1) << 3) |
+ (extract32(ctx->opcode, 8, 1) << 2);
+ rt = decode_gpr_gpr4(rt);
+ rs = decode_gpr_gpr4(rs);
+ gen_ld(ctx, OPC_LW, rt, rs, u);
+ }
break;
case NM_SW4X4:
+ {
+ int rt = (extract32(ctx->opcode, 9, 1) << 3) |
+ extract32(ctx->opcode, 5, 3);
+ int rs = (extract32(ctx->opcode, 4, 1) << 3) |
+ extract32(ctx->opcode, 0, 3);
+ int u = (extract32(ctx->opcode, 3, 1) << 3) |
+ (extract32(ctx->opcode, 8, 1) << 2);
+ rt = decode_gpr_gpr4_zero(rt);
+ rs = decode_gpr_gpr4(rs);
+ gen_st(ctx, OPC_SW, rt, rs, u);
+ }
break;
case NM_LWGP16:
+ {
+ int u = extract32(ctx->opcode, 0, 7) << 2;
+ gen_ld(ctx, OPC_LW, rt, 28, u);
+ }
break;
case NM_SWSP16:
+ {
+ int rt = NANOMIPS_EXTRACT_RD5(ctx->opcode);
+ int u = extract32(ctx->opcode, 0, 5) << 2;
+
+ gen_st(ctx, OPC_SW, rt, 29, u);
+ }
break;
case NM_SW16:
+ {
+ int rt = decode_gpr_gpr3_src_store(
+ NANOMIPS_EXTRACT_RD(ctx->opcode));
+ int rs = decode_gpr_gpr3(NANOMIPS_EXTRACT_RS(ctx->opcode));
+ int u = extract32(ctx->opcode, 0, 4) << 2;
+
+ gen_st(ctx, OPC_SW, rt, rs, u);
+ }
break;
case NM_SWGP16:
+ {
+ int rt = decode_gpr_gpr3_src_store(
+ NANOMIPS_EXTRACT_RD(ctx->opcode));
+ int u = extract32(ctx->opcode, 0, 7) << 2;
+
+ gen_st(ctx, OPC_SW, rt, 28, u);
+ }
break;
case NM_BC16:
gen_compute_branch(ctx, OPC_BEQ, 2, 0, 0,
--
2.7.4
- [Qemu-devel] [PATCH v4 00/55] Add nanoMIPS support to QEMU, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 01/55] target/mips: Add preprocessor constants for nanoMIPS, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 02/55] target/mips: Add nanoMIPS base instruction set opcodes, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 03/55] target/mips: Add nanoMIPS DSP ASE opcodes, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 04/55] target/mips: Add placeholder and invocation of decode_nanomips_opc(), Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 05/55] target/mips: Add nanoMIPS decoding and extraction utilities, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 06/55] target/mips: Add emulation of misc nanoMIPS 16-bit instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 07/55] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions,
Aleksandar Markovic <=
- [Qemu-devel] [PATCH v4 08/55] target/mips: Add emulation of nanoMIPS 16-bit logic instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 09/55] target/mips: Add emulation of nanoMIPS 16-bit save and restore instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 10/55] target/mips: Add emulation of some common nanoMIPS 32-bit instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 11/55] target/mips: Add emulation of nanoMIPS 48-bit instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 12/55] target/mips: Add emulation of nanoMIPS FP instructions, Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 13/55] target/mips: Add emulation of misc nanoMIPS instructions (pool32a0), Aleksandar Markovic, 2018/07/24
- [Qemu-devel] [PATCH v4 14/55] target/mips: Add emulation of misc nanoMIPS instructions (pool32axf), Aleksandar Markovic, 2018/07/24