2019-12-04 00:47:19 +00:00
|
|
|
#=======================================================================
|
|
|
|
# Makefile for riscv-tests/isa
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XLEN := 32
|
|
|
|
|
|
|
|
src_dir := .
|
|
|
|
|
|
|
|
include $(src_dir)/rv32ui/Makefrag
|
2020-01-02 08:12:13 +00:00
|
|
|
include $(src_dir)/rv32um/Makefrag
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
default: all
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build rules
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2021-06-05 07:11:33 +00:00
|
|
|
RISCV_PREFIX ?= /opt/riscv32/bin/riscv32-unknown-elf-
|
2019-12-04 00:47:19 +00:00
|
|
|
RISCV_GCC ?= $(RISCV_PREFIX)gcc
|
|
|
|
RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
|
|
|
|
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all
|
|
|
|
RISCV_OBJCOPY ?= $(RISCV_PREFIX)objcopy
|
|
|
|
|
2021-06-05 07:11:33 +00:00
|
|
|
BIN_TO_MEM := $(src_dir)/../../tools/BinToMem.py
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
vpath %.S $(src_dir)
|
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# Build assembly tests
|
|
|
|
|
|
|
|
%.dump: %
|
|
|
|
$(RISCV_OBJDUMP) generated/$< > generated/$@
|
|
|
|
$(RISCV_OBJCOPY) -O verilog generated/$< generated/$<.verilog
|
|
|
|
$(RISCV_OBJCOPY) -O binary generated/$< generated/$<.bin
|
2021-06-05 07:11:33 +00:00
|
|
|
$(BIN_TO_MEM) generated/$<.bin generated/$<.mem
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
define compile_template
|
|
|
|
|
|
|
|
$$($(1)_p_tests): $(1)-p-%: $(1)/%.S
|
|
|
|
$$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir) -T$(src_dir)/link.ld $$< -o generated/$$@
|
|
|
|
$(1)_tests += $$($(1)_p_tests)
|
|
|
|
|
|
|
|
$(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests))
|
|
|
|
|
|
|
|
$(1): $$($(1)_tests_dump)
|
|
|
|
|
|
|
|
.PHONY: $(1)
|
|
|
|
|
|
|
|
tests += $$($(1)_tests)
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call compile_template,rv32ui,-march=rv32i -mabi=ilp32))
|
2020-01-02 08:12:13 +00:00
|
|
|
$(eval $(call compile_template,rv32um,-march=rv32im -mabi=ilp32))
|
2019-12-04 00:47:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
tests_verilog = $(addsuffix .verilog, $(tests))
|
|
|
|
tests_dump = $(addsuffix .dump, $(tests))
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------
|
|
|
|
# Default
|
|
|
|
|
|
|
|
all: $(tests_dump)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf generated/*
|
|
|
|
|