From: Yongbok Kim <yongbok.kim@imgtec.com>
To: qemu-devel@nongnu.org
Cc: leon.alrae@imgtec.com, aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH v2 01/20] target-mips: add MSA defines and data structure
Date: Wed, 29 Oct 2014 01:41:49 +0000 [thread overview]
Message-ID: <1414546928-54642-2-git-send-email-yongbok.kim@imgtec.com> (raw)
In-Reply-To: <1414546928-54642-1-git-send-email-yongbok.kim@imgtec.com>
add defines and data structure for MIPS SIMD Architecture
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
target-mips/cpu.h | 52 +++++++++++++++++++++++++++++++++++++++++++++-
target-mips/mips-defs.h | 1 +
target-mips/op_helper.c | 1 +
3 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 3b975eb..fb5abda 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -58,12 +58,32 @@ struct CPUMIPSTLBContext {
};
#endif
+/* MSA Context */
+#define MSA_WRLEN (128)
+
+enum CPUMIPSMSADataFormat {
+ DF_BYTE = 0,
+ DF_HALF,
+ DF_WORD,
+ DF_DOUBLE
+};
+
+typedef union wr_t wr_t;
+union wr_t {
+ int8_t b[MSA_WRLEN/8];
+ int16_t h[MSA_WRLEN/16];
+ int32_t w[MSA_WRLEN/32];
+ int64_t d[MSA_WRLEN/64];
+};
+
typedef union fpr_t fpr_t;
union fpr_t {
float64 fd; /* ieee double precision */
float32 fs[2];/* ieee single precision */
uint64_t d; /* binary double fixed-point */
uint32_t w[2]; /* binary single fixed-point */
+/* FPU/MSA register mapping is not tested on big-endian hosts. */
+ wr_t wr; /* vector data */
};
/* define FP_ENDIAN_IDX to access the same location
* in the fpr_t union regardless of the host endianness
@@ -177,6 +197,21 @@ struct TCState {
target_ulong CP0_TCScheFBack;
int32_t CP0_Debug_tcstatus;
target_ulong CP0_UserLocal;
+
+ int32_t msacsr;
+
+#define MSACSR_FS 24
+#define MSACSR_FS_MASK (1 << MSACSR_FS)
+#define MSACSR_NX 18
+#define MSACSR_NX_MASK (1 << MSACSR_NX)
+#define MSACSR_Flags 2
+#define MSACSR_CEF_MASK (0xffff << MSACSR_Flags)
+#define MSACSR_RM 0
+#define MSACSR_RM_MASK (0x3 << MSACSR_RM)
+#define MSACSR_MASK (MSACSR_RM_MASK | MSACSR_CEF_MASK | MSACSR_NX_MASK | \
+ MSACSR_FS_MASK)
+
+ float_status msa_fp_status;
};
typedef struct CPUMIPSState CPUMIPSState;
@@ -192,6 +227,10 @@ struct CPUMIPSState {
target_ulong SEGMask;
target_ulong PAMask;
+ int32_t msair;
+#define MSAIR_ProcID 8
+#define MSAIR_Rev 0
+
int32_t CP0_Index;
/* CP0_MVP* are per MVP registers. */
int32_t CP0_Random;
@@ -385,6 +424,7 @@ struct CPUMIPSState {
#define CP0C2_SA 0
int32_t CP0_Config3;
#define CP0C3_M 31
+#define CP0C3_MSAP 28
#define CP0C3_BP 27
#define CP0C3_BI 26
#define CP0C3_ISA_ON_EXC 16
@@ -462,7 +502,7 @@ struct CPUMIPSState {
#define EXCP_INST_NOTAVAIL 0x2 /* No valid instruction word for BadInstr */
uint32_t hflags; /* CPU State */
/* TMASK defines different execution modes */
-#define MIPS_HFLAG_TMASK 0x5807FF
+#define MIPS_HFLAG_TMASK 0x15807FF
#define MIPS_HFLAG_MODE 0x00007 /* execution modes */
/* The KSU flags must be the lowest bits in hflags. The flag order
must be the same as defined for CP0 Status. This allows to use
@@ -508,6 +548,7 @@ struct CPUMIPSState {
#define MIPS_HFLAG_HWRENA_ULR 0x200000 /* ULR bit from HWREna is set. */
#define MIPS_HFLAG_SBRI 0x400000 /* R6 SDBBP causes RI excpt. in user mode */
#define MIPS_HFLAG_FBNSLOT 0x800000 /* Forbidden slot */
+#define MIPS_HFLAG_MSA 0x1000000
target_ulong btarget; /* Jump / branch target */
target_ulong bcond; /* Branch condition (if needed) */
@@ -663,6 +704,8 @@ enum {
EXCP_C2E,
EXCP_CACHE, /* 32 */
EXCP_DSPDIS,
+ EXCP_MSADIS,
+ EXCP_MSAFPE,
EXCP_TLBXI,
EXCP_TLBRI,
@@ -764,7 +807,7 @@ static inline void compute_hflags(CPUMIPSState *env)
env->hflags &= ~(MIPS_HFLAG_COP1X | MIPS_HFLAG_64 | MIPS_HFLAG_CP0 |
MIPS_HFLAG_F64 | MIPS_HFLAG_FPU | MIPS_HFLAG_KSU |
MIPS_HFLAG_AWRAP | MIPS_HFLAG_DSP | MIPS_HFLAG_DSPR2 |
- MIPS_HFLAG_SBRI);
+ MIPS_HFLAG_SBRI | MIPS_HFLAG_MSA);
if (!(env->CP0_Status & (1 << CP0St_EXL)) &&
!(env->CP0_Status & (1 << CP0St_ERL)) &&
!(env->hflags & MIPS_HFLAG_DM)) {
@@ -837,6 +880,11 @@ static inline void compute_hflags(CPUMIPSState *env)
env->hflags |= MIPS_HFLAG_COP1X;
}
}
+ if (env->insn_flags & ASE_MSA) {
+ if (env->CP0_Config5 & (1 << CP0C5_MSAEn)) {
+ env->hflags |= MIPS_HFLAG_MSA;
+ }
+ }
}
#endif /* !defined (__MIPS_CPU_H__) */
diff --git a/target-mips/mips-defs.h b/target-mips/mips-defs.h
index 6cb62b2..1784227 100644
--- a/target-mips/mips-defs.h
+++ b/target-mips/mips-defs.h
@@ -45,6 +45,7 @@
#define ASE_MT 0x00200000
#define ASE_SMARTMIPS 0x00400000
#define ASE_MICROMIPS 0x00800000
+#define ASE_MSA 0x01000000
/* Chip specific instructions. */
#define INSN_LOONGSON2E 0x20000000
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index c6de86e..0c75ec8 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -1589,6 +1589,7 @@ void helper_mtc0_config5(CPUMIPSState *env, target_ulong arg1)
{
env->CP0_Config5 = (env->CP0_Config5 & (~env->CP0_Config5_rw_bitmask)) |
(arg1 & env->CP0_Config5_rw_bitmask);
+ compute_hflags(env);
}
void helper_mtc0_lladdr(CPUMIPSState *env, target_ulong arg1)
--
1.7.4
next prev parent reply other threads:[~2014-10-29 1:42 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 1:41 [Qemu-devel] [PATCH v2 00/20] target-mips: add MSA module Yongbok Kim
2014-10-29 1:41 ` Yongbok Kim [this message]
2014-10-29 9:50 ` [Qemu-devel] [PATCH v2 01/20] target-mips: add MSA defines and data structure James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 02/20] target-mips: add MSA exceptions Yongbok Kim
2014-10-29 9:56 ` James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 03/20] target-mips: remove duplicated mips/ieee mapping function Yongbok Kim
2014-10-29 10:04 ` James Hogan
2014-10-29 22:55 ` Leon Alrae
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 04/20] target-mips: add 16, 64 bit load and store Yongbok Kim
2014-10-29 10:21 ` James Hogan
2014-10-29 22:56 ` Leon Alrae
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 05/20] target-mips: stop translation after ctc1 Yongbok Kim
2014-10-29 10:26 ` James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 06/20] target-mips: add MSA opcode enum Yongbok Kim
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 07/20] target-mips: add msa_reset(), global msa register Yongbok Kim
2014-10-29 10:36 ` James Hogan
2014-11-05 17:36 ` Richard Henderson
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 08/20] target-mips: add msa_helper.c Yongbok Kim
2014-10-29 10:50 ` James Hogan
2014-10-29 22:57 ` Leon Alrae
2014-11-05 17:38 ` Richard Henderson
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 09/20] target-mips: add MSA branch instructions Yongbok Kim
2014-10-29 11:19 ` James Hogan
2014-11-05 17:41 ` Richard Henderson
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 10/20] target-mips: add MSA I8 format instructions Yongbok Kim
2014-10-29 11:38 ` James Hogan
2014-11-05 17:43 ` Richard Henderson
2014-11-06 11:49 ` Yongbok Kim
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 11/20] target-mips: add MSA I5 format instruction Yongbok Kim
2014-10-29 23:23 ` James Hogan
2014-10-29 23:27 ` Leon Alrae
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 12/20] target-mips: add MSA BIT format instructions Yongbok Kim
2014-10-30 8:02 ` Leon Alrae
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 13/20] target-mips: add MSA 3R " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 14/20] target-mips: add MSA ELM " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 15/20] target-mips: add MSA 3RF " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 16/20] target-mips: add MSA VEC/2R " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 17/20] target-mips: add MSA 2RF " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 18/20] target-mips: add MSA MI10 " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 19/20] disas/mips.c: disassemble MSA instructions Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 20/20] target-mips: add MSA support to mips32r5-generic Yongbok Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414546928-54642-2-git-send-email-yongbok.kim@imgtec.com \
--to=yongbok.kim@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).