All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions
@ 2015-05-13  9:45 Bastian Koppelmann
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3 Bastian Koppelmann
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Hi,

the new Aurix platform introduces a new ISA version, so this patchset
adds a new feature bit and changes the generic Aurix cpu to a more specific
tc27x cpu model. While at this, it introduces a new cpu model tc1797 which
uses the v1.3.1 ISA and fixes the tc1796 to us the v1.3 ISA.

It also adds the with v1.6.1 introduces instructions cmpswap, swapmsk and
crc32. While at this, it adds the missing instructions of the v1.6 ISA.

Cheers,
Bastian

Bastian Koppelmann (10):
  target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3
  target-tricore: introduce ISA v1.6.1 feature
  target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA
  target-tricore: add CMPSWP instructions of the v1.6.1 ISA
  target-tricore: add SWAPMSK instructions of the v1.6.1 ISA
  target-tricore: add RR_CRC32 instruction of the v1.6.1 ISA
  target-tricore: add SYS_RESTORE instruction of the v1.6 ISA
  target-tricore: add FCALL instructions of the v1.6 ISA
  target-tricore: add FRET instructions of the v1.6 ISA
  target-tricore: add RR_DIV and RR_DIV_U instructions of the v1.6 ISA

 target-tricore/cpu.c             |  18 ++++-
 target-tricore/cpu.h             |   1 +
 target-tricore/helper.h          |   4 +
 target-tricore/op_helper.c       |  60 +++++++++++++++
 target-tricore/translate.c       | 156 ++++++++++++++++++++++++++++++++++++++-
 target-tricore/tricore-opcodes.h |  19 +++++
 6 files changed, 253 insertions(+), 5 deletions(-)

-- 
2.4.0

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:19   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature Bastian Koppelmann
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/cpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c
index 2ba0cf4..9fe0b97 100644
--- a/target-tricore/cpu.c
+++ b/target-tricore/cpu.c
@@ -118,6 +118,13 @@ static void tc1796_initfn(Object *obj)
 {
     TriCoreCPU *cpu = TRICORE_CPU(obj);
 
+    set_feature(&cpu->env, TRICORE_FEATURE_13);
+}
+
+static void tc1797_initfn(Object *obj)
+{
+    TriCoreCPU *cpu = TRICORE_CPU(obj);
+
     set_feature(&cpu->env, TRICORE_FEATURE_131);
 }
 
@@ -136,6 +143,7 @@ typedef struct TriCoreCPUInfo {
 
 static const TriCoreCPUInfo tricore_cpus[] = {
     { .name = "tc1796",      .initfn = tc1796_initfn },
+    { .name = "tc1797",      .initfn = tc1797_initfn },
     { .name = "aurix",       .initfn = aurix_initfn },
     { .name = NULL }
 };
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3 Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:19   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA Bastian Koppelmann
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

The aurix platform contains of several different cpu models and uses
the 1.6.1 ISA. This patch changes the generic aurix model to the more
specific tc27x cpu model and sets specific features.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/cpu.c | 10 +++++++---
 target-tricore/cpu.h |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c
index 9fe0b97..b3e5512 100644
--- a/target-tricore/cpu.c
+++ b/target-tricore/cpu.c
@@ -68,6 +68,10 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
     CPUTriCoreState *env = &cpu->env;
 
     /* Some features automatically imply others */
+    if (tricore_feature(env, TRICORE_FEATURE_161)) {
+        set_feature(env, TRICORE_FEATURE_16);
+    }
+
     if (tricore_feature(env, TRICORE_FEATURE_16)) {
         set_feature(env, TRICORE_FEATURE_131);
     }
@@ -128,11 +132,11 @@ static void tc1797_initfn(Object *obj)
     set_feature(&cpu->env, TRICORE_FEATURE_131);
 }
 
-static void aurix_initfn(Object *obj)
+static void tc27x_initfn(Object *obj)
 {
     TriCoreCPU *cpu = TRICORE_CPU(obj);
 
-    set_feature(&cpu->env, TRICORE_FEATURE_16);
+    set_feature(&cpu->env, TRICORE_FEATURE_161);
 }
 
 typedef struct TriCoreCPUInfo {
@@ -144,7 +148,7 @@ typedef struct TriCoreCPUInfo {
 static const TriCoreCPUInfo tricore_cpus[] = {
     { .name = "tc1796",      .initfn = tc1796_initfn },
     { .name = "tc1797",      .initfn = tc1797_initfn },
-    { .name = "aurix",       .initfn = aurix_initfn },
+    { .name = "tc27x",       .initfn = tc27x_initfn },
     { .name = NULL }
 };
 
diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h
index c14b5f9..504f156 100644
--- a/target-tricore/cpu.h
+++ b/target-tricore/cpu.h
@@ -254,6 +254,7 @@ enum tricore_features {
     TRICORE_FEATURE_13,
     TRICORE_FEATURE_131,
     TRICORE_FEATURE_16,
+    TRICORE_FEATURE_161,
 };
 
 static inline int tricore_feature(CPUTriCoreState *env, int feature)
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3 Bastian Koppelmann
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:20   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA Bastian Koppelmann
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 663b2a0..1c37e48 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -3485,7 +3485,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
  * Functions for decoding instructions
  */
 
-static void decode_src_opc(DisasContext *ctx, int op1)
+static void decode_src_opc(CPUTriCoreState *env, DisasContext *ctx, int op1)
 {
     int r1;
     int32_t const4;
@@ -3546,6 +3546,12 @@ static void decode_src_opc(DisasContext *ctx, int op1)
         const4 = MASK_OP_SRC_CONST4(ctx->opcode);
         tcg_gen_movi_tl(cpu_gpr_a[r1], const4);
         break;
+    case OPC1_16_SRC_MOV_E:
+        if (tricore_feature(env, TRICORE_FEATURE_16)) {
+            tcg_gen_movi_tl(cpu_gpr_d[r1], const4);
+            tcg_gen_sari_tl(cpu_gpr_d[r1+1], cpu_gpr_d[r1], 31);
+        } /* TODO: else raise illegal opcode trap */
+        break;
     case OPC1_16_SRC_SH:
         gen_shi(cpu_gpr_d[r1], cpu_gpr_d[r1], const4);
         break;
@@ -3883,9 +3889,10 @@ static void decode_16Bit_opc(CPUTriCoreState *env, DisasContext *ctx)
     case OPC1_16_SRC_LT:
     case OPC1_16_SRC_MOV:
     case OPC1_16_SRC_MOV_A:
+    case OPC1_16_SRC_MOV_E:
     case OPC1_16_SRC_SH:
     case OPC1_16_SRC_SHA:
-        decode_src_opc(ctx, op1);
+        decode_src_opc(env, ctx, op1);
         break;
 /* SRR-format */
     case OPC1_16_SRR_ADD:
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (2 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:22   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK " Bastian Koppelmann
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Those instruction were introduced in the new Aurix platform.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c       | 35 +++++++++++++++++++++++++++++++++++
 target-tricore/tricore-opcodes.h |  5 +++++
 2 files changed, 40 insertions(+)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 1c37e48..06d183b 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -319,6 +319,20 @@ static void gen_swap(DisasContext *ctx, int reg, TCGv ea)
     tcg_temp_free(temp);
 }
 
+static void gen_cmpswap(DisasContext *ctx, int reg, TCGv ea)
+{
+    TCGv temp = tcg_temp_new();
+    TCGv temp2 = tcg_temp_new();
+    tcg_gen_qemu_ld_tl(temp, ea, ctx->mem_idx, MO_LEUL);
+    tcg_gen_movcond_tl(TCG_COND_EQ, temp2, cpu_gpr_d[reg+1], temp,
+                       cpu_gpr_d[reg], temp);
+    tcg_gen_qemu_st_tl(temp2, ea, ctx->mem_idx, MO_LEUL);
+    tcg_gen_mov_tl(cpu_gpr_d[reg], temp);
+
+    tcg_temp_free(temp);
+    tcg_temp_free(temp2);
+}
+
 /* We generate loads and store to core special function register (csfr) through
    the function gen_mfcr and gen_mtcr. To handle access permissions, we use 3
    makros R, A and E, which allow read-only, all and endinit protected access.
@@ -5046,6 +5060,18 @@ static void decode_bo_addrmode_stctx_post_pre_base(CPUTriCoreState *env,
         tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
         gen_swap(ctx, r1, cpu_gpr_a[r2]);
         break;
+    case OPC2_32_BO_CMPSWAP_W_SHORTOFF:
+        tcg_gen_addi_tl(temp, cpu_gpr_a[r2], off10);
+        gen_cmpswap(ctx, r1, temp);
+        break;
+    case OPC2_32_BO_CMPSWAP_W_POSTINC:
+        gen_cmpswap(ctx, r1, cpu_gpr_a[r2]);
+        tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
+        break;
+    case OPC2_32_BO_CMPSWAP_W_PREINC:
+        tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
+        gen_cmpswap(ctx, r1, cpu_gpr_a[r2]);
+        break;
     }
     tcg_temp_free(temp);
     tcg_temp_free(temp2);
@@ -5089,7 +5115,16 @@ static void decode_bo_addrmode_ldmst_bitreverse_circular(CPUTriCoreState *env,
         gen_swap(ctx, r1, temp2);
         gen_helper_circ_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1], temp3);
         break;
+    case OPC2_32_BO_CMPSWAP_W_BR:
+        gen_cmpswap(ctx, r1, temp2);
+        gen_helper_br_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1]);
+        break;
+    case OPC2_32_BO_CMPSWAP_W_CIRC:
+        gen_cmpswap(ctx, r1, temp2);
+        gen_helper_circ_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1], temp3);
+        break;
     }
+
     tcg_temp_free(temp);
     tcg_temp_free(temp2);
     tcg_temp_free(temp3);
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index 2291f75..95837aa 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -763,6 +763,9 @@ enum {
     OPC2_32_BO_SWAP_W_SHORTOFF                   = 0x20,
     OPC2_32_BO_SWAP_W_POSTINC                    = 0x00,
     OPC2_32_BO_SWAP_W_PREINC                     = 0x10,
+    OPC2_32_BO_CMPSWAP_W_SHORTOFF                = 0x23,
+    OPC2_32_BO_CMPSWAP_W_POSTINC                 = 0x03,
+    OPC2_32_BO_CMPSWAP_W_PREINC                  = 0x13,
 };
 /*OPCM_32_BO_ADDRMODE_LDMST_BITREVERSE_CIRCULAR  */
 enum {
@@ -770,6 +773,8 @@ enum {
     OPC2_32_BO_LDMST_CIRC                        = 0x11,
     OPC2_32_BO_SWAP_W_BR                         = 0x00,
     OPC2_32_BO_SWAP_W_CIRC                       = 0x10,
+    OPC2_32_BO_CMPSWAP_W_BR                      = 0x03,
+    OPC2_32_BO_CMPSWAP_W_CIRC                    = 0x13,
 };
 /*
  * BRC Format
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK instructions of the v1.6.1 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (3 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:22   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction " Bastian Koppelmann
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Those instruction were introduced in the new Aurix platform.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c       | 39 +++++++++++++++++++++++++++++++++++++++
 target-tricore/tricore-opcodes.h |  5 +++++
 2 files changed, 44 insertions(+)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 06d183b..b2e25e7 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -333,6 +333,25 @@ static void gen_cmpswap(DisasContext *ctx, int reg, TCGv ea)
     tcg_temp_free(temp2);
 }
 
+static void gen_swapmsk(DisasContext *ctx, int reg, TCGv ea)
+{
+    TCGv temp = tcg_temp_new();
+    TCGv temp2 = tcg_temp_new();
+    TCGv temp3 = tcg_temp_new();
+
+    tcg_gen_qemu_ld_tl(temp, ea, ctx->mem_idx, MO_LEUL);
+    tcg_gen_and_tl(temp2, cpu_gpr_d[reg], cpu_gpr_d[reg+1]);
+    tcg_gen_andc_tl(temp3, temp, cpu_gpr_d[reg+1]);
+    tcg_gen_or_tl(temp2, temp2, temp3);
+    tcg_gen_qemu_st_tl(temp2, ea, ctx->mem_idx, MO_LEUL);
+    tcg_gen_mov_tl(cpu_gpr_d[reg], temp);
+
+    tcg_temp_free(temp);
+    tcg_temp_free(temp2);
+    tcg_temp_free(temp3);
+}
+
+
 /* We generate loads and store to core special function register (csfr) through
    the function gen_mfcr and gen_mtcr. To handle access permissions, we use 3
    makros R, A and E, which allow read-only, all and endinit protected access.
@@ -5072,6 +5091,18 @@ static void decode_bo_addrmode_stctx_post_pre_base(CPUTriCoreState *env,
         tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
         gen_cmpswap(ctx, r1, cpu_gpr_a[r2]);
         break;
+    case OPC2_32_BO_SWAPMSK_W_SHORTOFF:
+        tcg_gen_addi_tl(temp, cpu_gpr_a[r2], off10);
+        gen_swapmsk(ctx, r1, temp);
+        break;
+    case OPC2_32_BO_SWAPMSK_W_POSTINC:
+        gen_swapmsk(ctx, r1, cpu_gpr_a[r2]);
+        tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
+        break;
+    case OPC2_32_BO_SWAPMSK_W_PREINC:
+        tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r2], off10);
+        gen_swapmsk(ctx, r1, cpu_gpr_a[r2]);
+        break;
     }
     tcg_temp_free(temp);
     tcg_temp_free(temp2);
@@ -5123,6 +5154,14 @@ static void decode_bo_addrmode_ldmst_bitreverse_circular(CPUTriCoreState *env,
         gen_cmpswap(ctx, r1, temp2);
         gen_helper_circ_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1], temp3);
         break;
+    case OPC2_32_BO_SWAPMSK_W_BR:
+        gen_swapmsk(ctx, r1, temp2);
+        gen_helper_br_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1]);
+        break;
+    case OPC2_32_BO_SWAPMSK_W_CIRC:
+        gen_swapmsk(ctx, r1, temp2);
+        gen_helper_circ_update(cpu_gpr_a[r2+1], cpu_gpr_a[r2+1], temp3);
+        break;
     }
 
     tcg_temp_free(temp);
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index 95837aa..7ad6df9 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -766,6 +766,9 @@ enum {
     OPC2_32_BO_CMPSWAP_W_SHORTOFF                = 0x23,
     OPC2_32_BO_CMPSWAP_W_POSTINC                 = 0x03,
     OPC2_32_BO_CMPSWAP_W_PREINC                  = 0x13,
+    OPC2_32_BO_SWAPMSK_W_SHORTOFF                = 0x22,
+    OPC2_32_BO_SWAPMSK_W_POSTINC                 = 0x02,
+    OPC2_32_BO_SWAPMSK_W_PREINC                  = 0x12,
 };
 /*OPCM_32_BO_ADDRMODE_LDMST_BITREVERSE_CIRCULAR  */
 enum {
@@ -775,6 +778,8 @@ enum {
     OPC2_32_BO_SWAP_W_CIRC                       = 0x10,
     OPC2_32_BO_CMPSWAP_W_BR                      = 0x03,
     OPC2_32_BO_CMPSWAP_W_CIRC                    = 0x13,
+    OPC2_32_BO_SWAPMSK_W_BR                      = 0x02,
+    OPC2_32_BO_SWAPMSK_W_CIRC                    = 0x12,
 };
 /*
  * BRC Format
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction of the v1.6.1 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (4 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK " Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:25   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA Bastian Koppelmann
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

This instruction was introduced by the new Aurix platform.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/helper.h          |  2 ++
 target-tricore/op_helper.c       | 11 +++++++++++
 target-tricore/translate.c       |  5 +++++
 target-tricore/tricore-opcodes.h |  1 +
 4 files changed, 19 insertions(+)

diff --git a/target-tricore/helper.h b/target-tricore/helper.h
index 1a49b00..842506c 100644
--- a/target-tricore/helper.h
+++ b/target-tricore/helper.h
@@ -117,6 +117,8 @@ DEF_HELPER_FLAGS_2(dvstep_u, TCG_CALL_NO_RWG_SE, i64, i64, i32)
 DEF_HELPER_FLAGS_5(mul_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
 DEF_HELPER_FLAGS_5(mulm_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
 DEF_HELPER_FLAGS_5(mulr_h, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32, i32, i32)
+/* crc32 */
+DEF_HELPER_FLAGS_2(crc32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
 /* CSA */
 DEF_HELPER_2(call, void, env, i32)
 DEF_HELPER_1(ret, void, env)
diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c
index 9919b5b..7aa1f8e 100644
--- a/target-tricore/op_helper.c
+++ b/target-tricore/op_helper.c
@@ -19,6 +19,7 @@
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
+#include <zlib.h> /* for crc32 */
 
 /* Addressing mode helper */
 
@@ -2165,6 +2166,16 @@ uint32_t helper_mulr_h(uint32_t arg00, uint32_t arg01,
     return (result1 & 0xffff0000) | (result0 >> 16);
 }
 
+uint32_t helper_crc32(uint32_t arg0, uint32_t arg1)
+{
+    uint8_t buf[4];
+    uint32_t ret;
+    stl_be_p(buf, arg0);
+
+    ret = crc32(arg1, buf, 4);
+    return ret;
+}
+
 /* context save area (CSA) related helpers */
 
 static int cdc_increment(target_ulong *psw)
diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index b2e25e7..52f474b 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -6449,6 +6449,11 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)
     case OPC2_32_RR_UNPACK:
         gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]);
         break;
+    case OPC2_32_RR_CRC32:
+        if (tricore_feature(env, TRICORE_FEATURE_161)) {
+            gen_helper_crc32(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        } /* TODO: else raise illegal opcode trap */
+        break;
     }
 }
 
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index 7ad6df9..440c7fe 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -1120,6 +1120,7 @@ enum {
     OPC2_32_RR_DVINIT_U                          = 0x0a,
     OPC2_32_RR_PARITY                            = 0x02,
     OPC2_32_RR_UNPACK                            = 0x08,
+    OPC2_32_RR_CRC32                             = 0x03,
 };
 /* OPCM_32_RR_IDIRECT                               */
 enum {
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (5 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction " Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:27   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions " Bastian Koppelmann
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c       | 10 ++++++++++
 target-tricore/tricore-opcodes.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 52f474b..4aea0c6 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -7792,10 +7792,12 @@ static void decode_rrrw_extract_insert(CPUTriCoreState *env, DisasContext *ctx)
 static void decode_sys_interrupts(CPUTriCoreState *env, DisasContext *ctx)
 {
     uint32_t op2;
+    uint32_t r1;
     TCGLabel *l1;
     TCGv tmp;
 
     op2 = MASK_OP_SYS_OP2(ctx->opcode);
+    r1  = MASK_OP_SYS_S1D(ctx->opcode);
 
     switch (op2) {
     case OPC2_32_SYS_DEBUG:
@@ -7844,6 +7846,14 @@ static void decode_sys_interrupts(CPUTriCoreState *env, DisasContext *ctx)
     case OPC2_32_SYS_SVLCX:
         gen_helper_svlcx(cpu_env);
         break;
+    case OPC2_32_SYS_RESTORE:
+        if (tricore_feature(env, TRICORE_FEATURE_16)) {
+            if ((ctx->hflags & TRICORE_HFLAG_KUU) == TRICORE_HFLAG_SM ||
+                (ctx->hflags & TRICORE_HFLAG_KUU) == TRICORE_HFLAG_UM1) {
+                tcg_gen_deposit_tl(cpu_ICR, cpu_ICR, cpu_gpr_d[r1], 8, 1);
+            } /* else raise privilege trap */
+        } /* else raise illegal opcode trap */
+        break;
     case OPC2_32_SYS_TRAPSV:
         /* TODO: raise sticky overflow trap */
         break;
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index 440c7fe..d1506a9 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -1434,4 +1434,5 @@ enum {
     OPC2_32_SYS_SVLCX                            = 0x08,
     OPC2_32_SYS_TRAPSV                           = 0x15,
     OPC2_32_SYS_TRAPV                            = 0x14,
+    OPC2_32_SYS_RESTORE                          = 0x0e,
 };
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions of the v1.6 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (6 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:28   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 09/10] target-tricore: add FRET " Bastian Koppelmann
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c       | 21 +++++++++++++++++++++
 target-tricore/tricore-opcodes.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 4aea0c6..545cc06 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -3275,6 +3275,13 @@ static void gen_loop(DisasContext *ctx, int r1, int32_t offset)
     gen_goto_tb(ctx, 0, ctx->next_pc);
 }
 
+static void gen_fcall_save_ctx(DisasContext *ctx)
+{
+    tcg_gen_addi_tl(cpu_gpr_a[10], cpu_gpr_a[10], -4);
+    tcg_gen_qemu_st_tl(cpu_gpr_a[11], cpu_gpr_a[10], ctx->mem_idx, MO_LESL);
+    tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
+}
+
 static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
                                int r2 , int32_t constant , int32_t offset)
 {
@@ -3369,6 +3376,14 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
         gen_helper_1arg(call, ctx->next_pc);
         gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
         break;
+    case OPC1_32_B_FCALL:
+        gen_fcall_save_ctx(ctx);
+        gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
+        break;
+    case OPC1_32_B_FCALLA:
+        gen_fcall_save_ctx(ctx);
+        gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
+        break;
     case OPC1_32_B_JLA:
         tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
         /* fall through */
@@ -6311,6 +6326,10 @@ static void decode_rr_idirect(CPUTriCoreState *env, DisasContext *ctx)
         gen_helper_1arg(call, ctx->next_pc);
         tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[r1], ~0x1);
         break;
+    case OPC2_32_RR_FCALLI:
+        gen_fcall_save_ctx(ctx);
+        tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[r1], ~0x1);
+        break;
     }
     tcg_gen_exit_tb(0);
     ctx->bstate = BS_BRANCH;
@@ -7946,6 +7965,8 @@ static void decode_32Bit_opc(CPUTriCoreState *env, DisasContext *ctx)
 /* B-format */
     case OPC1_32_B_CALL:
     case OPC1_32_B_CALLA:
+    case OPC1_32_B_FCALL:
+    case OPC1_32_B_FCALLA:
     case OPC1_32_B_J:
     case OPC1_32_B_JA:
     case OPC1_32_B_JL:
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index d1506a9..bb1939c 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -428,6 +428,8 @@ enum {
 /* B Format */
     OPC1_32_B_CALL                                   = 0x6d,
     OPC1_32_B_CALLA                                  = 0xed,
+    OPC1_32_B_FCALL                                  = 0x61,
+    OPC1_32_B_FCALLA                                 = 0xe1,
     OPC1_32_B_J                                      = 0x1d,
     OPC1_32_B_JA                                     = 0x9d,
     OPC1_32_B_JL                                     = 0x5d,
@@ -1127,6 +1129,7 @@ enum {
     OPC2_32_RR_JI                                = 0x03,
     OPC2_32_RR_JLI                               = 0x02,
     OPC2_32_RR_CALLI                             = 0x00,
+    OPC2_32_RR_FCALLI                            = 0x01,
 };
 /*
  * RR1 Format
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 09/10] target-tricore: add FRET instructions of the v1.6 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (7 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions " Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:29   ` Richard Henderson
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U " Bastian Koppelmann
  2015-05-21 15:28 ` [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/translate.c       | 14 ++++++++++++++
 target-tricore/tricore-opcodes.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 545cc06..4f517b3 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -3282,6 +3282,15 @@ static void gen_fcall_save_ctx(DisasContext *ctx)
     tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
 }
 
+static void gen_fret(DisasContext *ctx)
+{
+    tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[11], ~0x1);
+    tcg_gen_qemu_ld_tl(cpu_gpr_a[11], cpu_gpr_a[10], ctx->mem_idx, MO_LESL);
+    tcg_gen_addi_tl(cpu_gpr_a[10], cpu_gpr_a[10], 4);
+    tcg_gen_exit_tb(0);
+    ctx->bstate = BS_BRANCH;
+}
+
 static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
                                int r2 , int32_t constant , int32_t offset)
 {
@@ -3864,6 +3873,8 @@ static void decode_sr_system(CPUTriCoreState *env, DisasContext *ctx)
     case OPC2_16_SR_DEBUG:
         /* raise EXCP_DEBUG */
         break;
+    case OPC2_16_SR_FRET:
+        gen_fret(ctx);
     }
 }
 
@@ -7837,6 +7848,9 @@ static void decode_sys_interrupts(CPUTriCoreState *env, DisasContext *ctx)
     case OPC2_32_SYS_RET:
         gen_compute_branch(ctx, op2, 0, 0, 0, 0);
         break;
+    case OPC2_32_SYS_FRET:
+        gen_fret(ctx);
+        break;
     case OPC2_32_SYS_RFE:
         gen_helper_rfe(cpu_env);
         tcg_gen_exit_tb(0);
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index bb1939c..22c79f5 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -399,6 +399,7 @@ enum {
     OPC2_16_SR_RET                                   = 0x09,
     OPC2_16_SR_RFE                                   = 0x08,
     OPC2_16_SR_DEBUG                                 = 0x0a,
+    OPC2_16_SR_FRET                                  = 0x07,
 };
 /* OPCM_16_SR_ACCU                                   */
 enum {
@@ -1438,4 +1439,5 @@ enum {
     OPC2_32_SYS_TRAPSV                           = 0x15,
     OPC2_32_SYS_TRAPV                            = 0x14,
     OPC2_32_SYS_RESTORE                          = 0x0e,
+    OPC2_32_SYS_FRET                             = 0x03,
 };
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U instructions of the v1.6 ISA
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (8 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 09/10] target-tricore: add FRET " Bastian Koppelmann
@ 2015-05-13  9:45 ` Bastian Koppelmann
  2015-05-21 17:29   ` Richard Henderson
  2015-05-21 15:28 ` [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
  10 siblings, 1 reply; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-13  9:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target-tricore/helper.h          |  2 ++
 target-tricore/op_helper.c       | 49 ++++++++++++++++++++++++++++++++++++++++
 target-tricore/translate.c       | 21 +++++++++++++++++
 target-tricore/tricore-opcodes.h |  2 ++
 4 files changed, 74 insertions(+)

diff --git a/target-tricore/helper.h b/target-tricore/helper.h
index 842506c..cc221f1 100644
--- a/target-tricore/helper.h
+++ b/target-tricore/helper.h
@@ -113,6 +113,8 @@ DEF_HELPER_3(dvinit_h_131, i64, env, i32, i32)
 DEF_HELPER_FLAGS_2(dvadj, TCG_CALL_NO_RWG_SE, i64, i64, i32)
 DEF_HELPER_FLAGS_2(dvstep, TCG_CALL_NO_RWG_SE, i64, i64, i32)
 DEF_HELPER_FLAGS_2(dvstep_u, TCG_CALL_NO_RWG_SE, i64, i64, i32)
+DEF_HELPER_3(divide, i64, env, i32, i32)
+DEF_HELPER_3(divide_u, i64, env, i32, i32)
 /* mulh */
 DEF_HELPER_FLAGS_5(mul_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
 DEF_HELPER_FLAGS_5(mulm_h, TCG_CALL_NO_RWG_SE, i64, i32, i32, i32, i32, i32)
diff --git a/target-tricore/op_helper.c b/target-tricore/op_helper.c
index 7aa1f8e..10ed541 100644
--- a/target-tricore/op_helper.c
+++ b/target-tricore/op_helper.c
@@ -2094,6 +2094,55 @@ uint64_t helper_dvstep_u(uint64_t r1, uint32_t r2)
     return ((uint64_t)remainder << 32) | (uint32_t)dividend_quotient;
 }
 
+uint64_t helper_divide(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+{
+    int32_t quotient, remainder;
+    int32_t dividend = (int32_t)r1;
+    int32_t divisor = (int32_t)r2;
+
+    if (divisor == 0) {
+        if (dividend >= 0) {
+            quotient = 0x7fffffff;
+            remainder = 0;
+        } else {
+            quotient = 0x80000000;
+            remainder = 0;
+        }
+        env->PSW_USB_V = (1 << 31);
+    } else if ((divisor == 0xffffffff) && (dividend == 0x80000000)) {
+        quotient = 0x7fffffff;
+        remainder = 0;
+        env->PSW_USB_V = (1 << 31);
+    } else {
+        remainder = dividend % divisor;
+        quotient = (dividend - remainder)/divisor;
+        env->PSW_USB_V = 0;
+    }
+    env->PSW_USB_SV |= env->PSW_USB_V;
+    env->PSW_USB_AV = 0;
+    return ((uint64_t)remainder << 32) | (uint32_t)quotient;
+}
+
+uint64_t helper_divide_u(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+{
+    uint32_t quotient, remainder;
+    uint32_t dividend = r1;
+    uint32_t divisor = r2;
+
+    if (divisor == 0) {
+        quotient = 0xffffffff;
+        remainder = 0;
+        env->PSW_USB_V = (1 << 31);
+    } else {
+        remainder = dividend % divisor;
+        quotient = (dividend - remainder)/divisor;
+        env->PSW_USB_V = 0;
+    }
+    env->PSW_USB_SV |= env->PSW_USB_V;
+    env->PSW_USB_AV = 0;
+    return ((uint64_t)remainder << 32) | quotient;
+}
+
 uint64_t helper_mul_h(uint32_t arg00, uint32_t arg01,
                       uint32_t arg10, uint32_t arg11, uint32_t n)
 {
diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 4f517b3..7b382a0 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -201,6 +201,15 @@ void tricore_cpu_dump_state(CPUState *cs, FILE *f,
     tcg_temp_free_i64(arg1);                                 \
 } while (0)
 
+#define GEN_HELPER_RR(name, rl, rh, arg1, arg2) do {        \
+    TCGv_i64 ret = tcg_temp_new_i64();                      \
+                                                            \
+    gen_helper_##name(ret, cpu_env, arg1, arg2);            \
+    tcg_gen_extr_i64_i32(rl, rh, ret);                      \
+                                                            \
+    tcg_temp_free_i64(ret);                                 \
+} while (0)
+
 #define EA_ABS_FORMAT(con) (((con & 0x3C000) << 14) + (con & 0x3FFF))
 #define EA_B_ABSOLUT(con) (((offset & 0xf00000) << 8) | \
                            ((offset & 0x0fffff) << 1))
@@ -6484,6 +6493,18 @@ static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx)
             gen_helper_crc32(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]);
         } /* TODO: else raise illegal opcode trap */
         break;
+    case OPC2_32_RR_DIV:
+        if (tricore_feature(env, TRICORE_FEATURE_16)) {
+            GEN_HELPER_RR(divide, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1],
+                          cpu_gpr_d[r2]);
+        } /* TODO: else raise illegal opcode trap */
+        break;
+    case OPC2_32_RR_DIV_U:
+        if (tricore_feature(env, TRICORE_FEATURE_16)) {
+            GEN_HELPER_RR(divide_u, cpu_gpr_d[r3], cpu_gpr_d[r3+1],
+                          cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        } /* TODO: else raise illegal opcode trap */
+        break;
     }
 }
 
diff --git a/target-tricore/tricore-opcodes.h b/target-tricore/tricore-opcodes.h
index 22c79f5..1bfed0c 100644
--- a/target-tricore/tricore-opcodes.h
+++ b/target-tricore/tricore-opcodes.h
@@ -1124,6 +1124,8 @@ enum {
     OPC2_32_RR_PARITY                            = 0x02,
     OPC2_32_RR_UNPACK                            = 0x08,
     OPC2_32_RR_CRC32                             = 0x03,
+    OPC2_32_RR_DIV                               = 0x20,
+    OPC2_32_RR_DIV_U                             = 0x21,
 };
 /* OPCM_32_RR_IDIRECT                               */
 enum {
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions
  2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
                   ` (9 preceding siblings ...)
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U " Bastian Koppelmann
@ 2015-05-21 15:28 ` Bastian Koppelmann
  10 siblings, 0 replies; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-21 15:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: rth

ping?

On 05/13/2015 11:45 AM, Bastian Koppelmann wrote:
> Hi,
>
> the new Aurix platform introduces a new ISA version, so this patchset
> adds a new feature bit and changes the generic Aurix cpu to a more specific
> tc27x cpu model. While at this, it introduces a new cpu model tc1797 which
> uses the v1.3.1 ISA and fixes the tc1796 to us the v1.3 ISA.
>
> It also adds the with v1.6.1 introduces instructions cmpswap, swapmsk and
> crc32. While at this, it adds the missing instructions of the v1.6 ISA.
>
> Cheers,
> Bastian
>
> Bastian Koppelmann (10):
>    target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3
>    target-tricore: introduce ISA v1.6.1 feature
>    target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA
>    target-tricore: add CMPSWP instructions of the v1.6.1 ISA
>    target-tricore: add SWAPMSK instructions of the v1.6.1 ISA
>    target-tricore: add RR_CRC32 instruction of the v1.6.1 ISA
>    target-tricore: add SYS_RESTORE instruction of the v1.6 ISA
>    target-tricore: add FCALL instructions of the v1.6 ISA
>    target-tricore: add FRET instructions of the v1.6 ISA
>    target-tricore: add RR_DIV and RR_DIV_U instructions of the v1.6 ISA
>
>   target-tricore/cpu.c             |  18 ++++-
>   target-tricore/cpu.h             |   1 +
>   target-tricore/helper.h          |   4 +
>   target-tricore/op_helper.c       |  60 +++++++++++++++
>   target-tricore/translate.c       | 156 ++++++++++++++++++++++++++++++++++++++-
>   target-tricore/tricore-opcodes.h |  19 +++++
>   6 files changed, 253 insertions(+), 5 deletions(-)
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3 Bastian Koppelmann
@ 2015-05-21 17:19   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:19 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/cpu.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature Bastian Koppelmann
@ 2015-05-21 17:19   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:19 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> The aurix platform contains of several different cpu models and uses
> the 1.6.1 ISA. This patch changes the generic aurix model to the more
> specific tc27x cpu model and sets specific features.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/cpu.c | 10 +++++++---
>  target-tricore/cpu.h |  1 +
>  2 files changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA Bastian Koppelmann
@ 2015-05-21 17:20   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:20 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/translate.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>

> +    case OPC1_16_SRC_MOV_E:
> +        if (tricore_feature(env, TRICORE_FEATURE_16)) {
> +            tcg_gen_movi_tl(cpu_gpr_d[r1], const4);
> +            tcg_gen_sari_tl(cpu_gpr_d[r1+1], cpu_gpr_d[r1], 31);

You could sign-extend here at translation time, but it's also true that the
optimizer will handle this.


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA Bastian Koppelmann
@ 2015-05-21 17:22   ` Richard Henderson
  2015-05-22  8:07     ` Bastian Koppelmann
  0 siblings, 1 reply; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:22 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Those instruction were introduced in the new Aurix platform.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

I can't really review this, because I can only find the v1.6 isa.
That said, the code for gen_cmpswap looks plausible, so...

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK instructions of the v1.6.1 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK " Bastian Koppelmann
@ 2015-05-21 17:22   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:22 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Those instruction were introduced in the new Aurix platform.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Likewise from cmpswap,

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction of the v1.6.1 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction " Bastian Koppelmann
@ 2015-05-21 17:25   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:25 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> This instruction was introduced by the new Aurix platform.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/helper.h          |  2 ++
>  target-tricore/op_helper.c       | 11 +++++++++++
>  target-tricore/translate.c       |  5 +++++
>  target-tricore/tricore-opcodes.h |  1 +
>  4 files changed, 19 insertions(+)

Likewise re the v1.6.1 isa.  I'll trust you picked the function with the
correct polynomial.

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA Bastian Koppelmann
@ 2015-05-21 17:27   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:27 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/translate.c       | 10 ++++++++++
>  target-tricore/tricore-opcodes.h |  1 +
>  2 files ch

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions of the v1.6 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions " Bastian Koppelmann
@ 2015-05-21 17:28   ` Richard Henderson
  2015-05-22  8:08     ` Bastian Koppelmann
  0 siblings, 1 reply; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:28 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> +static void gen_fcall_save_ctx(DisasContext *ctx)
> +{
> +    tcg_gen_addi_tl(cpu_gpr_a[10], cpu_gpr_a[10], -4);
> +    tcg_gen_qemu_st_tl(cpu_gpr_a[11], cpu_gpr_a[10], ctx->mem_idx, MO_LESL);
> +    tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
> +}

Does a[10] really get updated if the store traps?


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 09/10] target-tricore: add FRET instructions of the v1.6 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 09/10] target-tricore: add FRET " Bastian Koppelmann
@ 2015-05-21 17:29   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:29 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> +static void gen_fret(DisasContext *ctx)
> +{
> +    tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[11], ~0x1);
> +    tcg_gen_qemu_ld_tl(cpu_gpr_a[11], cpu_gpr_a[10], ctx->mem_idx, MO_LESL);
> +    tcg_gen_addi_tl(cpu_gpr_a[10], cpu_gpr_a[10], 4);
> +    tcg_gen_exit_tb(0);
> +    ctx->bstate = BS_BRANCH;
> +}

Likewise, if the load traps, surely PC isn't updated.


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U instructions of the v1.6 ISA
  2015-05-13  9:45 ` [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U " Bastian Koppelmann
@ 2015-05-21 17:29   ` Richard Henderson
  0 siblings, 0 replies; 24+ messages in thread
From: Richard Henderson @ 2015-05-21 17:29 UTC (permalink / raw)
  To: Bastian Koppelmann, qemu-devel

On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  target-tricore/helper.h          |  2 ++
>  target-tricore/op_helper.c       | 49 ++++++++++++++++++++++++++++++++++++++++
>  target-tricore/translate.c       | 21 +++++++++++++++++
>  target-tricore/tricore-opcodes.h |  2 ++
>  4 files changed, 74 insertions(+)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA
  2015-05-21 17:22   ` Richard Henderson
@ 2015-05-22  8:07     ` Bastian Koppelmann
  0 siblings, 0 replies; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-22  8:07 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel



On 05/21/2015 07:22 PM, Richard Henderson wrote:
> On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
>> Those instruction were introduced in the new Aurix platform.
>>
>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> I can't really review this, because I can only find the v1.6 isa.
> That said, the code for gen_cmpswap looks plausible, so...
Unfortunately I can't give you the documentation either, because my 
University has a NDA with Infineon and I'm only allowed to post the 
implementation of the new Instructions.

Cheers,
Bastian

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions of the v1.6 ISA
  2015-05-21 17:28   ` Richard Henderson
@ 2015-05-22  8:08     ` Bastian Koppelmann
  0 siblings, 0 replies; 24+ messages in thread
From: Bastian Koppelmann @ 2015-05-22  8:08 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel



On 05/21/2015 07:28 PM, Richard Henderson wrote:
> On 05/13/2015 02:45 AM, Bastian Koppelmann wrote:
>> +static void gen_fcall_save_ctx(DisasContext *ctx)
>> +{
>> +    tcg_gen_addi_tl(cpu_gpr_a[10], cpu_gpr_a[10], -4);
>> +    tcg_gen_qemu_st_tl(cpu_gpr_a[11], cpu_gpr_a[10], ctx->mem_idx, MO_LESL);
>> +    tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
>> +}
> Does a[10] really get updated if the store traps?
Good catch! It does not and a tmp is required.

Cheers,
Bastian

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-05-22  8:08 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13  9:45 [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann
2015-05-13  9:45 ` [Qemu-devel] [PATCH 01/10] target-tricore: Add ISA v1.3.1 cpu and fix tc1796 to using v1.3 Bastian Koppelmann
2015-05-21 17:19   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 02/10] target-tricore: introduce ISA v1.6.1 feature Bastian Koppelmann
2015-05-21 17:19   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 03/10] target-tricore: Add SRC_MOV_E instruction of the v1.6 ISA Bastian Koppelmann
2015-05-21 17:20   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 04/10] target-tricore: add CMPSWP instructions of the v1.6.1 ISA Bastian Koppelmann
2015-05-21 17:22   ` Richard Henderson
2015-05-22  8:07     ` Bastian Koppelmann
2015-05-13  9:45 ` [Qemu-devel] [PATCH 05/10] target-tricore: add SWAPMSK " Bastian Koppelmann
2015-05-21 17:22   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 06/10] target-tricore: add RR_CRC32 instruction " Bastian Koppelmann
2015-05-21 17:25   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 07/10] target-tricore: add SYS_RESTORE instruction of the v1.6 ISA Bastian Koppelmann
2015-05-21 17:27   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 08/10] target-tricore: add FCALL instructions " Bastian Koppelmann
2015-05-21 17:28   ` Richard Henderson
2015-05-22  8:08     ` Bastian Koppelmann
2015-05-13  9:45 ` [Qemu-devel] [PATCH 09/10] target-tricore: add FRET " Bastian Koppelmann
2015-05-21 17:29   ` Richard Henderson
2015-05-13  9:45 ` [Qemu-devel] [PATCH 10/10] target-tricore: add RR_DIV and RR_DIV_U " Bastian Koppelmann
2015-05-21 17:29   ` Richard Henderson
2015-05-21 15:28 ` [Qemu-devel] [PATCH 00/10] TriCore v1.6.1 ISA and missing v1.6 instructions Bastian Koppelmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.