Skip to contentSkip to conversation

sim port for OpenRISC

PATCH Superseded Stafford Horne 1 participant 8 messages Oct 13, 2017

lore
Share & tools
lore
#0 lore raw

v6 cover sim port for OpenRISC

Hello,

Please find attached the sim patches that allow to get a basic OpenRISC system running. This was used to verify the OpenRISC gdb port.

The main author is Peter Gavin who should have his FSF copyright in place.

Request for comments on:
- The testcase has a few tests commented out. I do not plan to fix now, but hopefully be addressed after upstreaming.

# Test Results #

Sim dejagnu tests were added specifically for openrisc and used to test this. Please see the details of running the testsuite for sim below:

=== sim Summary ===

# of expected passes            18
/home/shorne/work/openrisc/build-gdb/sim/or1k/run 0.5

Thanks,
-Stafford

Changes since v5
* Moved the cover letter docs into a README as suggested by Doug
* Fixes in sim-fpu suggested by Simon
- removed some spurious comments
- added a missing changelog entry for sim_fpu_print_status
- fixed an indent issue
* Fixed changelog of MUL2OFSI and MUL1OFSI
- comment was flipped
- switched from saying macro to function
* Fixes to sim & testsuite patch
- removed 1996 copyrights throughout
- fixed 80 char column issues
- fixed comment typos
- fixed issue with '* current_cpu' vs '*current_cpu' throughout
- added comments about SR[LEE]

Changes since v4
* Added comments to most of the functions
* Implemented remainder fpu function
* Actually wire in fpu and error handling logic
* Added fpu test case

Changes since v3
* Cleaned up indentation and style of sim testsuite
* Cleaned up TODOs in testsuite
* Implemented range exception

Changes since v2
* Removed 64-bit implementation (reduced files)
* Removed cgen suffix patch
* Removed different builds for linux
* Removed unused macros
* Fixed gnu style issues pointed out by Mike
* Fixed copyrights (not Cygnus, added to each file)

Changes since v1
* Squashed sim patches into single sim patch
* Put Generated files in separate patch
* I have my sim/gdb copyright assignment complete

Peter Gavin (3):
sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd])
sim: cgen: add MUL2OFSI and MUL1OFSI functions (needed for OR1K

    l.mul[u])

sim: testsuite: add testsuite for or1k sim

Stafford Horne (3):
sim: or1k: add or1k target to sim
sim: or1k: add cgen generated files
sim: or1k: add autoconf generated files

 sim/common/cgen-accfp.c                        |    40 +
 sim/common/cgen-fpu.h                          |     4 +
 sim/common/cgen-ops.h                          |    18 +
 sim/common/sim-fpu.c                           |    86 +
 sim/common/sim-fpu.h                           |    13 +-
 sim/configure                                  |     9 +
 sim/configure.tgt                              |     3 +
 sim/or1k/Makefile.in                           |   147 +
 sim/or1k/README                                |   107 +
 sim/or1k/aclocal.m4                            |   119 +
 sim/or1k/arch.c                                |    38 +
 sim/or1k/arch.h                                |    50 +
 sim/or1k/config.in                             |   248 +
 sim/or1k/configure                             | 16043 +++++++++++++++++++++++
 sim/or1k/configure.ac                          |    17 +
 sim/or1k/cpu.c                                 | 10181 ++++++++++++++
 sim/or1k/cpu.h                                 |  5024 +++++++
 sim/or1k/cpuall.h                              |    66 +
 sim/or1k/decode.c                              |  2559 ++++
 sim/or1k/decode.h                              |    94 +
 sim/or1k/mloop.in                              |   241 +
 sim/or1k/model.c                               |  3809 ++++++
 sim/or1k/or1k-sim.h                            |    93 +
 sim/or1k/or1k.c                                |   356 +
 sim/or1k/sem-switch.c                          |  2748 ++++
 sim/or1k/sem.c                                 |  2953 +++++
 sim/or1k/sim-if.c                              |   279 +
 sim/or1k/sim-main.h                            |    81 +
 sim/or1k/traps.c                               |   299 +
 sim/testsuite/configure                        |     4 +
 sim/testsuite/sim/or1k/add.S                   |   639 +
 sim/testsuite/sim/or1k/alltests.exp            |    34 +
 sim/testsuite/sim/or1k/and.S                   |   198 +
 sim/testsuite/sim/or1k/basic.S                 |   522 +
 sim/testsuite/sim/or1k/div.S                   |   291 +
 sim/testsuite/sim/or1k/ext.S                   |   236 +
 sim/testsuite/sim/or1k/find.S                  |   100 +
 sim/testsuite/sim/or1k/flag.S                  |   386 +
 sim/testsuite/sim/or1k/fpu.S                   |   129 +
 sim/testsuite/sim/or1k/jump.S                  |   105 +
 sim/testsuite/sim/or1k/load.S                  |   358 +
 sim/testsuite/sim/or1k/mac.S                   |   778 ++
 sim/testsuite/sim/or1k/mfspr.S                 |   171 +
 sim/testsuite/sim/or1k/mul.S                   |   574 +
 sim/testsuite/sim/or1k/or.S                    |   199 +
 sim/testsuite/sim/or1k/or1k-asm-test-env.h     |    59 +
 sim/testsuite/sim/or1k/or1k-asm-test-helpers.h |   121 +
 sim/testsuite/sim/or1k/or1k-asm-test.h         |   226 +
 sim/testsuite/sim/or1k/or1k-asm.h              |    37 +
 sim/testsuite/sim/or1k/or1k-test.ld            |    75 +
 sim/testsuite/sim/or1k/ror.S                   |   159 +
 sim/testsuite/sim/or1k/shift.S                 |   541 +
 sim/testsuite/sim/or1k/spr-defs.h              |   120 +
 sim/testsuite/sim/or1k/sub.S                   |   215 +
 sim/testsuite/sim/or1k/xor.S                   |   200 +
 55 files changed, 52197 insertions(+), 5 deletions(-)
 create mode 100644 sim/or1k/Makefile.in
 create mode 100644 sim/or1k/README
 create mode 100644 sim/or1k/aclocal.m4
 create mode 100644 sim/or1k/arch.c
 create mode 100644 sim/or1k/arch.h
 create mode 100644 sim/or1k/config.in
 create mode 100755 sim/or1k/configure
 create mode 100644 sim/or1k/configure.ac
 create mode 100644 sim/or1k/cpu.c
 create mode 100644 sim/or1k/cpu.h
 create mode 100644 sim/or1k/cpuall.h
 create mode 100644 sim/or1k/decode.c
 create mode 100644 sim/or1k/decode.h
 create mode 100644 sim/or1k/mloop.in
 create mode 100644 sim/or1k/model.c
 create mode 100644 sim/or1k/or1k-sim.h
 create mode 100644 sim/or1k/or1k.c
 create mode 100644 sim/or1k/sem-switch.c
 create mode 100644 sim/or1k/sem.c
 create mode 100644 sim/or1k/sim-if.c
 create mode 100644 sim/or1k/sim-main.h
 create mode 100644 sim/or1k/traps.c
 create mode 100644 sim/testsuite/sim/or1k/add.S
 create mode 100644 sim/testsuite/sim/or1k/alltests.exp
 create mode 100644 sim/testsuite/sim/or1k/and.S
 create mode 100644 sim/testsuite/sim/or1k/basic.S
 create mode 100644 sim/testsuite/sim/or1k/div.S
 create mode 100644 sim/testsuite/sim/or1k/ext.S
 create mode 100644 sim/testsuite/sim/or1k/find.S
 create mode 100644 sim/testsuite/sim/or1k/flag.S
 create mode 100644 sim/testsuite/sim/or1k/fpu.S
 create mode 100644 sim/testsuite/sim/or1k/jump.S
 create mode 100644 sim/testsuite/sim/or1k/load.S
 create mode 100644 sim/testsuite/sim/or1k/mac.S
 create mode 100644 sim/testsuite/sim/or1k/mfspr.S
 create mode 100644 sim/testsuite/sim/or1k/mul.S
 create mode 100644 sim/testsuite/sim/or1k/or.S
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test-env.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test-helpers.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-test.ld
 create mode 100644 sim/testsuite/sim/or1k/ror.S
 create mode 100644 sim/testsuite/sim/or1k/shift.S
 create mode 100644 sim/testsuite/sim/or1k/spr-defs.h
 create mode 100644 sim/testsuite/sim/or1k/sub.S
 create mode 100644 sim/testsuite/sim/or1k/xor.S
Signature · 1 line
2.13.6
#1 lore raw

PATCH v6 1/6 sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd])

From: Peter Gavin <[email protected]>

* sim/common/ChangeLog:

2016-05-21 Peter Gavin <[email protected]>
Stafford Horne <[email protected]>

* cgen-accfp.c (remsf, remdf): New function. (cgen_init_accurate_fpu): Add remsf and remdf.
* cgen-fpu.h (cgen_fp_ops): Add remsf, remdf, remxf and remtf.
* sim-fpu.c (sim_fpu_rem): New function.
* sim-fpu.h (sim_fpu_status_invalid_irx): New enum. (sim_fpu_rem): New function.
(sim_fpu_print_status): Add case for sim_fpu_status_invalid_irx.

---
 sim/common/cgen-accfp.c | 40 +++++++++++++++++++++++
 sim/common/cgen-fpu.h   |  4 +++
 sim/common/sim-fpu.c    | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
 sim/common/sim-fpu.h    | 13 +++++---
 4 files changed, 138 insertions(+), 5 deletions(-)
sim/common/cgen-accfp.c +40 -0
index afbca6d582..5d600c6e41 100644
@@ -93,6 +93,25 @@ divsf (CGEN_FPU* fpu, SF x, SF y)
 }
 
 static SF
+remsf (CGEN_FPU* fpu, SF x, SF y)
+{
+  sim_fpu op1;
+  sim_fpu op2;
+  sim_fpu ans;
+  unsigned32 res;
+  sim_fpu_status status;
+
+  sim_fpu_32to (&op1, x);
+  sim_fpu_32to (&op2, y);
+  status = sim_fpu_rem (&ans, &op1, &op2);
+  if (status != 0)
+    (*fpu->ops->error) (fpu, status);
+  sim_fpu_to32 (&res, &ans);
+
+  return res;
+}
+
+static SF
 negsf (CGEN_FPU* fpu, SF x)
 {
   sim_fpu op1;
@@ -453,6 +472,25 @@ divdf (CGEN_FPU* fpu, DF x, DF y)
 }
 
 static DF
+remdf (CGEN_FPU* fpu, DF x, DF y)
+{
+  sim_fpu op1;
+  sim_fpu op2;
+  sim_fpu ans;
+  unsigned64 res;
+  sim_fpu_status status;
+
+  sim_fpu_64to (&op1, x);
+  sim_fpu_64to (&op2, y);
+  status = sim_fpu_rem (&ans, &op1, &op2);
+  if (status != 0)
+    (*fpu->ops->error) (fpu, status);
+  sim_fpu_to64(&res, &ans);
+
+  return res;
+}
+
+static DF
 negdf (CGEN_FPU* fpu, DF x)
 {
   sim_fpu op1;
@@ -664,6 +702,7 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error)
   o->subsf = subsf;
   o->mulsf = mulsf;
   o->divsf = divsf;
+  o->remsf = remsf;
   o->negsf = negsf;
   o->abssf = abssf;
   o->sqrtsf = sqrtsf;
@@ -682,6 +721,7 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error)
   o->subdf = subdf;
   o->muldf = muldf;
   o->divdf = divdf;
+  o->remdf = remdf;
   o->negdf = negdf;
   o->absdf = absdf;
   o->sqrtdf = sqrtdf;
sim/common/cgen-fpu.h +4 -0
index 134b4d031c..5f9b55d32e 100644
@@ -69,6 +69,7 @@ struct cgen_fp_ops {
   SF (*subsf) (CGEN_FPU*, SF, SF);
   SF (*mulsf) (CGEN_FPU*, SF, SF);
   SF (*divsf) (CGEN_FPU*, SF, SF);
+  SF (*remsf) (CGEN_FPU*, SF, SF);
   SF (*negsf) (CGEN_FPU*, SF);
   SF (*abssf) (CGEN_FPU*, SF);
   SF (*sqrtsf) (CGEN_FPU*, SF);
@@ -93,6 +94,7 @@ struct cgen_fp_ops {
   DF (*subdf) (CGEN_FPU*, DF, DF);
   DF (*muldf) (CGEN_FPU*, DF, DF);
   DF (*divdf) (CGEN_FPU*, DF, DF);
+  DF (*remdf) (CGEN_FPU*, DF, DF);
   DF (*negdf) (CGEN_FPU*, DF);
   DF (*absdf) (CGEN_FPU*, DF);
   DF (*sqrtdf) (CGEN_FPU*, DF);
@@ -142,6 +144,7 @@ struct cgen_fp_ops {
   XF (*subxf) (CGEN_FPU*, XF, XF);
   XF (*mulxf) (CGEN_FPU*, XF, XF);
   XF (*divxf) (CGEN_FPU*, XF, XF);
+  XF (*remxf) (CGEN_FPU*, XF, XF);
   XF (*negxf) (CGEN_FPU*, XF);
   XF (*absxf) (CGEN_FPU*, XF);
   XF (*sqrtxf) (CGEN_FPU*, XF);
@@ -180,6 +183,7 @@ struct cgen_fp_ops {
   TF (*subtf) (CGEN_FPU*, TF, TF);
   TF (*multf) (CGEN_FPU*, TF, TF);
   TF (*divtf) (CGEN_FPU*, TF, TF);
+  TF (*remtf) (CGEN_FPU*, TF, TF);
   TF (*negtf) (CGEN_FPU*, TF);
   TF (*abstf) (CGEN_FPU*, TF);
   TF (*sqrttf) (CGEN_FPU*, TF);
sim/common/sim-fpu.c +86 -0

98 lines not on this page · raw message

sim/common/sim-fpu.h +8 -5
index d27d80a513..adf3b1904a 100644
@@ -146,11 +146,12 @@ typedef enum
   sim_fpu_status_invalid_div0 = 128, /* (X / 0) */
   sim_fpu_status_invalid_cmp = 256, /* compare */
   sim_fpu_status_invalid_sqrt = 512,
-  sim_fpu_status_rounded = 1024,
-  sim_fpu_status_inexact = 2048,
-  sim_fpu_status_overflow = 4096,
-  sim_fpu_status_underflow = 8192,
-  sim_fpu_status_denorm = 16384,
+  sim_fpu_status_invalid_irx = 1024, /* (inf % X) */
+  sim_fpu_status_rounded = 2048,
+  sim_fpu_status_inexact = 4096,
+  sim_fpu_status_overflow = 8192,
+  sim_fpu_status_underflow = 16384,
+  sim_fpu_status_denorm = 32768,
 } sim_fpu_status;
 
 
@@ -230,6 +231,8 @@ INLINE_SIM_FPU (int) sim_fpu_mul (sim_fpu *f,
 				  const sim_fpu *l, const sim_fpu *r);
 INLINE_SIM_FPU (int) sim_fpu_div (sim_fpu *f,
 				  const sim_fpu *l, const sim_fpu *r);
+INLINE_SIM_FPU (int) sim_fpu_rem (sim_fpu *f,
+				  const sim_fpu *l, const sim_fpu *r);
 INLINE_SIM_FPU (int) sim_fpu_max (sim_fpu *f,
 				  const sim_fpu *l, const sim_fpu *r);
 INLINE_SIM_FPU (int) sim_fpu_min (sim_fpu *f,
Signature · 1 line
2.13.6
#2 lore raw

PATCH v6 2/6 sim: cgen: add MUL2OFSI and MUL1OFSI functions (needed for OR1K l.mul[u])

In reply to Stafford Horne

From: Peter Gavin <[email protected]>

sim/common/ChangeLog:

2012-03-14 Peter Gavin <[email protected]>
Stafford Horne <[email protected]>

* cgen-ops.h (MUL2OFSI): New function, 2's complement overflow flag.
(MUL1OFSI): New function, 1's complement overflow flag.

---
 sim/common/cgen-ops.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sim/common/cgen-ops.h +18 -0
index 97585d7943..0fa327630c 100644
@@ -631,6 +631,22 @@ SUBOFQI (QI a, QI b, BI c)
   return res;
 }
 
+SEMOPS_INLINE BI
+MUL2OFSI (SI a, SI b)
+{
+  DI tmp = MULDI (EXTSIDI (a), EXTSIDI (b));
+  BI res = tmp < -0x80000000LL || tmp > 0x7fffffffLL;
+  return res;
+}
+
+SEMOPS_INLINE BI
+MUL1OFSI (USI a, USI b)
+{
+  UDI tmp = MULDI (ZEXTSIDI (a), ZEXTSIDI (b));
+  BI res = (tmp > 0xFFFFFFFFULL);
+  return res;
+}
+
 #else
 
 SI ADDCSI (SI, SI, BI);
@@ -651,6 +667,8 @@ UBI ADDOFQI (QI, QI, BI);
 QI SUBCQI (QI, QI, BI);
 UBI SUBCFQI (QI, QI, BI);
 UBI SUBOFQI (QI, QI, BI);
+BI MUL1OFSI (SI a, SI b);
+BI MUL2OFSI (SI a, SI b);
 
 #endif
 
Signature · 1 line
2.13.6
#3 lore raw

PATCH v6 3/6 sim: or1k: add or1k target to sim

In reply to Stafford Horne

This adds the OpenRISC 32-bit sim target. The OpenRISC sim is a CGEN based sim so the bulk of the code is generated from the .cpu files by CGEN. The engine decode and execute logic in mloop uses scache with pseudo-basic-block extraction and supports both full and fast (switch) modes.

The sim does not implement an mmu at the moment. The sim does implement fpu instructions via the common sim-fpu implementation.

sim/ChangeLog:

2017-09-13 Stafford Horne <[email protected]>
Peter Gavin <[email protected]>

* configure.tgt: Add or1k sim.
* or1k/README: New file.
* or1k/Makefile.in: New file.
* or1k/configure.ac: New file.
* or1k/mloop.in: New file.
* or1k/or1k-sim.h: New file.
* or1k/or1k.c: New file.
* or1k/sim-if.c: New file.
* or1k/sim-main.h: New file.
* or1k/traps.c: New file.

---
 sim/configure.tgt     |   3 +
 sim/or1k/Makefile.in  | 147 +++++++++++++++++++++
 sim/or1k/README       | 107 +++++++++++++++
 sim/or1k/configure.ac |  17 +++
 sim/or1k/mloop.in     | 241 ++++++++++++++++++++++++++++++++++
 sim/or1k/or1k-sim.h   |  93 +++++++++++++
 sim/or1k/or1k.c       | 356 ++++++++++++++++++++++++++++++++++++++++++++++++++
 sim/or1k/sim-if.c     | 279 +++++++++++++++++++++++++++++++++++++++
 sim/or1k/sim-main.h   |  81 ++++++++++++
 sim/or1k/traps.c      | 299 ++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 1623 insertions(+)
 create mode 100644 sim/or1k/Makefile.in
 create mode 100644 sim/or1k/README
 create mode 100644 sim/or1k/configure.ac
 create mode 100644 sim/or1k/mloop.in
 create mode 100644 sim/or1k/or1k-sim.h
 create mode 100644 sim/or1k/or1k.c
 create mode 100644 sim/or1k/sim-if.c
 create mode 100644 sim/or1k/sim-main.h
 create mode 100644 sim/or1k/traps.c
sim/configure.tgt +3 -0
index c958fb3174..a6dbd1af83 100644
@@ -76,6 +76,9 @@ case "${target}" in
    msp430*-*-*)
        SIM_ARCH(msp430)
        ;;
+   or1k-*-* | or1knd-*-*)
+       SIM_ARCH(or1k)
+       ;;
    rl78-*-*)
        SIM_ARCH(rl78)
        ;;
sim/or1k/Makefile.in new file +147 -0

147 lines not on this page · raw message

sim/or1k/README new file +107 -0

107 lines not on this page · raw message

sim/or1k/configure.ac new file +17 -0
new file mode 100644
index 0000000000..8873a1d2de
@@ -0,0 +1,17 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.64)dnl
+AC_INIT(Makefile.in)
+sinclude(../common/acinclude.m4)
+
+SIM_AC_COMMON
+
+SIM_AC_OPTION_ENDIAN(BIG)
+SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
+SIM_AC_OPTION_BITSIZE([32], [31], [32])
+SIM_AC_OPTION_SCACHE(16384)
+SIM_AC_OPTION_DEFAULT_MODEL([or1200])
+SIM_AC_OPTION_ENVIRONMENT
+SIM_AC_OPTION_INLINE()
+SIM_AC_OPTION_CGEN_MAINT
+
+SIM_AC_OUTPUT
sim/or1k/mloop.in new file +241 -0

241 lines not on this page · raw message

sim/or1k/or1k-sim.h new file +93 -0

93 lines not on this page · raw message

sim/or1k/or1k.c new file +356 -0

356 lines not on this page · raw message

sim/or1k/sim-if.c new file +279 -0

279 lines not on this page · raw message

sim/or1k/sim-main.h new file +81 -0

81 lines not on this page · raw message

sim/or1k/traps.c new file +299 -0

299 lines not on this page · raw message

Signature · 1 line
2.13.6
#4 lore raw

PATCH v6 4/6 sim: or1k: add cgen generated files

In reply to Stafford Horne

These are the simulator files generated by cgen. These are split out from the main sim patch to make the patch easier to review and smaller.

sim/ChangeLog:

yyyy-mm-dd Stafford Horne <[email protected]>
Peter Gavin <[email protected]>

* or1k/arch.c: Generated.
* or1k/arch.h: Generated.
* or1k/cpu.c: Generated.
* or1k/cpu.h: Generated.
* or1k/cpuall.h: Generated.
* or1k/decode.c: Generated.
* or1k/decode.h: Generated.
* or1k/model.c: Generated.
* or1k/sem-switch.c: Generated.
* or1k/sem.c: Generated.

---
 sim/or1k/arch.c       |    38 +
 sim/or1k/arch.h       |    50 +
 sim/or1k/cpu.c        | 10181 ++++++++++++++++++++++++++++++++++++++++++++++++
 sim/or1k/cpu.h        |  5024 ++++++++++++++++++++++++
 sim/or1k/cpuall.h     |    66 +
 sim/or1k/decode.c     |  2559 ++++++++++++
 sim/or1k/decode.h     |    94 +
 sim/or1k/model.c      |  3809 ++++++++++++++++++
 sim/or1k/sem-switch.c |  2748 +++++++++++++
 sim/or1k/sem.c        |  2953 ++++++++++++++
 10 files changed, 27522 insertions(+)
 create mode 100644 sim/or1k/arch.c
 create mode 100644 sim/or1k/arch.h
 create mode 100644 sim/or1k/cpu.c
 create mode 100644 sim/or1k/cpu.h
 create mode 100644 sim/or1k/cpuall.h
 create mode 100644 sim/or1k/decode.c
 create mode 100644 sim/or1k/decode.h
 create mode 100644 sim/or1k/model.c
 create mode 100644 sim/or1k/sem-switch.c
 create mode 100644 sim/or1k/sem.c
sim/or1k/arch.c new file +38 -0
new file mode 100644
index 0000000000..83a9815284
@@ -0,0 +1,38 @@
+/* Simulator support for or1k.
+
+THIS FILE IS MACHINE GENERATED WITH CGEN.
+
+Copyright 1996-2010 Free Software Foundation, Inc.
+
+This file is part of the GNU simulators.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   It is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+#include "sim-main.h"
+#include "bfd.h"
+
+const SIM_MACH *sim_machs[] =
+{
+#ifdef HAVE_CPU_OR1K32BF
+  & or32_mach,
+#endif
+#ifdef HAVE_CPU_OR1K32BF
+  & or32nd_mach,
+#endif
+  0
+};
+
sim/or1k/arch.h new file +50 -0

50 lines not on this page · raw message

sim/or1k/cpu.c new file +10181 -0

2,912 lines not on this page · raw message

sim/or1k/cpu.h new file +5024 -0

5,024 lines not on this page · raw message

sim/or1k/cpuall.h new file +66 -0

66 lines not on this page · raw message

sim/or1k/decode.c new file +2559 -0

2,559 lines not on this page · raw message

sim/or1k/decode.h new file +94 -0

94 lines not on this page · raw message

sim/or1k/model.c new file +3809 -0

3,809 lines not on this page · raw message

sim/or1k/sem-switch.c new file +2748 -0

2,748 lines not on this page · raw message

sim/or1k/sem.c new file +2953 -0

2,953 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.6

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH v6 5/6 sim: or1k: add autoconf generated files

In reply to Stafford Horne

These are separted out to make the patch easier to read and smaller.

sim/ChangeLog:

yyyy-mm-dd Stafford Horne <[email protected]>
Peter Gavin <[email protected]>

* configure: Regenerated.
* or1k/aclocal.m4: Generated.
* or1k/config.in: Generated.
* or1k/configure: Generated.

---
 sim/configure       |     9 +
 sim/or1k/aclocal.m4 |   119 +
 sim/or1k/config.in  |   248 +
 sim/or1k/configure  | 16043 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 16419 insertions(+)
 create mode 100644 sim/or1k/aclocal.m4
 create mode 100644 sim/or1k/config.in
 create mode 100755 sim/or1k/configure
sim/configure +9 -0
index 243ecc90e3..b90152e7fb 100755
@@ -653,6 +653,7 @@ microblaze
 mips
 mn10300
 moxie
+or1k
 msp430
 rl78
 rx
@@ -3770,6 +3771,14 @@ subdirs="$subdirs aarch64"
 
 
        ;;
+   or1k-*-* | or1knd-*-*)
+
+  sim_arch=or1k
+  subdirs="$subdirs or1k"
+
+
+       sim_testsuite=yes
+       ;;
    rl78-*-*)
 
   sim_arch=rl78
sim/or1k/aclocal.m4 new file +119 -0

119 lines not on this page · raw message

sim/or1k/config.in new file +248 -0

248 lines not on this page · raw message

sim/or1k/configure new file +16043 -0

2,612 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.6

Part of the diff is not shown here. View the raw message.

#6 lore raw

PATCH v6 6/6 sim: testsuite: add testsuite for or1k sim

In reply to Stafford Horne

From: Peter Gavin <[email protected]>

This is the testsuite for the or1k sim, it tests running many of the basic architecture instructions on the openrisc sim.

sim/testsuite/sim/or1k/ChangeLog:

2017-10-04 Peter Gavin <[email protected]>
Stafford Horne <[email protected]>

* add.S: New file.
* alltests.exp: New file.
* and.S: New file.
* basic.S: New file.
* div.S: New file.
* ext.S: New file.
* find.S: New file.
* flag.S: New file.
* fpu.S: New file.
* jump.S: New file.
* load.S: New file.
* mac.S: New file.
* mfspr.S: New file.
* mul.S: New file.
* or.S: New file.
* or1k-asm-test-env.h: New file.
* or1k-asm-test-helpers.h: New file.
* or1k-asm-test.h: New file.
* or1k-asm.h: New file.
* or1k-test.ld: New file.
* ror.S: New file.
* shift.S: New file.
* spr-defs.h: New file.
* sub.S: New file.
* xor.S: New file.

sim/testsuite/ChangeLog:

2017-01-20 Stafford Horne <[email protected]>
Peter Gavin <[email protected]>

* testsuite/configure: Regenerated.

---
 sim/testsuite/configure                        |   4 +
 sim/testsuite/sim/or1k/add.S                   | 639 ++++++++++++++++++++
 sim/testsuite/sim/or1k/alltests.exp            |  34 ++
 sim/testsuite/sim/or1k/and.S                   | 198 +++++++
 sim/testsuite/sim/or1k/basic.S                 | 522 +++++++++++++++++
 sim/testsuite/sim/or1k/div.S                   | 291 +++++++++
 sim/testsuite/sim/or1k/ext.S                   | 236 ++++++++
 sim/testsuite/sim/or1k/find.S                  | 100 ++++
 sim/testsuite/sim/or1k/flag.S                  | 386 ++++++++++++
 sim/testsuite/sim/or1k/fpu.S                   | 129 ++++
 sim/testsuite/sim/or1k/jump.S                  | 105 ++++
 sim/testsuite/sim/or1k/load.S                  | 358 ++++++++++++
 sim/testsuite/sim/or1k/mac.S                   | 778 +++++++++++++++++++++++++
 sim/testsuite/sim/or1k/mfspr.S                 | 171 ++++++
 sim/testsuite/sim/or1k/mul.S                   | 574 ++++++++++++++++++
 sim/testsuite/sim/or1k/or.S                    | 199 +++++++
 sim/testsuite/sim/or1k/or1k-asm-test-env.h     |  59 ++
 sim/testsuite/sim/or1k/or1k-asm-test-helpers.h | 121 ++++
 sim/testsuite/sim/or1k/or1k-asm-test.h         | 226 +++++++
 sim/testsuite/sim/or1k/or1k-asm.h              |  37 ++
 sim/testsuite/sim/or1k/or1k-test.ld            |  75 +++
 sim/testsuite/sim/or1k/ror.S                   | 159 +++++
 sim/testsuite/sim/or1k/shift.S                 | 541 +++++++++++++++++
 sim/testsuite/sim/or1k/spr-defs.h              | 120 ++++
 sim/testsuite/sim/or1k/sub.S                   | 215 +++++++
 sim/testsuite/sim/or1k/xor.S                   | 200 +++++++
 26 files changed, 6477 insertions(+)
 create mode 100644 sim/testsuite/sim/or1k/add.S
 create mode 100644 sim/testsuite/sim/or1k/alltests.exp
 create mode 100644 sim/testsuite/sim/or1k/and.S
 create mode 100644 sim/testsuite/sim/or1k/basic.S
 create mode 100644 sim/testsuite/sim/or1k/div.S
 create mode 100644 sim/testsuite/sim/or1k/ext.S
 create mode 100644 sim/testsuite/sim/or1k/find.S
 create mode 100644 sim/testsuite/sim/or1k/flag.S
 create mode 100644 sim/testsuite/sim/or1k/fpu.S
 create mode 100644 sim/testsuite/sim/or1k/jump.S
 create mode 100644 sim/testsuite/sim/or1k/load.S
 create mode 100644 sim/testsuite/sim/or1k/mac.S
 create mode 100644 sim/testsuite/sim/or1k/mfspr.S
 create mode 100644 sim/testsuite/sim/or1k/mul.S
 create mode 100644 sim/testsuite/sim/or1k/or.S
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test-env.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test-helpers.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm-test.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-asm.h
 create mode 100644 sim/testsuite/sim/or1k/or1k-test.ld
 create mode 100644 sim/testsuite/sim/or1k/ror.S
 create mode 100644 sim/testsuite/sim/or1k/shift.S
 create mode 100644 sim/testsuite/sim/or1k/spr-defs.h
 create mode 100644 sim/testsuite/sim/or1k/sub.S
 create mode 100644 sim/testsuite/sim/or1k/xor.S
sim/testsuite/configure +4 -0
index bbc3bea48d..e37bdbd8d8 100755
@@ -1888,6 +1888,10 @@ case "${target}" in
    msp430*-*-*)
        sim_arch=msp430
        ;;
+   or1k-*-* | or1knd-*-*)
+       sim_arch=or1k
+       sim_testsuite=yes
+       ;;
    rl78-*-*)
        sim_arch=rl78
        ;;
sim/testsuite/sim/or1k/add.S new file +639 -0

639 lines not on this page · raw message

sim/testsuite/sim/or1k/alltests.exp new file +34 -0
new file mode 100644
index 0000000000..4480590050
@@ -0,0 +1,34 @@
+# OR1K simulator testsuite.
+#
+# Copyright 2017 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if [istarget or1k*-*-*] {
+
+    set all_machs "or1k"
+
+    global global_ld_options
+    set global_ld_options "-T $srcdir/$subdir/or1k-test.ld"
+
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.S]] {
+
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+
+	run_sim_test $src $all_machs
+    }
+
+}
sim/testsuite/sim/or1k/and.S new file +198 -0

198 lines not on this page · raw message

sim/testsuite/sim/or1k/basic.S new file +522 -0

522 lines not on this page · raw message

sim/testsuite/sim/or1k/div.S new file +291 -0

291 lines not on this page · raw message

sim/testsuite/sim/or1k/ext.S new file +236 -0

236 lines not on this page · raw message

sim/testsuite/sim/or1k/find.S new file +100 -0

100 lines not on this page · raw message

sim/testsuite/sim/or1k/flag.S new file +386 -0

386 lines not on this page · raw message

sim/testsuite/sim/or1k/fpu.S new file +129 -0

129 lines not on this page · raw message

sim/testsuite/sim/or1k/jump.S new file +105 -0

105 lines not on this page · raw message

sim/testsuite/sim/or1k/load.S new file +358 -0

350 lines not on this page · raw message

sim/testsuite/sim/or1k/mac.S new file +778 -0

778 lines not on this page · raw message

sim/testsuite/sim/or1k/mfspr.S new file +171 -0

171 lines not on this page · raw message

sim/testsuite/sim/or1k/mul.S new file +574 -0

574 lines not on this page · raw message

sim/testsuite/sim/or1k/or.S new file +199 -0

199 lines not on this page · raw message

sim/testsuite/sim/or1k/or1k-asm-test-env.h new file +59 -0

59 lines not on this page · raw message

sim/testsuite/sim/or1k/or1k-asm-test-helpers.h new file +121 -0

121 lines not on this page · raw message

sim/testsuite/sim/or1k/or1k-asm-test.h new file +226 -0

226 lines not on this page · raw message

sim/testsuite/sim/or1k/or1k-asm.h new file +37 -0
new file mode 100644
index 0000000000..a4f05d8439

Lines of this file are not shown. View the raw message.

sim/testsuite/sim/or1k/or1k-test.ld new file +75 -0

75 lines not on this page · raw message

sim/testsuite/sim/or1k/ror.S new file +159 -0

159 lines not on this page · raw message

sim/testsuite/sim/or1k/shift.S new file +541 -0

541 lines not on this page · raw message

sim/testsuite/sim/or1k/spr-defs.h new file +120 -0

120 lines not on this page · raw message

sim/testsuite/sim/or1k/sub.S new file +215 -0

215 lines not on this page · raw message

sim/testsuite/sim/or1k/xor.S new file +200 -0

200 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.6

Part of the diff is not shown here. View the raw message.

#7 lore raw

v6 cover sim port for OpenRISC

In reply to Stafford Horne
Quoted 11 lines · Stafford Horne

Peter Gavin (3):
sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd])
sim: cgen: add MUL2OFSI and MUL1OFSI functions (needed for OR1K

    l.mul[u])

sim: testsuite: add testsuite for or1k sim

Stafford Horne (3):
sim: or1k: add or1k target to sim
sim: or1k: add cgen generated files
sim: or1k: add autoconf generated files

Hello,

As before the cgen and autoconf generated file patches did not get through, see details.

ezmlm-reject: fatal: Sorry, I don't accept messages larger than 400000 bytes (#5.2.3)

On my system:

-rw-rw-r--. 1 shorne shorne 787935 Oct 13 08:12 v6-0004-sim-or1k-add-cgen-generated-files.patch -rw-rw-r--. 1 shorne shorne 495163 Oct 13 08:12 v6-0005-sim-or1k-add-autoconf-generated-files.patch

If you are interested please pull from:

https://github.com/stffrdhrn/binutils-gdb.git or1k-upstream-gdb-v8-sim-v6

Else I can sent you private zipped copies.

-Stafford