diff --git a/ChangeLog b/ChangeLog index a5c3a1f..d11c451 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2018-06-15 Radek Hajek + + Modifications to support Codasip simulator. + + The simulator is renamed as Codasip-simulator (was + Codasip-IA-simulator), compliance_test.h has been moved to target + directories and a COMPILE_TARGET has been added to Makefile to + allow use of LLVM. + + * Makefile: Include Codasip simulator target. + * riscv-target/codasip-IA-simulator/compliance_io.h: Renamed as + riscv-target/Codasip-simulator/compliance_io.h. + * riscv-target/Codasip-simulator/compliance_io.h: Renamed from + riscv-target/codasip-IA-simulator/compliance_io. + * riscv-target/Codasip-simulator/compliance_test.h: Created. + * riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include: + Renamed as + riscv-target/Codasip-simulator/device/rv32i/Makefile.include + * riscv-target/Codasip-simulator/device/rv32i/Makefile.include: + Renamed from + riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include. + * riscv-test-env/compliance_test.h: Renamed as + riscv-target/riscvOVPsim/compliance_test.h. + * riscv-target/riscvOVPsim/compliance_test.h: Renamed from + riscv-test-env/compliance_test.h. + * riscv-target/riscvOVPsim/device/rv32i/Makefile.include: Updated + for new environment. + * riscv-target/spike/compliance_test.h: Created. + * riscv-target/spike/device/rv32i/Makefile.include: Updated for + new environment. + * riscv-test-suite/rv32i/Makefile: Likewise. + 2018-06-10 Jeremy Bennett Put placeholders in empty directories to make sure they show in diff --git a/Makefile b/Makefile index 7bc7de2..92c6037 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ RISCV_TARGET ?= riscvOVPsim RISCV_DEVICE ?= rv32i +RISCV_PREFIX ?= riscv64-unknown-elf- export ROOTDIR = $(shell pwd) export WORK = $(ROOTDIR)/work @@ -21,7 +22,7 @@ all: simulate verify simulate: make \ RISCV_TARGET=$(RISCV_TARGET) RISCV_DEVICE=$(RISCV_DEVICE) \ - RISCV_PREFIX=riscv64-unknown-elf- run -C $(SUITEDIR) + RISCV_PREFIX=$(RISCV_PREFIX) run -C $(SUITEDIR) verify: riscv-test-env/verify.sh @@ -32,4 +33,4 @@ clean: help: @echo "make" @echo "RISCV_TARGET='riscvOVPsim|spike'" - @echo "RISCV_DEVICE='rv32i|...'" \ No newline at end of file + @echo "RISCV_DEVICE='rv32i|...'" diff --git a/riscv-target/codasip-IA-simulator/compliance_io.h b/riscv-target/Codasip-simulator/compliance_io.h similarity index 100% rename from riscv-target/codasip-IA-simulator/compliance_io.h rename to riscv-target/Codasip-simulator/compliance_io.h diff --git a/riscv-target/Codasip-simulator/compliance_test.h b/riscv-target/Codasip-simulator/compliance_test.h new file mode 100644 index 0000000..1975b58 --- /dev/null +++ b/riscv-target/Codasip-simulator/compliance_test.h @@ -0,0 +1,45 @@ +// RISC-V Compliance Test Header File +// Copyright (c) 2017, Codasip Ltd. All Rights Reserved. +// See LICENSE for license details. +// +// Description: Common header file for RV32I tests + +#ifndef _COMPLIANCE_TEST_H +#define _COMPLIANCE_TEST_H + +#include "riscv_test.h" + +//----------------------------------------------------------------------- +// RV Compliance Macros +//----------------------------------------------------------------------- + +#define RV_COMPLIANCE_HALT \ + .globl codasip_syscall; \ + codasip_syscall: \ + add x15, x0, 1; \ + sw x15, codasip_syscall, t0; \ + +#define RV_COMPLIANCE_RV32M \ + \ + +#define RV_COMPLIANCE_CODE_BEGIN \ + .section .text.init; \ + .align 4; \ + .globl _start; \ + _start: \ + +#define RV_COMPLIANCE_CODE_END \ + \ + +#define RV_COMPLIANCE_DATA_BEGIN \ + .align 4; \ + .global codasip_signature_start; \ + codasip_signature_start: \ + +#define RV_COMPLIANCE_DATA_END \ + .align 4; \ + .global codasip_signature_end; \ + codasip_signature_end: + +#endif + diff --git a/riscv-target/Codasip-simulator/device/rv32i/Makefile.include b/riscv-target/Codasip-simulator/device/rv32i/Makefile.include new file mode 100644 index 0000000..9d8b673 --- /dev/null +++ b/riscv-target/Codasip-simulator/device/rv32i/Makefile.include @@ -0,0 +1,18 @@ +# TBD + +RUN_TARGET=\ + codix_berkelium-ia-isimulator -r --info 5 \ + $(work_dir_isa)/$< 2> $(work_dir_isa)/$@ 1>$(work_dir_isa)/$(*)_signature.output +# +signature=$(work_dir_isa)/$(*)_signature.output \ +# $(work_dir_isa)/$< 2> $(work_dir_isa)/$@ + +RISCV_PREFIX ?= codix_berkelium-ia- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_GCC_OPTS ?= -nostdlib -nodefaultlibs + +COMPILE_TARGET=\ + $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) \ + -I$(ROOTDIR)/riscv-test-env/ \ + -I$(ROOTDIR)/riscv-test-env/p/ \ + -I$(ROOTDIR)/riscv-target/$(RISCV_TARGET)/ \ + $$< -o $(work_dir_isa)/$$@ diff --git a/riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include b/riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include deleted file mode 100644 index 894eacd..0000000 --- a/riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include +++ /dev/null @@ -1,6 +0,0 @@ -# TBD - -#RUN_TARGET=\ -# spike --isa=rv32i \ -# +signature=$(work_dir_isa)/$(*)_signature.output \ -# $(work_dir_isa)/$< 2> $(work_dir_isa)/$@ \ No newline at end of file diff --git a/riscv-test-env/compliance_test.h b/riscv-target/riscvOVPsim/compliance_test.h similarity index 100% rename from riscv-test-env/compliance_test.h rename to riscv-target/riscvOVPsim/compliance_test.h diff --git a/riscv-target/riscvOVPsim/device/rv32i/Makefile.include b/riscv-target/riscvOVPsim/device/rv32i/Makefile.include index 97500cf..967a733 100644 --- a/riscv-target/riscvOVPsim/device/rv32i/Makefile.include +++ b/riscv-target/riscvOVPsim/device/rv32i/Makefile.include @@ -4,4 +4,18 @@ RUN_TARGET=\ --override riscvOVPsim/cpu/sigdump/SignatureFile=$(work_dir_isa)/$(*)_signature.output \ --override riscvOVPsim/cpu/sigdump/ResultReg=3 \ --override riscvOVPsim/cpu/simulateexceptions=T \ - --logfile $(work_dir_isa)/$@ \ No newline at end of file + --logfile $(work_dir_isa)/$@ + +RISCV_PREFIX ?= riscv32-unknown-elf- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump +RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles + +COMPILE_TARGET=\ + $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) \ + -I$(ROOTDIR)/riscv-test-env/ \ + -I$(ROOTDIR)/riscv-test-env/p/ \ + -I$(ROOTDIR)/riscv-target/$(RISCV_TARGET)/ \ + -T$(ROOTDIR)/riscv-test-env/p/link.ld $$< \ + -o $(work_dir_isa)/$$@; \ + $$(RISCV_OBJDUMP) -D $(work_dir_isa)/$$@ > $(work_dir_isa)/$$@.objdump diff --git a/riscv-target/spike/compliance_test.h b/riscv-target/spike/compliance_test.h new file mode 100644 index 0000000..dcf0a9b --- /dev/null +++ b/riscv-target/spike/compliance_test.h @@ -0,0 +1,34 @@ +// RISC-V Compliance Test Header File +// Copyright (c) 2017, Codasip Ltd. All Rights Reserved. +// See LICENSE for license details. +// +// Description: Common header file for RV32I tests + +#ifndef _COMPLIANCE_TEST_H +#define _COMPLIANCE_TEST_H + +#include "riscv_test.h" + +//----------------------------------------------------------------------- +// RV Compliance Macros +//----------------------------------------------------------------------- + +#define RV_COMPLIANCE_HALT \ + RVTEST_PASS \ + +#define RV_COMPLIANCE_RV32M \ + RVTEST_RV32M \ + +#define RV_COMPLIANCE_CODE_BEGIN \ + RVTEST_CODE_BEGIN \ + +#define RV_COMPLIANCE_CODE_END \ + RVTEST_CODE_END \ + +#define RV_COMPLIANCE_DATA_BEGIN \ + RVTEST_DATA_BEGIN \ + +#define RV_COMPLIANCE_DATA_END \ + RVTEST_DATA_END \ + +#endif diff --git a/riscv-target/spike/device/rv32i/Makefile.include b/riscv-target/spike/device/rv32i/Makefile.include index 19789a9..b82035e 100644 --- a/riscv-target/spike/device/rv32i/Makefile.include +++ b/riscv-target/spike/device/rv32i/Makefile.include @@ -1,4 +1,18 @@ RUN_TARGET=\ spike --isa=rv32i \ +signature=$(work_dir_isa)/$(*)_signature.output \ - $(work_dir_isa)/$< 2> $(work_dir_isa)/$@ \ No newline at end of file + $(work_dir_isa)/$< 2> $(work_dir_isa)/$@ + +RISCV_PREFIX ?= riscv32-unknown-elf- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump +RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles + +COMPILE_TARGET=\ + $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) \ + -I$(ROOTDIR)/riscv-test-env/ \ + -I$(ROOTDIR)/riscv-test-env/p/ \ + -I$(ROOTDIR)/riscv-target/$(RISCV_TARGET)/ \ + -T$(ROOTDIR)/riscv-test-env/p/link.ld $$< \ + -o $(work_dir_isa)/$$@; \ + $$(RISCV_OBJDUMP) -D $(work_dir_isa)/$$@ > $(work_dir_isa)/$$@.objdump diff --git a/riscv-test-suite/rv32i/Makefile b/riscv-test-suite/rv32i/Makefile index ff9965b..31a76a1 100644 --- a/riscv-test-suite/rv32i/Makefile +++ b/riscv-test-suite/rv32i/Makefile @@ -15,11 +15,6 @@ default: all # Build rules #-------------------------------------------------------------------- -RISCV_PREFIX ?= riscv32-unknown-elf- -RISCV_GCC ?= $(RISCV_PREFIX)gcc -RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump -RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles - vpath %.S $(act_dir) -include $(ROOTDIR)/riscv-target/$(RISCV_TARGET)/device/$(RISCV_DEVICE)/Makefile.include @@ -35,13 +30,7 @@ define compile_template $$($(1)_tests): %.elf: $(src_dir)/%.S mkdir -p $(work_dir_isa)/$$(@D) - $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) \ - -I$(ROOTDIR)/riscv-test-env/ \ - -I$(ROOTDIR)/riscv-test-env/p/ \ - -I$(ROOTDIR)/riscv-target/$(RISCV_TARGET)/ \ - -T$(ROOTDIR)/riscv-test-env/p/link.ld $$< \ - -o $(work_dir_isa)/$$@ - $$(RISCV_OBJDUMP) -D $(work_dir_isa)/$$@ > $(work_dir_isa)/$$@.objdump + $(COMPILE_TARGET) $(1)_tests += $$($(1)_p_tests) .PHONY: $(1)