[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 18/80] target/mips: Add nanoMIPS decoding and ext
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PATCH v7 18/80] target/mips: Add nanoMIPS decoding and extraction utilities |
Date: |
Mon, 6 Aug 2018 18:59:45 +0200 |
From: Aleksandar Markovic <address@hidden>
Add some basic utility functions and macros for nanoMIPS decoding
engine.
Reviewed-by: Richard Henderson <address@hidden>
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 | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 653ae4a..756eb40 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -16548,6 +16548,51 @@ enum {
*
*/
+/* Implement nanoMIPS pseudocode decode_gpr(encoded_gpr, 'gpr3'). */
+static inline int decode_gpr_gpr3(int r)
+{
+ static const int map[] = { 16, 17, 18, 19, 4, 5, 6, 7 };
+
+ return map[r & 0x7];
+}
+
+/* Implement nanoMIPS pseudocode decode_gpr(encoded_gpr, 'gpr3.src.store'). */
+static inline int decode_gpr_gpr3_src_store(int r)
+{
+ static const int map[] = { 0, 17, 18, 19, 4, 5, 6, 7 };
+
+ return map[r & 0x7];
+}
+
+/* Implement nanoMIPS pseudocode decode_gpr(encoded_gpr, 'gpr4'). */
+static inline int decode_gpr_gpr4(int r)
+{
+ static const int map[] = { 8, 9, 10, 11, 4, 5, 6, 7,
+ 16, 17, 18, 19, 20, 21, 22, 23 };
+
+ return map[r & 0xf];
+}
+
+/* Implement nanoMIPS pseudocode decode_gpr(encoded_gpr, 'gpr4.zero'). */
+static inline int decode_gpr_gpr4_zero(int r)
+{
+ static const int map[] = { 8, 9, 10, 0, 4, 5, 6, 7,
+ 16, 17, 18, 19, 20, 21, 22, 23 };
+
+ return map[r & 0xf];
+}
+
+
+/* extraction utilities */
+
+#define NANOMIPS_EXTRACT_RD(op) ((op >> 7) & 0x7)
+#define NANOMIPS_EXTRACT_RS(op) ((op >> 4) & 0x7)
+#define NANOMIPS_EXTRACT_RS2(op) uMIPS_RS(op)
+#define NANOMIPS_EXTRACT_RS1(op) ((op >> 1) & 0x7)
+#define NANOMIPS_EXTRACT_RD5(op) ((op >> 5) & 0x1f)
+#define NANOMIPS_EXTRACT_RS5(op) (op & 0x1f)
+
+
static int decode_nanomips_opc(CPUMIPSState *env, DisasContext *ctx)
{
return 2;
--
2.7.4
- [Qemu-devel] [PATCH v7 10/80] elf: Remove duplicate preprocessor constant definition, (continued)
- [Qemu-devel] [PATCH v7 10/80] elf: Remove duplicate preprocessor constant definition, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 11/80] elf: Add ELF flags for MIPS machine variants, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 12/80] linux-user: Update MIPS syscall numbers up to kernel 4.18 headers, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 13/80] linux-user: Add preprocessor availability control to some syscalls, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 14/80] target/mips: Add preprocessor constants for nanoMIPS, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 15/80] target/mips: Add nanoMIPS base instruction set opcodes, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 16/80] target/mips: Add nanoMIPS DSP ASE opcodes, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 17/80] target/mips: Add placeholder and invocation of decode_nanomips_opc(), Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 18/80] target/mips: Add nanoMIPS decoding and extraction utilities,
Aleksandar Markovic <=
- [Qemu-devel] [PATCH v7 19/80] target/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 20/80] target/mips: Add emulation of nanoMIPS 16-bit branch instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 21/80] target/mips: Add emulation of nanoMIPS 16-bit shift instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 22/80] target/mips: Add emulation of nanoMIPS 16-bit misc instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 23/80] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 24/80] target/mips: Add emulation of nanoMIPS 16-bit logic instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 25/80] target/mips: Add emulation of nanoMIPS 16-bit save and restore instructions, Aleksandar Markovic, 2018/08/06
- [Qemu-devel] [PATCH v7 26/80] target/mips: Add emulation of some common nanoMIPS 32-bit instructions, Aleksandar Markovic, 2018/08/06