[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 18/76] target/mips: Add nanoMIPS decoding and ext
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PATCH v5 18/76] target/mips: Add nanoMIPS decoding and extraction utilities |
Date: |
Mon, 30 Jul 2018 18:11:51 +0200 |
From: Aleksandar Markovic <address@hidden>
Add some basic utility functions and macros for nanoMIPS decoding
engine.
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 c59ef5c..aba42be 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -16475,6 +16475,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 v5 12/76] target/mips: Add nanoMIPS base instruction set opcodes, (continued)
- [Qemu-devel] [PATCH v5 12/76] target/mips: Add nanoMIPS base instruction set opcodes, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 13/76] target/mips: Add nanoMIPS DSP ASE opcodes, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 14/76] target/mips: Add gen_op_addr_addi(), Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 15/76] target/mips: Fix two instances of shadow variables, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 16/76] target/mips: Mark switch fallthroughs with interpretable comments, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 17/76] target/mips: Add placeholder and invocation of decode_nanomips_opc(), Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 18/76] target/mips: Add nanoMIPS decoding and extraction utilities,
Aleksandar Markovic <=
- [Qemu-devel] [PATCH v5 19/76] target/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 20/76] target/mips: Add emulation of nanoMIPS 16-bit branch instructions, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 21/76] target/mips: Add emulation of nanoMIPS 16-bit shift instructions, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 22/76] target/mips: Add emulation of nanoMIPS 16-bit misc instructions, Aleksandar Markovic, 2018/07/30
- [Qemu-devel] [PATCH v5 23/76] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions, Aleksandar Markovic, 2018/07/30