aboutsummaryrefslogtreecommitdiff
path: root/disas/nanomips.cpp
diff options
context:
space:
mode:
authorAleksandar Markovic <amarkovic@wavecomp.com>2018-12-26 18:46:28 +0100
committerAleksandar Markovic <amarkovic@wavecomp.com>2019-01-03 17:52:52 +0100
commiteabf76a0d46b7c2330881c9a65ef03ea70f01920 (patch)
tree0e2a4dd59619aedce4724fe243138c10427601e2 /disas/nanomips.cpp
parentdffcf177dcfb789118f4eb519e088435d62ae42d (diff)
downloadqemu-eabf76a0d46b7c2330881c9a65ef03ea70f01920.zip
qemu-eabf76a0d46b7c2330881c9a65ef03ea70f01920.tar.gz
qemu-eabf76a0d46b7c2330881c9a65ef03ea70f01920.tar.bz2
disas: nanoMIPS: Reorder declarations and definitions of gpr decoders
Reorder declarations and definitions of gpr decoders by number of input bits of corresponding encoding type. Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Diffstat (limited to 'disas/nanomips.cpp')
-rw-r--r--disas/nanomips.cpp200
1 files changed, 100 insertions, 100 deletions
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 23556b4..d6632bb 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -292,6 +292,77 @@ uint64 NMD::renumber_registers(uint64 index, uint64 *register_list,
/*
+ * NMD::decode_gpr_gpr4() - decoder for 'gpr4' gpr encoding type
+ *
+ * Map a 4-bit code to the 5-bit register space according to this pattern:
+ *
+ * 1 0
+ * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * | | | | | | | | | | | | | | | |
+ * | | | | | | | | | | | | | | | |
+ * | | | | | | | | | | | └---------------┐
+ * | | | | | | | | | | └---------------┐ |
+ * | | | | | | | | | └---------------┐ | |
+ * | | | | | | | | └---------------┐ | | |
+ * | | | | | | | | | | | | | | | |
+ * | | | | | | | | | | | | | | | |
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * 3 2 1 0
+ *
+ * Used in handling following instructions:
+ *
+ * - ADDU[4X4]
+ * - LW[4X4]
+ * - MOVEP[REV]
+ * - MUL[4X4]
+ * - SW[4X4]
+ */
+uint64 NMD::decode_gpr_gpr4(uint64 d)
+{
+ static uint64 register_list[] = { 8, 9, 10, 11, 4, 5, 6, 7,
+ 16, 17, 18, 19, 20, 21, 22, 23 };
+ return renumber_registers(d, register_list,
+ sizeof(register_list) / sizeof(register_list[0]));
+}
+
+
+/*
+ * NMD::decode_gpr_gpr4_zero() - decoder for 'gpr4.zero' gpr encoding type
+ *
+ * Map a 4-bit code to the 5-bit register space according to this pattern:
+ *
+ * 1 0
+ * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * | | | | | | | | | | | | | | | |
+ * | | | | | | | | | | | | └---------------------┐
+ * | | | | | | | | | | | └---------------┐ |
+ * | | | | | | | | | | └---------------┐ | |
+ * | | | | | | | | | └---------------┐ | | |
+ * | | | | | | | | └---------------┐ | | | |
+ * | | | | | | | | | | | | | | | |
+ * | | | | | | | | | | | | | | | |
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * 3 2 1 0
+ *
+ * This pattern is the same one used for 'gpr4' gpr encoding type, except for
+ * the input value 3, that is mapped to the output value 0 instead of 11.
+ *
+ * Used in handling following instructions:
+ *
+ * - MOVE.BALC
+ * - MOVEP
+ * - SW[4X4]
+ */
+uint64 NMD::decode_gpr_gpr4_zero(uint64 d)
+{
+ static uint64 register_list[] = { 8, 9, 10, 0, 4, 5, 6, 7,
+ 16, 17, 18, 19, 20, 21, 22, 23 };
+ return renumber_registers(d, register_list,
+ sizeof(register_list) / sizeof(register_list[0]));
+}
+
+
+/*
* NMD::decode_gpr_gpr3() - decoder for 'gpr3' gpr encoding type
*
* Map a 3-bit code to the 5-bit register space according to this pattern:
@@ -390,106 +461,6 @@ uint64 NMD::decode_gpr_gpr3_src_store(uint64 d)
/*
- * NMD::decode_gpr_gpr1() - decoder for 'gpr1' gpr encoding type
- *
- * Map a 1-bit code to the 5-bit register space according to this pattern:
- *
- * 1 0
- * | |
- * | |
- * | └---------------------┐
- * └---------------------┐ |
- * | |
- * | |
- * | |
- * | |
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * 3 2 1 0
- *
- * Used in handling following instruction:
- *
- * - MOVE.BALC
- */
-uint64 NMD::decode_gpr_gpr1(uint64 d)
-{
- static uint64 register_list[] = { 4, 5 };
- return renumber_registers(d, register_list,
- sizeof(register_list) / sizeof(register_list[0]));
-}
-
-
-/*
- * NMD::decode_gpr_gpr4_zero() - decoder for 'gpr4.zero' gpr encoding type
- *
- * Map a 4-bit code to the 5-bit register space according to this pattern:
- *
- * 1 0
- * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * | | | | | | | | | | | | | | | |
- * | | | | | | | | | | | | └---------------------┐
- * | | | | | | | | | | | └---------------┐ |
- * | | | | | | | | | | └---------------┐ | |
- * | | | | | | | | | └---------------┐ | | |
- * | | | | | | | | └---------------┐ | | | |
- * | | | | | | | | | | | | | | | |
- * | | | | | | | | | | | | | | | |
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * 3 2 1 0
- *
- * This pattern is the same one used for 'gpr4' gpr encoding type, except for
- * the input value 3, that is mapped to the output value 0 instead of 11.
- *
- * Used in handling following instructions:
- *
- * - MOVE.BALC
- * - MOVEP
- * - SW[4X4]
- */
-uint64 NMD::decode_gpr_gpr4_zero(uint64 d)
-{
- static uint64 register_list[] = { 8, 9, 10, 0, 4, 5, 6, 7,
- 16, 17, 18, 19, 20, 21, 22, 23 };
- return renumber_registers(d, register_list,
- sizeof(register_list) / sizeof(register_list[0]));
-}
-
-
-/*
- * NMD::decode_gpr_gpr4() - decoder for 'gpr4' gpr encoding type
- *
- * Map a 4-bit code to the 5-bit register space according to this pattern:
- *
- * 1 0
- * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * | | | | | | | | | | | | | | | |
- * | | | | | | | | | | | | | | | |
- * | | | | | | | | | | | └---------------┐
- * | | | | | | | | | | └---------------┐ |
- * | | | | | | | | | └---------------┐ | |
- * | | | | | | | | └---------------┐ | | |
- * | | | | | | | | | | | | | | | |
- * | | | | | | | | | | | | | | | |
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * 3 2 1 0
- *
- * Used in handling following instructions:
- *
- * - ADDU[4X4]
- * - LW[4X4]
- * - MOVEP[REV]
- * - MUL[4X4]
- * - SW[4X4]
- */
-uint64 NMD::decode_gpr_gpr4(uint64 d)
-{
- static uint64 register_list[] = { 8, 9, 10, 11, 4, 5, 6, 7,
- 16, 17, 18, 19, 20, 21, 22, 23 };
- return renumber_registers(d, register_list,
- sizeof(register_list) / sizeof(register_list[0]));
-}
-
-
-/*
* NMD::decode_gpr_gpr2_reg1() - decoder for 'gpr2.reg1' gpr encoding type
*
* Map a 2-bit code to the 5-bit register space according to this pattern:
@@ -549,6 +520,35 @@ uint64 NMD::decode_gpr_gpr2_reg2(uint64 d)
}
+/*
+ * NMD::decode_gpr_gpr1() - decoder for 'gpr1' gpr encoding type
+ *
+ * Map a 1-bit code to the 5-bit register space according to this pattern:
+ *
+ * 1 0
+ * | |
+ * | |
+ * | └---------------------┐
+ * └---------------------┐ |
+ * | |
+ * | |
+ * | |
+ * | |
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * 3 2 1 0
+ *
+ * Used in handling following instruction:
+ *
+ * - MOVE.BALC
+ */
+uint64 NMD::decode_gpr_gpr1(uint64 d)
+{
+ static uint64 register_list[] = { 4, 5 };
+ return renumber_registers(d, register_list,
+ sizeof(register_list) / sizeof(register_list[0]));
+}
+
+
uint64 NMD::copy(uint64 d)
{
return d;