All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests
@ 2018-05-01 14:22 Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/ Bastian Koppelmann
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Hi Alex,

I finally came around converting some of my TriCore regression tests into actual
tests, that don't require the proprietary Infineon simulator.

These tests are heavily inspired by the riscv-tests [1]. I add macros that
allow easy testing of single asm instructions.

e.g. for add %d1, %d2, %d3 this looks like
          insn test_num res  rs1  rs2
           v      v      v    v    v
TEST_D_DD(add,    1,    0x3, 0x1, 0x2)

Each of the macros generates code that loads the operands into registers,
executes the instruction, and finally checks if the result is as expected.
If the expected result does not match, a guest fail handler is called, that
writes the test_num to a testdev. This testdev takes the test_num and returns it
as an status code using exit(). If all tests pass, we jump to a pass handler,
that writes 0 to the testdev.

Unfortunately, I didn't add any switch to run this automatically on 'make check'
or similar, since there is no obvious way to integrate the tricore-binutils [2].

You can find the full tree here:
https://github.com/bkoppelmann/qemu/tree/tcg-tests-tricore

Cheers,
Bastian

[1] https://github.com/riscv/riscv-tests
[2] https://github.com/bkoppelmann/tricore-binutils

Bastian Koppelmann (12):
  hw/tricore: Add testdevice for tests in tests/tcg/
  tests/tcg/tricore: Add build infrastructure
  tests/tcg/tricore: Add macros to easily create tests and first test
    'abs'
  tests/tcg/tricore: Add bmerge test
  tests/tcg/tricore: Add clz test
  tests/tcg/tricore: Add dvstep test
  tests/tcg/tricore: Add fadd test
  tests/tcg/tricore: Add fmul test
  tests/tcg/tricore: Add ftoi test
  tests/tcg/tricore: Add madd test
  tests/tcg/tricore: Add msub test
  tests/tcg/tricore: Add muls test

 hw/tricore/Makefile.objs                |   1 +
 hw/tricore/tricore_testboard.c          |   8 ++
 hw/tricore/tricore_testdevice.c         |  81 ++++++++++++++++++++
 include/hw/tricore/tricore_testdevice.h |  38 ++++++++++
 tests/tcg/tricore/Makefile              |  41 ++++++++++
 tests/tcg/tricore/link.ld               |  60 +++++++++++++++
 tests/tcg/tricore/macros.h              | 129 ++++++++++++++++++++++++++++++++
 tests/tcg/tricore/test_abs.S            |   8 ++
 tests/tcg/tricore/test_bmerge.S         |   8 ++
 tests/tcg/tricore/test_clz.S            |   9 +++
 tests/tcg/tricore/test_dvstep.S         |  15 ++++
 tests/tcg/tricore/test_fadd.S           |  16 ++++
 tests/tcg/tricore/test_fmul.S           |   8 ++
 tests/tcg/tricore/test_ftoi.S           |  10 +++
 tests/tcg/tricore/test_madd.S           |  11 +++
 tests/tcg/tricore/test_msub.S           |   9 +++
 tests/tcg/tricore/test_muls.S           |   9 +++
 17 files changed, 461 insertions(+)
 create mode 100644 hw/tricore/tricore_testdevice.c
 create mode 100644 include/hw/tricore/tricore_testdevice.h
 create mode 100644 tests/tcg/tricore/Makefile
 create mode 100644 tests/tcg/tricore/link.ld
 create mode 100644 tests/tcg/tricore/macros.h
 create mode 100644 tests/tcg/tricore/test_abs.S
 create mode 100644 tests/tcg/tricore/test_bmerge.S
 create mode 100644 tests/tcg/tricore/test_clz.S
 create mode 100644 tests/tcg/tricore/test_dvstep.S
 create mode 100644 tests/tcg/tricore/test_fadd.S
 create mode 100644 tests/tcg/tricore/test_fmul.S
 create mode 100644 tests/tcg/tricore/test_ftoi.S
 create mode 100644 tests/tcg/tricore/test_madd.S
 create mode 100644 tests/tcg/tricore/test_msub.S
 create mode 100644 tests/tcg/tricore/test_muls.S

--
2.11.0

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

* [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-25 16:14   ` Alex Bennée
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure Bastian Koppelmann
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

this device is used to verify the correctness of regression tests by
allowing guests to write their exit status to this device. This is then
used by qemu to exit using the written status.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 hw/tricore/Makefile.objs                |  1 +
 hw/tricore/tricore_testboard.c          |  8 ++++
 hw/tricore/tricore_testdevice.c         | 81 +++++++++++++++++++++++++++++++++
 include/hw/tricore/tricore_testdevice.h | 38 ++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 hw/tricore/tricore_testdevice.c
 create mode 100644 include/hw/tricore/tricore_testdevice.h

diff --git a/hw/tricore/Makefile.objs b/hw/tricore/Makefile.objs
index 435e095cff..9e871a01e2 100644
--- a/hw/tricore/Makefile.objs
+++ b/hw/tricore/Makefile.objs
@@ -1 +1,2 @@
 obj-y += tricore_testboard.o
+obj-y += tricore_testdevice.o
diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
index 8e61dfc3e6..ee0a332e12 100644
--- a/hw/tricore/tricore_testboard.c
+++ b/hw/tricore/tricore_testboard.c
@@ -31,6 +31,7 @@
 #include "exec/address-spaces.h"
 #include "elf.h"
 #include "hw/tricore/tricore.h"
+#include "hw/tricore/tricore_testdevice.h"
 #include "qemu/error-report.h"
 
 
@@ -60,6 +61,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
 {
     TriCoreCPU *cpu;
     CPUTriCoreState *env;
+    TriCoreTestDeviceState *test_dev;
 
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ext_cram = g_new(MemoryRegion, 1);
@@ -91,6 +93,12 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
     memory_region_add_subregion(sysmem, 0xf0050000, pcp_data);
     memory_region_add_subregion(sysmem, 0xf0060000, pcp_text);
 
+    /* test device */
+    test_dev = g_new(TriCoreTestDeviceState, 1);
+    object_initialize(test_dev, sizeof(TriCoreTestDeviceState),
+                      TYPE_TRICORE_TESTDEVICE);
+    memory_region_add_subregion(sysmem, 0xf0000000, &test_dev->iomem);
+
     tricoretb_binfo.ram_size = machine->ram_size;
     tricoretb_binfo.kernel_filename = machine->kernel_filename;
 
diff --git a/hw/tricore/tricore_testdevice.c b/hw/tricore/tricore_testdevice.c
new file mode 100644
index 0000000000..ce4c67fcae
--- /dev/null
+++ b/hw/tricore/tricore_testdevice.c
@@ -0,0 +1,81 @@
+/*
+ *  Copyright (c) 2018 Bastian Koppelmann Paderborn University
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "hw/tricore/tricore_testdevice.h"
+
+static void tricore_testdevice_write(void *opaque, hwaddr offset,
+                                      uint64_t value, unsigned size)
+{
+    exit(value);
+}
+
+static uint64_t tricore_testdevice_read(void *opaque, hwaddr offset,
+                                         unsigned size)
+{
+    return 0xdeadbeef;
+}
+
+static void tricore_testdevice_reset(DeviceState *dev)
+{
+}
+
+static const MemoryRegionOps tricore_testdevice_ops = {
+    .read = tricore_testdevice_read,
+    .write = tricore_testdevice_write,
+    .valid = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+    },
+    .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
+static void tricore_testdevice_init(Object *obj)
+{
+    TriCoreTestDeviceState *s = TRICORE_TESTDEVICE(obj);
+   /* map memory */
+    memory_region_init_io(&s->iomem, OBJECT(s), &tricore_testdevice_ops, s,
+                          "tricore_testdevice", 0x4);
+}
+
+static Property tricore_testdevice_properties[] = {
+    DEFINE_PROP_END_OF_LIST()
+};
+
+static void tricore_testdevice_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = tricore_testdevice_properties;
+    dc->reset = tricore_testdevice_reset;
+}
+
+static const TypeInfo tricore_testdevice_info = {
+    .name          = TYPE_TRICORE_TESTDEVICE,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(TriCoreTestDeviceState),
+    .instance_init = tricore_testdevice_init,
+    .class_init    = tricore_testdevice_class_init,
+};
+
+static void tricore_testdevice_register_types(void)
+{
+    type_register_static(&tricore_testdevice_info);
+}
+
+type_init(tricore_testdevice_register_types)
diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/tricore_testdevice.h
new file mode 100644
index 0000000000..5b2df219e3
--- /dev/null
+++ b/include/hw/tricore/tricore_testdevice.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2018  Bastian Koppelmann Paderborn University
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef HW_TRICORE_TESTDEV_H
+#define HW_TRICORE_TESTDEV_H
+
+#include "hw/sysbus.h"
+#include "hw/hw.h"
+
+#define TYPE_TRICORE_TESTDEVICE "tricore_testdevice"
+#define TRICORE_TESTDEVICE(obj) \
+    OBJECT_CHECK(TriCoreTestDeviceState, (obj), TYPE_TRICORE_TESTDEVICE)
+
+typedef struct {
+    /* <private> */
+    SysBusDevice parent_obj;
+
+    /* <public> */
+    MemoryRegion iomem;
+
+} TriCoreTestDeviceState;
+
+#endif
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/ Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 15:40   ` Alex Bennée
  2018-05-02  0:41   ` Philippe Mathieu-Daudé
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 03/12] tests/tcg/tricore: Add macros to easily create tests and first test 'abs' Bastian Koppelmann
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

this includes the Makefile and linker script to build all the tests.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
 tests/tcg/tricore/link.ld  | 60 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 tests/tcg/tricore/Makefile
 create mode 100644 tests/tcg/tricore/link.ld

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
new file mode 100644
index 0000000000..8c168d1062
--- /dev/null
+++ b/tests/tcg/tricore/Makefile
@@ -0,0 +1,30 @@
+AS := tricore-as
+LD := tricore-ld
+HOST_CC = gcc
+
+LDFLAGS = -Tlink.ld
+ASFLAGS =
+
+SIM = ../../../tricore-softmmu/qemu-system-tricore
+SIMFLAGS = -M tricore_testboard -nographic -kernel
+
+all: build
+
+%.pS: %.S
+	$(HOST_CC) -E -o $@ $<
+
+%.o: %.pS
+	$(AS) $(ASFLAGS) -o $@ $<
+
+%.tst: %.o link.ld
+	$(LD) $(LDFLAGS) $< -o $@
+
+build: $(TESTCASES)
+
+check: $(addprefix run-, $(TESTCASES))
+
+run-%.tst: %.tst
+	$(SIM) $(SIMFLAGS) ./$<
+
+clean:
+	$(RM) -fr $(TESTCASES) linker.ld
diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld
new file mode 100644
index 0000000000..364bcdc00a
--- /dev/null
+++ b/tests/tcg/tricore/link.ld
@@ -0,0 +1,60 @@
+/* Default linker script, for normal executables */
+OUTPUT_FORMAT("elf32-tricore")
+OUTPUT_ARCH(tricore)
+ENTRY(_start)
+
+/* the internal ram description */
+MEMORY
+{
+  text_ram (rx!p): org = 0x80000000, len = 15K
+  data_ram (w!xp): org = 0xd0000000, len = 130K
+}
+/*
+ * Define the sizes of the user and system stacks.
+ */
+__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ;
+/*
+ * Define the start address and the size of the context save area.
+ */
+__CSA_BEGIN =  0xd0000000 ;
+__CSA_SIZE =  8k ;
+__CSA_END = __CSA_BEGIN + __CSA_SIZE ;
+
+SECTIONS
+{
+  .text  :
+  {
+    *(.text)
+    . = ALIGN(8);
+  } > text_ram
+
+  .rodata :
+  {
+    *(.rodata)
+    *(.rodata1)
+  } > data_ram
+
+  .data :
+  {
+    . = ALIGN(8) ;
+    *(.data)
+    *(.data.*)
+    . = ALIGN(8) ;
+    __USTACK = . + __USTACK_SIZE -768;
+
+  } > data_ram
+  /*
+   * Allocate space for BSS sections.
+   */
+  .bss  :
+  {
+    BSS_BASE = . ;
+    *(.bss)
+    *(COMMON)
+    . = ALIGN(8) ;
+  } > data_ram
+  /* Make sure CSA, stack and heap addresses are properly aligned.  */
+  _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ;
+  _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ;
+
+}
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 03/12] tests/tcg/tricore: Add macros to easily create tests and first test 'abs'
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/ Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 04/12] tests/tcg/tricore: Add bmerge test Bastian Koppelmann
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

This kind of tests is inspired by the riscv-tests repository. This adds
macros that makes it easy to create single instruction self containing
tests.

This is achieved by macros that create a test sequence for an
instruction and check for a supplied correct value. If the value is correct the
next instruction is tested. Otherwise we jump to fail handler that writes is
test number as a status code back to qemu that then exits on that status code.
If all tests pass we write back 0 as a status code and exit.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile   |  2 ++
 tests/tcg/tricore/macros.h   | 53 ++++++++++++++++++++++++++++++++++++++++++++
 tests/tcg/tricore/test_abs.S |  8 +++++++
 3 files changed, 63 insertions(+)
 create mode 100644 tests/tcg/tricore/macros.h
 create mode 100644 tests/tcg/tricore/test_abs.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 8c168d1062..a0e1f4b20d 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -8,6 +8,8 @@ ASFLAGS =
 SIM = ../../../tricore-softmmu/qemu-system-tricore
 SIMFLAGS = -M tricore_testboard -nographic -kernel
 
+TESTCASES += test_abs.tst
+
 all: build
 
 %.pS: %.S
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
new file mode 100644
index 0000000000..76c133132a
--- /dev/null
+++ b/tests/tcg/tricore/macros.h
@@ -0,0 +1,53 @@
+/* Helpers */
+#define LI(reg, val)           \
+    mov.u reg, lo:val;         \
+    movh DREG_TEMP_LI, up:val; \
+    or reg, reg, DREG_TEMP_LI; \
+
+/* Address definitions */
+#define TESTDEV_ADDR 0xf0000000
+/* Register definitions */
+#define DREG_RS1 %d0
+#define DREG_CALC_RESULT %d1
+#define DREG_TEMP_LI %d10
+#define DREG_TEMP %d11
+#define DREG_TEST_NUM %d14
+#define DREG_CORRECT_RESULT %d15
+
+#define DREG_DEV_ADDR %a15
+
+/* Test case wrappers */
+#define TEST_CASE(num, testreg, correct, code...) \
+test_ ## num:                                     \
+    code;                                         \
+    LI(DREG_CORRECT_RESULT, correct)              \
+    mov DREG_TEST_NUM, num;                       \
+    jne testreg, DREG_CORRECT_RESULT, fail        \
+
+/* Actual test case type
+ * e.g inst %dX, %dY      -> TEST_D_D
+ *     inst %dX, %dY, %dZ -> TEST_D_DD
+ *     inst %eX, %dY, %dZ -> TEST_E_DD
+ */
+#define TEST_D_D(insn, num, result, rs1)      \
+    TEST_CASE(num, DREG_CALC_RESULT, result,  \
+    LI(DREG_RS1, rs1);                        \
+    insn DREG_CALC_RESULT, DREG_RS1;          \
+    )
+
+/* Pass/Fail handling part */
+#define TEST_PASSFAIL                       \
+        j pass;                             \
+fail:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j fail;                             \
+pass:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        mov DREG_TEST_NUM, 0;               \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j pass;
diff --git a/tests/tcg/tricore/test_abs.S b/tests/tcg/tricore/test_abs.S
new file mode 100644
index 0000000000..acc143901c
--- /dev/null
+++ b/tests/tcg/tricore/test_abs.S
@@ -0,0 +1,8 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_D(abs, 1, 0, 0)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 04/12] tests/tcg/tricore: Add bmerge test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (2 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 03/12] tests/tcg/tricore: Add macros to easily create tests and first test 'abs' Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 05/12] tests/tcg/tricore: Add clz test Bastian Koppelmann
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile      |  1 +
 tests/tcg/tricore/macros.h      | 24 ++++++++++++++++++++++++
 tests/tcg/tricore/test_bmerge.S |  8 ++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 tests/tcg/tricore/test_bmerge.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index a0e1f4b20d..34c91dccf5 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -9,6 +9,7 @@ SIM = ../../../tricore-softmmu/qemu-system-tricore
 SIMFLAGS = -M tricore_testboard -nographic -kernel
 
 TESTCASES += test_abs.tst
+TESTCASES += test_bmerge.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
index 76c133132a..52aa936c56 100644
--- a/tests/tcg/tricore/macros.h
+++ b/tests/tcg/tricore/macros.h
@@ -8,7 +8,10 @@
 #define TESTDEV_ADDR 0xf0000000
 /* Register definitions */
 #define DREG_RS1 %d0
+#define DREG_RS2 %d1
 #define DREG_CALC_RESULT %d1
+#define DREG_CALC_PSW %d2
+#define DREG_CORRECT_PSW %d3
 #define DREG_TEMP_LI %d10
 #define DREG_TEMP %d11
 #define DREG_TEST_NUM %d14
@@ -24,6 +27,17 @@ test_ ## num:                                     \
     mov DREG_TEST_NUM, num;                       \
     jne testreg, DREG_CORRECT_RESULT, fail        \
 
+#define TEST_CASE_PSW(num, testreg, correct, correct_psw, code...) \
+test_ ## num:                                                      \
+    code;                                                          \
+    LI(DREG_CORRECT_RESULT, correct)                               \
+    mov DREG_TEST_NUM, num;                                        \
+    jne testreg, DREG_CORRECT_RESULT, fail;                        \
+    mfcr DREG_CALC_PSW, $psw;                                      \
+    LI(DREG_CORRECT_PSW, correct_psw)                              \
+    mov DREG_TEST_NUM, num;                                        \
+    jne DREG_CALC_PSW, DREG_CORRECT_PSW, fail;
+
 /* Actual test case type
  * e.g inst %dX, %dY      -> TEST_D_D
  *     inst %dX, %dY, %dZ -> TEST_D_DD
@@ -35,6 +49,16 @@ test_ ## num:                                     \
     insn DREG_CALC_RESULT, DREG_RS1;          \
     )
 
+#define TEST_D_DD_PSW(insn, num, result, psw, rs1, rs2) \
+    TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw,   \
+    LI(DREG_RS1, rs1);                                  \
+    LI(DREG_RS2, rs2);                                  \
+    rstv;                                               \
+    insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2;          \
+    )
+
+
+
 /* Pass/Fail handling part */
 #define TEST_PASSFAIL                       \
         j pass;                             \
diff --git a/tests/tcg/tricore/test_bmerge.S b/tests/tcg/tricore/test_bmerge.S
new file mode 100644
index 0000000000..8a0fa6d3f6
--- /dev/null
+++ b/tests/tcg/tricore/test_bmerge.S
@@ -0,0 +1,8 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DD_PSW(bmerge, 1, 0x555557f7, 0x00000b80, 0x0000001d, 0x0000ffff)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 05/12] tests/tcg/tricore: Add clz test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (3 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 04/12] tests/tcg/tricore: Add bmerge test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 06/12] tests/tcg/tricore: Add dvstep test Bastian Koppelmann
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile   | 1 +
 tests/tcg/tricore/test_clz.S | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/tcg/tricore/test_clz.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 34c91dccf5..16ec5460d7 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -10,6 +10,7 @@ SIMFLAGS = -M tricore_testboard -nographic -kernel
 
 TESTCASES += test_abs.tst
 TESTCASES += test_bmerge.tst
+TESTCASES += test_clz.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/test_clz.S b/tests/tcg/tricore/test_clz.S
new file mode 100644
index 0000000000..e03835f123
--- /dev/null
+++ b/tests/tcg/tricore/test_clz.S
@@ -0,0 +1,9 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_D(cls.h, 1, 0x0, 0x6db17976)
+    TEST_D_D(cls.h, 2, 0x000f000f, 0x0)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 06/12] tests/tcg/tricore: Add dvstep test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (4 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 05/12] tests/tcg/tricore: Add clz test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 07/12] tests/tcg/tricore: Add fadd test Bastian Koppelmann
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile      |  1 +
 tests/tcg/tricore/macros.h      | 29 ++++++++++++++++++++++++++++-
 tests/tcg/tricore/test_dvstep.S | 15 +++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/tricore/test_dvstep.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 16ec5460d7..36f15a7544 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -11,6 +11,7 @@ SIMFLAGS = -M tricore_testboard -nographic -kernel
 TESTCASES += test_abs.tst
 TESTCASES += test_bmerge.tst
 TESTCASES += test_clz.tst
+TESTCASES += test_dvstep.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
index 52aa936c56..59b4b9a352 100644
--- a/tests/tcg/tricore/macros.h
+++ b/tests/tcg/tricore/macros.h
@@ -19,6 +19,18 @@
 
 #define DREG_DEV_ADDR %a15
 
+#define EREG_RS1 %e6
+#define EREG_RS1_LO %d6
+#define EREG_RS1_HI %d7
+#define EREG_RS2 %e8
+#define EREG_RS2_LO %d8
+#define EREG_RS2_HI %d9
+#define EREG_CALC_RESULT %e8
+#define EREG_CALC_RESULT_HI %d9
+#define EREG_CALC_RESULT_LO %d8
+#define EREG_CORRECT_RESULT_LO %d0
+#define EREG_CORRECT_RESULT_HI %d1
+
 /* Test case wrappers */
 #define TEST_CASE(num, testreg, correct, code...) \
 test_ ## num:                                     \
@@ -27,6 +39,15 @@ test_ ## num:                                     \
     mov DREG_TEST_NUM, num;                       \
     jne testreg, DREG_CORRECT_RESULT, fail        \
 
+#define TEST_CASE_E(num, correct_lo, correct_hi, code...)  \
+test_ ## num:                                              \
+    code;                                                  \
+    mov DREG_TEST_NUM, num;                                \
+    LI(EREG_CORRECT_RESULT_LO, correct_lo)                 \
+    jne EREG_CALC_RESULT_LO, EREG_CORRECT_RESULT_LO, fail; \
+    LI(EREG_CORRECT_RESULT_HI, correct_hi)                 \
+    jne EREG_CALC_RESULT_HI, EREG_CORRECT_RESULT_HI, fail;
+
 #define TEST_CASE_PSW(num, testreg, correct, correct_psw, code...) \
 test_ ## num:                                                      \
     code;                                                          \
@@ -57,7 +78,13 @@ test_ ## num:                                                      \
     insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2;          \
     )
 
-
+#define TEST_E_ED(insn, num, res_hi, res_lo, rs1_hi, rs1_lo, rs2) \
+    TEST_CASE_E(num, res_lo, res_hi,                              \
+    LI(EREG_RS1_LO, rs1_lo);                                      \
+    LI(EREG_RS1_HI, rs1_hi);                                      \
+    LI(DREG_RS2, rs2);                                            \
+    insn EREG_CALC_RESULT, EREG_RS1, DREG_RS2;                    \
+    )
 
 /* Pass/Fail handling part */
 #define TEST_PASSFAIL                       \
diff --git a/tests/tcg/tricore/test_dvstep.S b/tests/tcg/tricore/test_dvstep.S
new file mode 100644
index 0000000000..858dbc62dd
--- /dev/null
+++ b/tests/tcg/tricore/test_dvstep.S
@@ -0,0 +1,15 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    #                              Result                   RS1            RS2
+    TEST_E_ED(dvstep,   1, 0x000001ff, 0xfffe5cff, 0x00000001, 0xfffffe5c, 0x0)
+    TEST_E_ED(dvstep,   2, 0x00000000, 0x000000ff, 0x00000000, 0x00000000, 0x0)
+    TEST_E_ED(dvstep,   3, 0x0000f000, 0x000000fd, 0x010000f0, 0x00000000, 0x0)
+    TEST_E_ED(dvstep,   4, 0xfffff000, 0x00000000, 0x7ffffff0, 0x00000000, 0x0)
+    TEST_E_ED(dvstep.u, 5, 0xffffff00, 0x100008ff, 0xffffffff, 0x00100008, 0x0)
+    TEST_E_ED(dvstep.u, 6, 0x00000100, 0x00000000, 0x08000001, 0x00000000, \
+                           0xffffff2d)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 07/12] tests/tcg/tricore: Add fadd test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (5 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 06/12] tests/tcg/tricore: Add dvstep test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 08/12] tests/tcg/tricore: Add fmul test Bastian Koppelmann
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    |  1 +
 tests/tcg/tricore/test_fadd.S | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 tests/tcg/tricore/test_fadd.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 36f15a7544..ba0514bfa3 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -12,6 +12,7 @@ TESTCASES += test_abs.tst
 TESTCASES += test_bmerge.tst
 TESTCASES += test_clz.tst
 TESTCASES += test_dvstep.tst
+TESTCASES += test_fadd.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/test_fadd.S b/tests/tcg/tricore/test_fadd.S
new file mode 100644
index 0000000000..1a65054803
--- /dev/null
+++ b/tests/tcg/tricore/test_fadd.S
@@ -0,0 +1,16 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DD_PSW(add.f, 1, 0x7fc00000, 0x00000b80, 0xffffff85, 0x00001234)
+    TEST_D_DD_PSW(add.f, 2, 0xf9c00000, 0x00000b80, 0xf9400000, 0xf9400000)
+    TEST_D_DD_PSW(add.f, 3, 0x8bb858ca, 0x00000b80, 0x8b3858ca, 0x8b3858ca)
+    TEST_D_DD_PSW(add.f, 4, 0x00000000, 0x00000b80, 0x000000ff, 0x00000000)
+    TEST_D_DD_PSW(add.f, 5, 0x7fc00000, 0x00000b80, 0xfffffe52, 0x0a4cf70c)
+    TEST_D_DD_PSW(add.f, 6, 0x9e6d5076, 0x84000b80, 0x9ded50ec, 0x9ded4fff)
+    TEST_D_DD_PSW(add.f, 7, 0x00000000, 0x04000b80, 0x0000e8bd, 0x00000000)
+    TEST_D_DD_PSW(add.f, 8, 0x7fc00000, 0xc4000b80, 0xffad546e, 0xffad546e)
+    TEST_D_DD_PSW(add.f, 9, 0x7fc00000, 0x04000b80, 0xfffe0000, 0x08130000)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 08/12] tests/tcg/tricore: Add fmul test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (6 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 07/12] tests/tcg/tricore: Add fadd test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 09/12] tests/tcg/tricore: Add ftoi test Bastian Koppelmann
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    | 1 +
 tests/tcg/tricore/test_fmul.S | 8 ++++++++
 2 files changed, 9 insertions(+)
 create mode 100644 tests/tcg/tricore/test_fmul.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index ba0514bfa3..5e2a450892 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -13,6 +13,7 @@ TESTCASES += test_bmerge.tst
 TESTCASES += test_clz.tst
 TESTCASES += test_dvstep.tst
 TESTCASES += test_fadd.tst
+TESTCASES += test_fmul.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/test_fmul.S b/tests/tcg/tricore/test_fmul.S
new file mode 100644
index 0000000000..fb1f634b2d
--- /dev/null
+++ b/tests/tcg/tricore/test_fmul.S
@@ -0,0 +1,8 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DD_PSW(mul.f, 1, 0x974f4f0a, 0x84000b80, 0x1a0b1980, 0xbcbec42d)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 09/12] tests/tcg/tricore: Add ftoi test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (7 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 08/12] tests/tcg/tricore: Add fmul test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 10/12] tests/tcg/tricore: Add madd test Bastian Koppelmann
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    |  1 +
 tests/tcg/tricore/macros.h    |  7 +++++++
 tests/tcg/tricore/test_ftoi.S | 10 ++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 tests/tcg/tricore/test_ftoi.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 5e2a450892..c3c7c59065 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -14,6 +14,7 @@ TESTCASES += test_clz.tst
 TESTCASES += test_dvstep.tst
 TESTCASES += test_fadd.tst
 TESTCASES += test_fmul.tst
+TESTCASES += test_ftoi.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
index 59b4b9a352..e6a41cd1a2 100644
--- a/tests/tcg/tricore/macros.h
+++ b/tests/tcg/tricore/macros.h
@@ -70,6 +70,13 @@ test_ ## num:                                                      \
     insn DREG_CALC_RESULT, DREG_RS1;          \
     )
 
+#define TEST_D_D_PSW(insn, num, result, psw, rs1)     \
+    TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw, \
+    LI(DREG_RS1, rs1);                                \
+    rstv;                                             \
+    insn DREG_CORRECT_RESULT, DREG_RS1;               \
+    )
+
 #define TEST_D_DD_PSW(insn, num, result, psw, rs1, rs2) \
     TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw,   \
     LI(DREG_RS1, rs1);                                  \
diff --git a/tests/tcg/tricore/test_ftoi.S b/tests/tcg/tricore/test_ftoi.S
new file mode 100644
index 0000000000..fb4af6b5aa
--- /dev/null
+++ b/tests/tcg/tricore/test_ftoi.S
@@ -0,0 +1,10 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_D_PSW(ftoi, 1, 0x0, 0x84000b80, 0x05f6e605)
+    TEST_D_D_PSW(ftoi, 2, 0x0, 0x04000b80, 0x00012200)
+    TEST_D_D_PSW(ftoi, 3, 0x0, 0xc4000b80, 0xffffffff)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 10/12] tests/tcg/tricore: Add madd test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (8 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 09/12] tests/tcg/tricore: Add ftoi test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 11/12] tests/tcg/tricore: Add msub test Bastian Koppelmann
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    |  1 +
 tests/tcg/tricore/macros.h    | 18 ++++++++++++++++++
 tests/tcg/tricore/test_madd.S | 11 +++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 tests/tcg/tricore/test_madd.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index c3c7c59065..2d32ec3077 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -15,6 +15,7 @@ TESTCASES += test_dvstep.tst
 TESTCASES += test_fadd.tst
 TESTCASES += test_fmul.tst
 TESTCASES += test_ftoi.tst
+TESTCASES += test_madd.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
index e6a41cd1a2..0d76fc403a 100644
--- a/tests/tcg/tricore/macros.h
+++ b/tests/tcg/tricore/macros.h
@@ -9,6 +9,7 @@
 /* Register definitions */
 #define DREG_RS1 %d0
 #define DREG_RS2 %d1
+#define DREG_RS3 %d4
 #define DREG_CALC_RESULT %d1
 #define DREG_CALC_PSW %d2
 #define DREG_CORRECT_PSW %d3
@@ -85,6 +86,23 @@ test_ ## num:                                                      \
     insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2;          \
     )
 
+#define TEST_D_DDD_PSW(insn, num, result, psw, rs1, rs2, rs3) \
+    TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw,         \
+    LI(DREG_RS1, rs1);                                        \
+    LI(DREG_RS2, rs2);                                        \
+    LI(DREG_RS3, rs3);                                        \
+    rstv;                                                     \
+    insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2, DREG_RS3;      \
+    )
+
+#define TEST_D_DDI_PSW(insn, num, result, psw, rs1, rs2, imm) \
+    TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw,         \
+    LI(DREG_RS1, rs1);                                        \
+    LI(DREG_RS2, rs2);                                        \
+    rstv;                                                     \
+    insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2, imm;           \
+    )
+
 #define TEST_E_ED(insn, num, res_hi, res_lo, rs1_hi, rs1_lo, rs2) \
     TEST_CASE_E(num, res_lo, res_hi,                              \
     LI(EREG_RS1_LO, rs1_lo);                                      \
diff --git a/tests/tcg/tricore/test_madd.S b/tests/tcg/tricore/test_madd.S
new file mode 100644
index 0000000000..5d839772bb
--- /dev/null
+++ b/tests/tcg/tricore/test_madd.S
@@ -0,0 +1,11 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DDI_PSW(madd,    1, 0x0000fffd, 0x60000b80, 0x0000ffff, 0x7fffffff,2)
+    TEST_D_DDI_PSW(madd,    2, 0xffff7fff, 0x60000b80, 0xffff8001, 0x7fffffff,2)
+    TEST_D_DDD_PSW(madds.u, 3, 0xffffffff, 0x60000b80, 0x00000000, 0x80000000, \
+                             0x80000000)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 11/12] tests/tcg/tricore: Add msub test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (9 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 10/12] tests/tcg/tricore: Add madd test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 12/12] tests/tcg/tricore: Add muls test Bastian Koppelmann
  2018-05-01 14:35 ` [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests no-reply
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    | 1 +
 tests/tcg/tricore/test_msub.S | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/tcg/tricore/test_msub.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index 2d32ec3077..e3113b726c 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -16,6 +16,7 @@ TESTCASES += test_fadd.tst
 TESTCASES += test_fmul.tst
 TESTCASES += test_ftoi.tst
 TESTCASES += test_madd.tst
+TESTCASES += test_msub.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/test_msub.S b/tests/tcg/tricore/test_msub.S
new file mode 100644
index 0000000000..6dee87d99c
--- /dev/null
+++ b/tests/tcg/tricore/test_msub.S
@@ -0,0 +1,9 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DDI_PSW(msub, 1, 0xd2fbe5e0, 0x00000b80,0x64003300, 0xff5420d4, -216)
+    TEST_D_DDI_PSW(msub, 2, 0xfffffc10, 0x00000b80,0xfffffe68, 0xfffffffd, -200)
+    TEST_D_DDD_PSW(msubs.u, 3, 0x0, 0x60000b80, 0x1, 0xffffffff, 0xffffffdb)
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* [Qemu-devel] [RFC PATCH 12/12] tests/tcg/tricore: Add muls test
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (10 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 11/12] tests/tcg/tricore: Add msub test Bastian Koppelmann
@ 2018-05-01 14:22 ` Bastian Koppelmann
  2018-05-01 14:35 ` [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests no-reply
  12 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-01 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 tests/tcg/tricore/Makefile    | 1 +
 tests/tcg/tricore/test_muls.S | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/tcg/tricore/test_muls.S

diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
index e3113b726c..37c3101e4d 100644
--- a/tests/tcg/tricore/Makefile
+++ b/tests/tcg/tricore/Makefile
@@ -17,6 +17,7 @@ TESTCASES += test_fmul.tst
 TESTCASES += test_ftoi.tst
 TESTCASES += test_madd.tst
 TESTCASES += test_msub.tst
+TESTCASES += test_muls.tst
 
 all: build
 
diff --git a/tests/tcg/tricore/test_muls.S b/tests/tcg/tricore/test_muls.S
new file mode 100644
index 0000000000..ca517556bc
--- /dev/null
+++ b/tests/tcg/tricore/test_muls.S
@@ -0,0 +1,9 @@
+#include "macros.h"
+.text
+.global _start
+_start:
+    TEST_D_DD_PSW(muls.u, 1, 0xffffffff, 0x78000b80, 0x80000001, 0xffffffff)
+    TEST_D_DD_PSW(muls.u, 2, 0xffffffff, 0x60000b80, 0xfffffffe, 0xffffffff)
+
+    TEST_PASSFAIL
+
-- 
2.11.0

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

* Re: [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests
  2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
                   ` (11 preceding siblings ...)
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 12/12] tests/tcg/tricore: Add muls test Bastian Koppelmann
@ 2018-05-01 14:35 ` no-reply
  12 siblings, 0 replies; 21+ messages in thread
From: no-reply @ 2018-05-01 14:35 UTC (permalink / raw)
  To: kbastian; +Cc: famz, qemu-devel, alex.bennee

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180501142222.19154-1-kbastian@mail.uni-paderborn.de
Subject: [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20180501142222.19154-1-kbastian@mail.uni-paderborn.de -> patchew/20180501142222.19154-1-kbastian@mail.uni-paderborn.de
Switched to a new branch 'test'
aeec842144 tests/tcg/tricore: Add muls test
6d9e6882a0 tests/tcg/tricore: Add msub test
0569179058 tests/tcg/tricore: Add madd test
90620430a7 tests/tcg/tricore: Add ftoi test
c215189a5a tests/tcg/tricore: Add fmul test
81b70bf1cb tests/tcg/tricore: Add fadd test
588937f8e2 tests/tcg/tricore: Add dvstep test
396fef25f9 tests/tcg/tricore: Add clz test
fca4381f18 tests/tcg/tricore: Add bmerge test
0fe50ea8b1 tests/tcg/tricore: Add macros to easily create tests and first test 'abs'
bc19b6ac7f tests/tcg/tricore: Add build infrastructure
cdca3a5537 hw/tricore: Add testdevice for tests in tests/tcg/

=== OUTPUT BEGIN ===
Checking PATCH 1/12: hw/tricore: Add testdevice for tests in tests/tcg/...
Checking PATCH 2/12: tests/tcg/tricore: Add build infrastructure...
Checking PATCH 3/12: tests/tcg/tricore: Add macros to easily create tests and first test 'abs'...
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#40: FILE: tests/tcg/tricore/macros.h:2:
+#define LI(reg, val)           \
+    mov.u reg, lo:val;         \
+    movh DREG_TEMP_LI, up:val; \
+    or reg, reg, DREG_TEMP_LI; \
+

ERROR: spaces required around that ':' (ctx:VxV)
#41: FILE: tests/tcg/tricore/macros.h:3:
+    mov.u reg, lo:val;         \
                  ^

ERROR: spaces required around that ':' (ctx:VxV)
#42: FILE: tests/tcg/tricore/macros.h:4:
+    movh DREG_TEMP_LI, up:val; \
                          ^

ERROR: spaces required around that '%' (ctx:WxV)
#48: FILE: tests/tcg/tricore/macros.h:10:
+#define DREG_RS1 %d0
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#48: FILE: tests/tcg/tricore/macros.h:10:
+#define DREG_RS1 %d0

ERROR: spaces required around that '%' (ctx:WxV)
#49: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_CALC_RESULT %d1
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#49: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_CALC_RESULT %d1

ERROR: spaces required around that '%' (ctx:WxV)
#50: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_TEMP_LI %d10
                      ^

ERROR: Macros with complex values should be enclosed in parenthesis
#50: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_TEMP_LI %d10

ERROR: spaces required around that '%' (ctx:WxV)
#51: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_TEMP %d11
                   ^

ERROR: Macros with complex values should be enclosed in parenthesis
#51: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_TEMP %d11

ERROR: spaces required around that '%' (ctx:WxV)
#52: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_TEST_NUM %d14
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#52: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_TEST_NUM %d14

ERROR: spaces required around that '%' (ctx:WxV)
#53: FILE: tests/tcg/tricore/macros.h:15:
+#define DREG_CORRECT_RESULT %d15
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#53: FILE: tests/tcg/tricore/macros.h:15:
+#define DREG_CORRECT_RESULT %d15

ERROR: spaces required around that '%' (ctx:WxV)
#55: FILE: tests/tcg/tricore/macros.h:17:
+#define DREG_DEV_ADDR %a15
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#55: FILE: tests/tcg/tricore/macros.h:17:
+#define DREG_DEV_ADDR %a15

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#58: FILE: tests/tcg/tricore/macros.h:20:
+#define TEST_CASE(num, testreg, correct, code...) \
+test_ ## num:                                     \
+    code;                                         \
+    LI(DREG_CORRECT_RESULT, correct)              \
+    mov DREG_TEST_NUM, num;                       \
+    jne testreg, DREG_CORRECT_RESULT, fail        \
+

ERROR: spaces required around that ':' (ctx:VxE)
#59: FILE: tests/tcg/tricore/macros.h:21:
+test_ ## num:                                     \
             ^

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#77: FILE: tests/tcg/tricore/macros.h:39:
+#define TEST_PASSFAIL                       \
+        j pass;                             \
+fail:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j fail;                             \
+pass:                                       \
+        LI(DREG_TEMP, TESTDEV_ADDR)         \
+        mov.a DREG_DEV_ADDR, DREG_TEMP;     \
+        mov DREG_TEST_NUM, 0;               \
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
+        debug;                              \
+        j pass;

ERROR: space prohibited before open square bracket '['
#82: FILE: tests/tcg/tricore/macros.h:44:
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\

ERROR: space prohibited before open square bracket '['
#89: FILE: tests/tcg/tricore/macros.h:51:
+        st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\

total: 22 errors, 0 warnings, 69 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 4/12: tests/tcg/tricore: Add bmerge test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_RS2 %d1
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:11:
+#define DREG_RS2 %d1

ERROR: spaces required around that '%' (ctx:WxV)
#31: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_CALC_PSW %d2
                       ^

ERROR: Macros with complex values should be enclosed in parenthesis
#31: FILE: tests/tcg/tricore/macros.h:13:
+#define DREG_CALC_PSW %d2

ERROR: spaces required around that '%' (ctx:WxV)
#32: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_CORRECT_PSW %d3
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#32: FILE: tests/tcg/tricore/macros.h:14:
+#define DREG_CORRECT_PSW %d3

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#40: FILE: tests/tcg/tricore/macros.h:30:
+#define TEST_CASE_PSW(num, testreg, correct, correct_psw, code...) \
+test_ ## num:                                                      \
+    code;                                                          \
+    LI(DREG_CORRECT_RESULT, correct)                               \
+    mov DREG_TEST_NUM, num;                                        \
+    jne testreg, DREG_CORRECT_RESULT, fail;                        \
+    mfcr DREG_CALC_PSW, $psw;                                      \
+    LI(DREG_CORRECT_PSW, correct_psw)                              \
+    mov DREG_TEST_NUM, num;                                        \
+    jne DREG_CALC_PSW, DREG_CORRECT_PSW, fail;

ERROR: spaces required around that ':' (ctx:VxE)
#41: FILE: tests/tcg/tricore/macros.h:31:
+test_ ## num:                                                      \
             ^

total: 8 errors, 0 warnings, 58 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/12: tests/tcg/tricore: Add clz test...
Checking PATCH 6/12: tests/tcg/tricore: Add dvstep test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:22:
+#define EREG_RS1 %e6
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:22:
+#define EREG_RS1 %e6

ERROR: spaces required around that '%' (ctx:WxV)
#30: FILE: tests/tcg/tricore/macros.h:23:
+#define EREG_RS1_LO %d6
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#30: FILE: tests/tcg/tricore/macros.h:23:
+#define EREG_RS1_LO %d6

ERROR: spaces required around that '%' (ctx:WxV)
#31: FILE: tests/tcg/tricore/macros.h:24:
+#define EREG_RS1_HI %d7
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#31: FILE: tests/tcg/tricore/macros.h:24:
+#define EREG_RS1_HI %d7

ERROR: spaces required around that '%' (ctx:WxV)
#32: FILE: tests/tcg/tricore/macros.h:25:
+#define EREG_RS2 %e8
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#32: FILE: tests/tcg/tricore/macros.h:25:
+#define EREG_RS2 %e8

ERROR: spaces required around that '%' (ctx:WxV)
#33: FILE: tests/tcg/tricore/macros.h:26:
+#define EREG_RS2_LO %d8
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#33: FILE: tests/tcg/tricore/macros.h:26:
+#define EREG_RS2_LO %d8

ERROR: spaces required around that '%' (ctx:WxV)
#34: FILE: tests/tcg/tricore/macros.h:27:
+#define EREG_RS2_HI %d9
                     ^

ERROR: Macros with complex values should be enclosed in parenthesis
#34: FILE: tests/tcg/tricore/macros.h:27:
+#define EREG_RS2_HI %d9

ERROR: spaces required around that '%' (ctx:WxV)
#35: FILE: tests/tcg/tricore/macros.h:28:
+#define EREG_CALC_RESULT %e8
                          ^

ERROR: Macros with complex values should be enclosed in parenthesis
#35: FILE: tests/tcg/tricore/macros.h:28:
+#define EREG_CALC_RESULT %e8

ERROR: spaces required around that '%' (ctx:WxV)
#36: FILE: tests/tcg/tricore/macros.h:29:
+#define EREG_CALC_RESULT_HI %d9
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#36: FILE: tests/tcg/tricore/macros.h:29:
+#define EREG_CALC_RESULT_HI %d9

ERROR: spaces required around that '%' (ctx:WxV)
#37: FILE: tests/tcg/tricore/macros.h:30:
+#define EREG_CALC_RESULT_LO %d8
                             ^

ERROR: Macros with complex values should be enclosed in parenthesis
#37: FILE: tests/tcg/tricore/macros.h:30:
+#define EREG_CALC_RESULT_LO %d8

ERROR: spaces required around that '%' (ctx:WxV)
#38: FILE: tests/tcg/tricore/macros.h:31:
+#define EREG_CORRECT_RESULT_LO %d0
                                ^

ERROR: Macros with complex values should be enclosed in parenthesis
#38: FILE: tests/tcg/tricore/macros.h:31:
+#define EREG_CORRECT_RESULT_LO %d0

ERROR: spaces required around that '%' (ctx:WxV)
#39: FILE: tests/tcg/tricore/macros.h:32:
+#define EREG_CORRECT_RESULT_HI %d1
                                ^

ERROR: Macros with complex values should be enclosed in parenthesis
#39: FILE: tests/tcg/tricore/macros.h:32:
+#define EREG_CORRECT_RESULT_HI %d1

ERROR: spaces required around that ':' (ctx:VxE)
#49: FILE: tests/tcg/tricore/macros.h:43:
+test_ ## num:                                              \
             ^

total: 23 errors, 0 warnings, 69 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 7/12: tests/tcg/tricore: Add fadd test...
Checking PATCH 8/12: tests/tcg/tricore: Add fmul test...
Checking PATCH 9/12: tests/tcg/tricore: Add ftoi test...
Checking PATCH 10/12: tests/tcg/tricore: Add madd test...
ERROR: spaces required around that '%' (ctx:WxV)
#29: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_RS3 %d4
                  ^

ERROR: Macros with complex values should be enclosed in parenthesis
#29: FILE: tests/tcg/tricore/macros.h:12:
+#define DREG_RS3 %d4

total: 2 errors, 0 warnings, 48 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/12: tests/tcg/tricore: Add msub test...
Checking PATCH 12/12: tests/tcg/tricore: Add muls test...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure Bastian Koppelmann
@ 2018-05-01 15:40   ` Alex Bennée
       [not found]     ` <f24f7977-cd8b-f502-e3f1-2ae6b0f422d8@mail.uni-paderborn.de>
  2018-05-02  0:41   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 21+ messages in thread
From: Alex Bennée @ 2018-05-01 15:40 UTC (permalink / raw)
  To: Bastian Koppelmann; +Cc: qemu-devel


Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes:

> this includes the Makefile and linker script to build all the tests.
>
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
>  tests/tcg/tricore/link.ld  | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
>  create mode 100644 tests/tcg/tricore/Makefile
>  create mode 100644 tests/tcg/tricore/link.ld
>
> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
> new file mode 100644
> index 0000000000..8c168d1062
> --- /dev/null
> +++ b/tests/tcg/tricore/Makefile
> @@ -0,0 +1,30 @@
> +AS := tricore-as
> +LD := tricore-ld

Where do these come from? Ideally we'd get these in a docker container
like the rest. It would actually be easier to use tricore-gcc if it
exists because at the moment my docker series only exposes a C compiler
to the make system.

> +HOST_CC = gcc
> +
> +LDFLAGS = -Tlink.ld
> +ASFLAGS =
> +
> +SIM = ../../../tricore-softmmu/qemu-system-tricore
> +SIMFLAGS = -M tricore_testboard -nographic -kernel
> +
> +all: build
> +
> +%.pS: %.S
> +	$(HOST_CC) -E -o $@ $<
> +
> +%.o: %.pS
> +	$(AS) $(ASFLAGS) -o $@ $<
> +
> +%.tst: %.o link.ld
> +	$(LD) $(LDFLAGS) $< -o $@
> +
> +build: $(TESTCASES)
> +
> +check: $(addprefix run-, $(TESTCASES))
> +
> +run-%.tst: %.tst
> +	$(SIM) $(SIMFLAGS) ./$<
> +
> +clean:
> +	$(RM) -fr $(TESTCASES) linker.ld
> diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld
> new file mode 100644
> index 0000000000..364bcdc00a
> --- /dev/null
> +++ b/tests/tcg/tricore/link.ld
> @@ -0,0 +1,60 @@
> +/* Default linker script, for normal executables */
> +OUTPUT_FORMAT("elf32-tricore")
> +OUTPUT_ARCH(tricore)
> +ENTRY(_start)
> +
> +/* the internal ram description */
> +MEMORY
> +{
> +  text_ram (rx!p): org = 0x80000000, len = 15K
> +  data_ram (w!xp): org = 0xd0000000, len = 130K
> +}
> +/*
> + * Define the sizes of the user and system stacks.
> + */
> +__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ;
> +/*
> + * Define the start address and the size of the context save area.
> + */
> +__CSA_BEGIN =  0xd0000000 ;
> +__CSA_SIZE =  8k ;
> +__CSA_END = __CSA_BEGIN + __CSA_SIZE ;
> +
> +SECTIONS
> +{
> +  .text  :
> +  {
> +    *(.text)
> +    . = ALIGN(8);
> +  } > text_ram
> +
> +  .rodata :
> +  {
> +    *(.rodata)
> +    *(.rodata1)
> +  } > data_ram
> +
> +  .data :
> +  {
> +    . = ALIGN(8) ;
> +    *(.data)
> +    *(.data.*)
> +    . = ALIGN(8) ;
> +    __USTACK = . + __USTACK_SIZE -768;
> +
> +  } > data_ram
> +  /*
> +   * Allocate space for BSS sections.
> +   */
> +  .bss  :
> +  {
> +    BSS_BASE = . ;
> +    *(.bss)
> +    *(COMMON)
> +    . = ALIGN(8) ;
> +  } > data_ram
> +  /* Make sure CSA, stack and heap addresses are properly aligned.  */
> +  _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ;
> +  _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ;
> +
> +}


--
Alex Bennée

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure Bastian Koppelmann
  2018-05-01 15:40   ` Alex Bennée
@ 2018-05-02  0:41   ` Philippe Mathieu-Daudé
  2018-05-02  9:26     ` Bastian Koppelmann
  1 sibling, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-02  0:41 UTC (permalink / raw)
  To: Bastian Koppelmann, Alex Bennée
  Cc: qemu-devel, David Brenken, Florian Artmeier, Georg Hofstetter

[-- Attachment #1: Type: text/plain, Size: 7466 bytes --]

Hi Bastian,

On 05/01/2018 11:22 AM, Bastian Koppelmann wrote:
> this includes the Makefile and linker script to build all the tests.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
>  tests/tcg/tricore/link.ld  | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
>  create mode 100644 tests/tcg/tricore/Makefile
>  create mode 100644 tests/tcg/tricore/link.ld
> 
> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
> new file mode 100644
> index 0000000000..8c168d1062
> --- /dev/null
> +++ b/tests/tcg/tricore/Makefile
> @@ -0,0 +1,30 @@
> +AS := tricore-as
> +LD := tricore-ld
> +HOST_CC = gcc
> +
> +LDFLAGS = -Tlink.ld
> +ASFLAGS =
> +
> +SIM = ../../../tricore-softmmu/qemu-system-tricore
> +SIMFLAGS = -M tricore_testboard -nographic -kernel

I applied this on upstream QEMU (26bd8d98c4b32).

I suppose you are doing in-tree build, since this doesn't work with
out-of-tree builds (see the $SIM relative path).

I then get:

tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic
-kests/tcg/tricore/test_muls.tst -d in_asm
QEMU 2.12.50 monitor - type 'help' for more information
(qemu) QEMU 2.12.50 monitor - type 'help' for more information
(qemu) IN:
0x80000000:  qemu-system-tricore: function cpu_get_phys_page_attrs_debug
not implemented, aborting

OBJD-T: 0000000000000000000000000000000000000000000000000000000000000000
OBJD-T: 000000000000000000000000

Having checked the testdevice is here:

tricore-softmmu/qemu-system-tricore -M tricore_testboard -S -monitor stdio
QEMU 2.12.50 monitor - type 'help' for more information
(qemu) info mtree
address-space: memory
  0000000000000000-ffffffffffffffff (prio 0, i/o): system
    0000000080000000-00000000801fffff (prio 0, ram): powerlink_ext_c.ram
    00000000a1000000-00000000a13fffff (prio 0, ram): powerlink_ext_d.ram
    00000000d0000000-00000000d000bfff (prio 0, ram): powerlink_int_d.ram
    00000000d4000000-00000000d400bfff (prio 0, ram): powerlink_int_c.ram
    00000000f0000000-00000000f0000003 (prio 0, i/o): tricore_testdevice
    00000000f0050000-00000000f0053fff (prio 0, ram): powerlink_pcp_data.ram
    00000000f0060000-00000000f0067fff (prio 0, ram): powerlink_pcp_text.ram

Using the docker image provided here:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg00151.html
(which you can build with 'make docker-image-debian-tricore-cross', I
didn't try to merge your series over Alex's tcg-testing one)

This test seems correctly linked:

$ docker run --rm -it -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) \
    qemu:debian-tricore-cross \
      tricore-readelf -e tests/tcg/tricore/test_muls.tst
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Siemens Tricore
  Version:                           0x1
  Entry point address:               0x80000000
  Start of program headers:          52 (bytes into file)
  Start of section headers:          32812 (bytes into file)
  Flags:                             0x2
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         2
  Size of section headers:           40 (bytes)
  Number of section headers:         7
  Section header string table index: 4

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00
0   0  0
  [ 1] .text             PROGBITS        80000000 004000 0000a8 00  AX
0   0  2
  [ 2] .data             PROGBITS        d0000000 008000 000000 00  WA
0   0  8
  [ 3] .bss              NOBITS          d0000000 008000 000000 00  WA
0   0  8
  [ 4] .shstrtab         STRTAB          00000000 008000 00002c 00
0   0  1
  [ 5] .symtab           SYMTAB          00000000 008144 0001c0 10
6  14  4
  [ 6] .strtab           STRTAB          00000000 008304 0000b3 00
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x004000 0x80000000 0x80000000 0x000a8 0x000a8 R E 0x4000
  LOAD           0x008000 0xd0000000 0xd0000000 0x00000 0x00000 RW  0x4000

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01

> +
> +all: build
> +
> +%.pS: %.S
> +	$(HOST_CC) -E -o $@ $<
> +
> +%.o: %.pS
> +	$(AS) $(ASFLAGS) -o $@ $<
> +
> +%.tst: %.o link.ld
> +	$(LD) $(LDFLAGS) $< -o $@

Those rules did not work for me:

$ make test_dvstep.tst
cc    -c -o test_dvstep.o test_dvstep.S
test_dvstep.S: Assembler messages:
test_dvstep.S:6: Error: no such instruction: `mov.u %d6,lo:0xfffffe5c'
test_dvstep.S:6: Error: no such instruction: `movh %d10,up:0xfffffe5c'

However called in the same line it did:

$ make test_muls.pS test_muls.o test_muls.tst
gcc -E -o test_muls.pS test_muls.S
tricore-as  -o test_muls.o test_muls.pS
tricore-ld -Tlink.ld test_muls.o -o test_muls.tst

Regards,

Phil.

> +
> +build: $(TESTCASES)
> +
> +check: $(addprefix run-, $(TESTCASES))
> +
> +run-%.tst: %.tst
> +	$(SIM) $(SIMFLAGS) ./$<
> +
> +clean:
> +	$(RM) -fr $(TESTCASES) linker.ld
> diff --git a/tests/tcg/tricore/link.ld b/tests/tcg/tricore/link.ld
> new file mode 100644
> index 0000000000..364bcdc00a
> --- /dev/null
> +++ b/tests/tcg/tricore/link.ld
> @@ -0,0 +1,60 @@
> +/* Default linker script, for normal executables */
> +OUTPUT_FORMAT("elf32-tricore")
> +OUTPUT_ARCH(tricore)
> +ENTRY(_start)
> +
> +/* the internal ram description */
> +MEMORY
> +{
> +  text_ram (rx!p): org = 0x80000000, len = 15K
> +  data_ram (w!xp): org = 0xd0000000, len = 130K
> +}
> +/*
> + * Define the sizes of the user and system stacks.
> + */
> +__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ;
> +/*
> + * Define the start address and the size of the context save area.
> + */
> +__CSA_BEGIN =  0xd0000000 ;
> +__CSA_SIZE =  8k ;
> +__CSA_END = __CSA_BEGIN + __CSA_SIZE ;
> +
> +SECTIONS
> +{
> +  .text  :
> +  {
> +    *(.text)
> +    . = ALIGN(8);
> +  } > text_ram
> +
> +  .rodata :
> +  {
> +    *(.rodata)
> +    *(.rodata1)
> +  } > data_ram
> +
> +  .data :
> +  {
> +    . = ALIGN(8) ;
> +    *(.data)
> +    *(.data.*)
> +    . = ALIGN(8) ;
> +    __USTACK = . + __USTACK_SIZE -768;
> +
> +  } > data_ram
> +  /*
> +   * Allocate space for BSS sections.
> +   */
> +  .bss  :
> +  {
> +    BSS_BASE = . ;
> +    *(.bss)
> +    *(COMMON)
> +    . = ALIGN(8) ;
> +  } > data_ram
> +  /* Make sure CSA, stack and heap addresses are properly aligned.  */
> +  _. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ;
> +  _. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ;
> +
> +}
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-02  0:41   ` Philippe Mathieu-Daudé
@ 2018-05-02  9:26     ` Bastian Koppelmann
  2018-05-02  9:50       ` Bastian Koppelmann
  0 siblings, 1 reply; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-02  9:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Alex Bennée
  Cc: qemu-devel, David Brenken, Florian Artmeier, Georg Hofstetter

Hi Phil,

On 05/02/2018 02:41 AM, Philippe Mathieu-Daudé wrote:
> Hi Bastian,
> 
> On 05/01/2018 11:22 AM, Bastian Koppelmann wrote:
>> this includes the Makefile and linker script to build all the tests.
>>
>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
>> ---
>>  tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
>>  tests/tcg/tricore/link.ld  | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 90 insertions(+)
>>  create mode 100644 tests/tcg/tricore/Makefile
>>  create mode 100644 tests/tcg/tricore/link.ld
>>
>> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
>> new file mode 100644
>> index 0000000000..8c168d1062
>> --- /dev/null
>> +++ b/tests/tcg/tricore/Makefile
>> @@ -0,0 +1,30 @@
>> +AS := tricore-as
>> +LD := tricore-ld
>> +HOST_CC = gcc
>> +
>> +LDFLAGS = -Tlink.ld
>> +ASFLAGS =
>> +
>> +SIM = ../../../tricore-softmmu/qemu-system-tricore
>> +SIMFLAGS = -M tricore_testboard -nographic -kernel
> 
> I applied this on upstream QEMU (26bd8d98c4b32).
> 
> I suppose you are doing in-tree build, since this doesn't work with> out-of-tree builds (see the $SIM relative path).

Ooops, this is mostly copied from tests/tcg/xtensa :)

> 
> I then get:
> 
> tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic
> -kests/tcg/tricore/test_muls.tst -d in_asm
> QEMU 2.12.50 monitor - type 'help' for more information
> (qemu) QEMU 2.12.50 monitor - type 'help' for more information
> (qemu) IN:
> 0x80000000:  qemu-system-tricore: function cpu_get_phys_page_attrs_debug
> not implemented, aborting

This is odd. I'll try to reproduce it.

[...]
> http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg00151.html
> (which you can build with 'make docker-image-debian-tricore-cross', I
> didn't try to merge your series over Alex's tcg-testing one)

Thanks for creating this docker image, you helped me a great deal :)

[...]
>> +
>> +all: build
>> +
>> +%.pS: %.S
>> +	$(HOST_CC) -E -o $@ $<
>> +
>> +%.o: %.pS
>> +	$(AS) $(ASFLAGS) -o $@ $<
>> +
>> +%.tst: %.o link.ld
>> +	$(LD) $(LDFLAGS) $< -o $@
> 
> Those rules did not work for me:

I assume make uses the built-in rules. Can you try $ make --no-builtin-rules?

Cheers,
Bastian

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
       [not found]     ` <f24f7977-cd8b-f502-e3f1-2ae6b0f422d8@mail.uni-paderborn.de>
@ 2018-05-02  9:42       ` Bastian Koppelmann
  2018-05-02 13:05         ` Alex Bennée
  0 siblings, 1 reply; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-02  9:42 UTC (permalink / raw)
  To: Alex Bennée, QEMU Developers

On 05/01/2018 06:48 PM, Bastian Koppelmann wrote:
> Hi Alex,
> 
> On 05/01/2018 05:40 PM, Alex Bennée wrote:
>> Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes:
>>
>>> this includes the Makefile and linker script to build all the tests.
>>>
>>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
>>> ---
>>>   tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
>>>   tests/tcg/tricore/link.ld  | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>>>   2 files changed, 90 insertions(+)
>>>   create mode 100644 tests/tcg/tricore/Makefile
>>>   create mode 100644 tests/tcg/tricore/link.ld
>>>
>>> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
>>> new file mode 100644
>>> index 0000000000..8c168d1062
>>> --- /dev/null
>>> +++ b/tests/tcg/tricore/Makefile
>>> @@ -0,0 +1,30 @@
>>> +AS := tricore-as
>>> +LD := tricore-ld
>> Where do these come from? Ideally we'd get these in a docker container
>> like the rest. It would actually be easier to use tricore-gcc if it
>> exists because at the moment my docker series only exposes a C compiler
>> to the make system.
> 
> I don't have access to gcc unfortunately. The only thing I can provide is the
> patched binutils (https://github.com/bkoppelmann/tricore-binutils).
> 
> Can you give me a pointer regarding your docker images?
> 
> Cheers,
> Bastian

Sorry Alex for taking this off list. I was at a new machine...

Cheers,
Bastian

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-02  9:26     ` Bastian Koppelmann
@ 2018-05-02  9:50       ` Bastian Koppelmann
  0 siblings, 0 replies; 21+ messages in thread
From: Bastian Koppelmann @ 2018-05-02  9:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Alex Bennée
  Cc: Florian Artmeier, David Brenken, qemu-devel, Georg Hofstetter

On 05/02/2018 11:26 AM, Bastian Koppelmann wrote:
> Hi Phil,
> 
[...]
>> I then get:
>>
>> tricore-softmmu/qemu-system-tricore -M tricore_testboard -nographic
>> -kests/tcg/tricore/test_muls.tst -d in_asm
>> QEMU 2.12.50 monitor - type 'help' for more information
>> (qemu) QEMU 2.12.50 monitor - type 'help' for more information
>> (qemu) IN:
>> 0x80000000:  qemu-system-tricore: function cpu_get_phys_page_attrs_debug
>> not implemented, aborting
> 
> This is odd. I'll try to reproduce it.

It looks like this is due to -d in_asm. I'll sent fix this in a different patchset.

Cheers,
Bastian

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

* Re: [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure
  2018-05-02  9:42       ` Bastian Koppelmann
@ 2018-05-02 13:05         ` Alex Bennée
  0 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2018-05-02 13:05 UTC (permalink / raw)
  To: Bastian Koppelmann; +Cc: QEMU Developers


Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes:

> On 05/01/2018 06:48 PM, Bastian Koppelmann wrote:
>> Hi Alex,
>>
>> On 05/01/2018 05:40 PM, Alex Bennée wrote:
>>> Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes:
>>>
>>>> this includes the Makefile and linker script to build all the tests.
>>>>
>>>> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
>>>> ---
>>>>  tests/tcg/tricore/Makefile | 30 +++++++++++++++++++++++
>>>>  tests/tcg/tricore/link.ld | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>>>>  2 files changed, 90 insertions(+)
>>>>  create mode 100644 tests/tcg/tricore/Makefile
>>>>  create mode 100644 tests/tcg/tricore/link.ld
>>>>
>>>> diff --git a/tests/tcg/tricore/Makefile b/tests/tcg/tricore/Makefile
>>>> new file mode 100644
>>>> index 0000000000..8c168d1062
>>>> --- /dev/null
>>>> +++ b/tests/tcg/tricore/Makefile
>>>> @@ -0,0 +1,30 @@
>>>> +AS := tricore-as
>>>> +LD := tricore-ld
>>> Where do these come from? Ideally we'd get these in a docker container
>>> like the rest. It would actually be easier to use tricore-gcc if it
>>> exists because at the moment my docker series only exposes a C compiler
>>> to the make system.
>>
>> I don't have access to gcc unfortunately. The only thing I can provide is the
>> patched binutils (https://github.com/bkoppelmann/tricore-binutils).
>>
>> Can you give me a pointer regarding your docker images?
>>
>> Cheers,
>> Bastian
>
> Sorry Alex for taking this off list. I was at a new machine...

No worries, sorry for being late with the pointer:

  https://lists.gnu.org/archive/html/qemu-devel/2018-04/msg03906.html

My current WIP tree is:

  https://github.com/stsquad/qemu/tree/testing/tcg-tests-revival-v4

although the usual caveats about re-basing apply to that ;-)

--
Alex Bennée

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

* Re: [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/
  2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/ Bastian Koppelmann
@ 2018-05-25 16:14   ` Alex Bennée
  0 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2018-05-25 16:14 UTC (permalink / raw)
  To: Bastian Koppelmann; +Cc: qemu-devel


Bastian Koppelmann <kbastian@mail.uni-paderborn.de> writes:

> this device is used to verify the correctness of regression tests by
> allowing guests to write their exit status to this device. This is then
> used by qemu to exit using the written status.

My initial thoughts are this replicates the functionality of
virtio-console for chr-testdev used by kvm-unit-tests
(chardev/testdev.c). But on closer inspection it seems this is a
per-arch thing anyway.

>
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  hw/tricore/Makefile.objs                |  1 +
>  hw/tricore/tricore_testboard.c          |  8 ++++
>  hw/tricore/tricore_testdevice.c         | 81 +++++++++++++++++++++++++++++++++
>  include/hw/tricore/tricore_testdevice.h | 38 ++++++++++++++++
>  4 files changed, 128 insertions(+)
>  create mode 100644 hw/tricore/tricore_testdevice.c
>  create mode 100644 include/hw/tricore/tricore_testdevice.h
>
> diff --git a/hw/tricore/Makefile.objs b/hw/tricore/Makefile.objs
> index 435e095cff..9e871a01e2 100644
> --- a/hw/tricore/Makefile.objs
> +++ b/hw/tricore/Makefile.objs
> @@ -1 +1,2 @@
>  obj-y += tricore_testboard.o
> +obj-y += tricore_testdevice.o
> diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
> index 8e61dfc3e6..ee0a332e12 100644
> --- a/hw/tricore/tricore_testboard.c
> +++ b/hw/tricore/tricore_testboard.c
> @@ -31,6 +31,7 @@
>  #include "exec/address-spaces.h"
>  #include "elf.h"
>  #include "hw/tricore/tricore.h"
> +#include "hw/tricore/tricore_testdevice.h"
>  #include "qemu/error-report.h"
>
>
> @@ -60,6 +61,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
>  {
>      TriCoreCPU *cpu;
>      CPUTriCoreState *env;
> +    TriCoreTestDeviceState *test_dev;
>
>      MemoryRegion *sysmem = get_system_memory();
>      MemoryRegion *ext_cram = g_new(MemoryRegion, 1);
> @@ -91,6 +93,12 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
>      memory_region_add_subregion(sysmem, 0xf0050000, pcp_data);
>      memory_region_add_subregion(sysmem, 0xf0060000, pcp_text);
>
> +    /* test device */
> +    test_dev = g_new(TriCoreTestDeviceState, 1);
> +    object_initialize(test_dev, sizeof(TriCoreTestDeviceState),
> +                      TYPE_TRICORE_TESTDEVICE);
> +    memory_region_add_subregion(sysmem, 0xf0000000, &test_dev->iomem);
> +
>      tricoretb_binfo.ram_size = machine->ram_size;
>      tricoretb_binfo.kernel_filename = machine->kernel_filename;
>
> diff --git a/hw/tricore/tricore_testdevice.c b/hw/tricore/tricore_testdevice.c
> new file mode 100644
> index 0000000000..ce4c67fcae
> --- /dev/null
> +++ b/hw/tricore/tricore_testdevice.c
> @@ -0,0 +1,81 @@
> +/*
> + *  Copyright (c) 2018 Bastian Koppelmann Paderborn University
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/sysbus.h"
> +#include "hw/tricore/tricore_testdevice.h"
> +
> +static void tricore_testdevice_write(void *opaque, hwaddr offset,
> +                                      uint64_t value, unsigned size)
> +{
> +    exit(value);
> +}
> +
> +static uint64_t tricore_testdevice_read(void *opaque, hwaddr offset,
> +                                         unsigned size)
> +{
> +    return 0xdeadbeef;
> +}
> +
> +static void tricore_testdevice_reset(DeviceState *dev)
> +{
> +}
> +
> +static const MemoryRegionOps tricore_testdevice_ops = {
> +    .read = tricore_testdevice_read,
> +    .write = tricore_testdevice_write,
> +    .valid = {
> +        .min_access_size = 4,
> +        .max_access_size = 4,
> +    },
> +    .endianness = DEVICE_NATIVE_ENDIAN,
> +};
> +
> +static void tricore_testdevice_init(Object *obj)
> +{
> +    TriCoreTestDeviceState *s = TRICORE_TESTDEVICE(obj);
> +   /* map memory */
> +    memory_region_init_io(&s->iomem, OBJECT(s), &tricore_testdevice_ops, s,
> +                          "tricore_testdevice", 0x4);
> +}
> +
> +static Property tricore_testdevice_properties[] = {
> +    DEFINE_PROP_END_OF_LIST()
> +};
> +
> +static void tricore_testdevice_class_init(ObjectClass *klass, void *data)
> +{
> +    DeviceClass *dc = DEVICE_CLASS(klass);
> +
> +    dc->props = tricore_testdevice_properties;
> +    dc->reset = tricore_testdevice_reset;
> +}
> +
> +static const TypeInfo tricore_testdevice_info = {
> +    .name          = TYPE_TRICORE_TESTDEVICE,
> +    .parent        = TYPE_SYS_BUS_DEVICE,
> +    .instance_size = sizeof(TriCoreTestDeviceState),
> +    .instance_init = tricore_testdevice_init,
> +    .class_init    = tricore_testdevice_class_init,
> +};
> +
> +static void tricore_testdevice_register_types(void)
> +{
> +    type_register_static(&tricore_testdevice_info);
> +}
> +
> +type_init(tricore_testdevice_register_types)
> diff --git a/include/hw/tricore/tricore_testdevice.h b/include/hw/tricore/tricore_testdevice.h
> new file mode 100644
> index 0000000000..5b2df219e3
> --- /dev/null
> +++ b/include/hw/tricore/tricore_testdevice.h
> @@ -0,0 +1,38 @@
> +/*
> + *  Copyright (c) 2018  Bastian Koppelmann Paderborn University
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +
> +#ifndef HW_TRICORE_TESTDEV_H
> +#define HW_TRICORE_TESTDEV_H
> +
> +#include "hw/sysbus.h"
> +#include "hw/hw.h"
> +
> +#define TYPE_TRICORE_TESTDEVICE "tricore_testdevice"
> +#define TRICORE_TESTDEVICE(obj) \
> +    OBJECT_CHECK(TriCoreTestDeviceState, (obj), TYPE_TRICORE_TESTDEVICE)
> +
> +typedef struct {
> +    /* <private> */
> +    SysBusDevice parent_obj;
> +
> +    /* <public> */
> +    MemoryRegion iomem;
> +
> +} TriCoreTestDeviceState;
> +
> +#endif


--
Alex Bennée

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

end of thread, other threads:[~2018-05-25 16:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 14:22 [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 01/12] hw/tricore: Add testdevice for tests in tests/tcg/ Bastian Koppelmann
2018-05-25 16:14   ` Alex Bennée
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 02/12] tests/tcg/tricore: Add build infrastructure Bastian Koppelmann
2018-05-01 15:40   ` Alex Bennée
     [not found]     ` <f24f7977-cd8b-f502-e3f1-2ae6b0f422d8@mail.uni-paderborn.de>
2018-05-02  9:42       ` Bastian Koppelmann
2018-05-02 13:05         ` Alex Bennée
2018-05-02  0:41   ` Philippe Mathieu-Daudé
2018-05-02  9:26     ` Bastian Koppelmann
2018-05-02  9:50       ` Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 03/12] tests/tcg/tricore: Add macros to easily create tests and first test 'abs' Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 04/12] tests/tcg/tricore: Add bmerge test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 05/12] tests/tcg/tricore: Add clz test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 06/12] tests/tcg/tricore: Add dvstep test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 07/12] tests/tcg/tricore: Add fadd test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 08/12] tests/tcg/tricore: Add fmul test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 09/12] tests/tcg/tricore: Add ftoi test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 10/12] tests/tcg/tricore: Add madd test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 11/12] tests/tcg/tricore: Add msub test Bastian Koppelmann
2018-05-01 14:22 ` [Qemu-devel] [RFC PATCH 12/12] tests/tcg/tricore: Add muls test Bastian Koppelmann
2018-05-01 14:35 ` [Qemu-devel] [RFC PATCH 00/12] tests/tcg: Add TriCore tests no-reply

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.