All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rabin Vincent <rabin.vincent@axis.com>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 8/9] target-cris: add v17 CPU
Date: Mon, 26 Sep 2016 09:17:33 +0200	[thread overview]
Message-ID: <20160926071733.GB4538@axis.com> (raw)
In-Reply-To: <20160912221800.GK16305@toto>

On Tue, Sep 13, 2016 at 12:18:00AM +0200, Edgar E. Iglesias wrote:
> On Mon, Sep 05, 2016 at 01:54:11PM +0200, Rabin Vincent wrote:
> > diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c
> > index a3da425..33d86eb 100644
> > --- a/target-cris/translate_v10.c
> > +++ b/target-cris/translate_v10.c
> > @@ -1097,6 +1097,14 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
> >                  insn_len = dec10_bdap_m(env, dc, size);
> >                  break;
> >              default:
> > +                if (dc->opcode == CRISV17_IND_ADDC && dc->size == 2 &&
> > +                    env->pregs[PR_VR] == 17) {
> 
> Could you please add some comments on the insn encoding?
> Put the stuff from the commit msg in here.

OK, see new patch below.

> IIRC, ADDC and v17 are modifications made to the CRISv10 family of
> cores that never made it into the public manuals. Or am I wrong?

No, you're right.

8<---------------
>From 513465ad3f007885bafba3482705ba57cacd588b Mon Sep 17 00:00:00 2001
From: Rabin Vincent <rabinv@axis.com>
Date: Mon, 15 Aug 2016 13:59:32 +0200
Subject: [PATCH] target-cris: add v17 CPU

In the CRIS v17 CPU an ADDC (add with carry) instruction has been added
compared to the v10 instruction set.

 Assembler syntax:

  ADDC [Rs],Rd
  ADDC [Rs+],Rd

 Size: Dword

 Description:

  The source data is added together with the carry flag to the
  destination register. The size of the operation is dword.

 Operation:

  Rd += s + C-flag;

 Flags affected:

  S R P U I X N Z V C
  - - - - - 0 * * * *

 Instruction format: ADDC [Rs],Rd

  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |Destination(Rd)| 1   0   0   1   1   0   1   0 |   Source(Rs)  |
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

 Instruction format: ADDC [Rs+],Rd

  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |Destination(Rd)| 1   1   0   1   1   0   1   0 |   Source(Rs)  |
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Signed-off-by: Rabin Vincent <rabinv@axis.com>
---
 target-cris/cpu.c            | 14 ++++++++++++++
 target-cris/crisv10-decode.h |  1 +
 target-cris/translate_v10.c  | 23 +++++++++++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index c5a656b..d680cfb 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -246,6 +246,16 @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
     cc->gdb_read_register = crisv10_cpu_gdb_read_register;
 }
 
+static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
+{
+    CPUClass *cc = CPU_CLASS(oc);
+    CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
+
+    ccc->vr = 17;
+    cc->do_interrupt = crisv10_cpu_do_interrupt;
+    cc->gdb_read_register = crisv10_cpu_gdb_read_register;
+}
+
 static void crisv32_cpu_class_init(ObjectClass *oc, void *data)
 {
     CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
@@ -273,6 +283,10 @@ static const TypeInfo cris_cpu_model_type_infos[] = {
         .parent = TYPE_CRIS_CPU,
         .class_init = crisv11_cpu_class_init,
     }, {
+        .name = TYPE("crisv17"),
+        .parent = TYPE_CRIS_CPU,
+        .class_init = crisv17_cpu_class_init,
+    }, {
         .name = TYPE("crisv32"),
         .parent = TYPE_CRIS_CPU,
         .class_init = crisv32_cpu_class_init,
diff --git a/target-cris/crisv10-decode.h b/target-cris/crisv10-decode.h
index 587fbdd..bdb4b6d 100644
--- a/target-cris/crisv10-decode.h
+++ b/target-cris/crisv10-decode.h
@@ -92,6 +92,7 @@
 #define CRISV10_IND_JUMP_M       4
 #define CRISV10_IND_DIP          5
 #define CRISV10_IND_JUMP_R       6
+#define CRISV17_IND_ADDC         6
 #define CRISV10_IND_BOUND        7
 #define CRISV10_IND_BCC_M        7
 #define CRISV10_IND_MOVE_M_SPR   8
diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c
index 4707a18..0e4d039 100644
--- a/target-cris/translate_v10.c
+++ b/target-cris/translate_v10.c
@@ -1094,6 +1094,29 @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
                 insn_len = dec10_bdap_m(env, dc, size);
                 break;
             default:
+                /*
+                 * ADDC for v17:
+                 *
+                 * Instruction format: ADDC [Rs],Rd
+                 *
+                 *  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+                 *  |Destination(Rd)| 1   0   0   1   1   0   1   0 |   Source(Rs)  |
+                 *  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+                 *
+                 * Instruction format: ADDC [Rs+],Rd
+                 *
+                 *  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+                 *  |Destination(Rd)| 1   1   0   1   1   0   1   0 |   Source(Rs)  |
+                 *  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+                 */
+                if (dc->opcode == CRISV17_IND_ADDC && dc->size == 2 &&
+                    env->pregs[PR_VR] == 17) {
+                    LOG_DIS("addc op=%d %d\n",  dc->src, dc->dst);
+                    cris_cc_mask(dc, CC_MASK_NZVC);
+                    insn_len += dec10_ind_alu(env, dc, CC_OP_ADDC, size);
+                    break;
+                }
+
                 LOG_DIS("pc=%x var-ind.%d %d r%d r%d\n",
                           dc->pc, size, dc->opcode, dc->src, dc->dst);
                 cpu_abort(CPU(dc->cpu), "Unhandled opcode");
-- 
2.1.4

  reply	other threads:[~2016-09-26  7:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 11:54 [Qemu-devel] [PATCH 1/9] tests: cris: force inlining Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 2/9] tests: cris: fix syscall inline asm Rabin Vincent
2016-09-05 18:20   ` Richard Henderson
2016-09-08 11:38     ` [Qemu-devel] [PATCHv2 2/8] " Rabin Vincent
2016-09-08 16:10       ` Richard Henderson
2016-09-05 11:54 ` [Qemu-devel] [PATCH 3/9] tests: cris: remove openpf4 test Rabin Vincent
2016-09-12 22:51   ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 4/9] tests: cris: remove check_time1 Rabin Vincent
2016-09-12 23:00   ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 5/9] target-cris: sync CC state at load/stores Rabin Vincent
2016-09-05 19:02   ` Richard Henderson
2016-09-06 21:52     ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 6/9] target-cris: reduce v32isms from v10 log dumps Rabin Vincent
2016-09-12 22:59   ` Edgar E. Iglesias
2016-09-14 12:48     ` Hans-Peter Nilsson
2016-09-26  7:06     ` Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 7/9] target-cris: ignore prefix insns in singlestep Rabin Vincent
2016-09-12 22:49   ` Edgar E. Iglesias
2016-09-14 13:32     ` Hans-Peter Nilsson
2016-09-05 11:54 ` [Qemu-devel] [PATCH 8/9] target-cris: add v17 CPU Rabin Vincent
2016-09-12 22:18   ` Edgar E. Iglesias
2016-09-26  7:17     ` Rabin Vincent [this message]
2016-09-28 10:42       ` Edgar E. Iglesias
2016-09-30 16:50         ` Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 9/9] tests: cris: add v17 ADDC test Rabin Vincent
2016-09-12 23:16   ` Edgar E. Iglesias
2016-09-06 21:53 ` [Qemu-devel] [PATCH 1/9] tests: cris: force inlining Edgar E. Iglesias
2016-09-08 11:41   ` Rabin Vincent
2016-09-08 18:06 ` Peter Maydell
2016-09-08 18:21   ` Eric Blake
2016-09-12  9:43   ` [Qemu-devel] [PATCHv2 1/8] " Rabin Vincent

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=20160926071733.GB4538@axis.com \
    --to=rabin.vincent@axis.com \
    --cc=edgar.iglesias@gmail.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 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.