forked from riscv-non-isa/riscv-arch-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (81 loc) · 3.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
export ROOTDIR = $(shell pwd)
export WORK ?= $(ROOTDIR)/work
export TARGETDIR ?= $(ROOTDIR)/riscv-target
export XLEN ?= 32
export RISCV_TARGET ?= rvsteel-core
export RISCV_DEVICE ?= I
export RISCV_TEST ?=
export RISCV_TARGET_FLAGS ?=
export JOBS ?= -j1
export SUITEDIR = $(ROOTDIR)/riscv-test-suite/rv$(XLEN)i_m/$(RISCV_DEVICE)
export RVTEST_DEFINES =
MAKEFLAGS += --no-print-directory
pipe := |
empty :=
comma := ,
space := $(empty) $(empty)
RISCV_ISA_ALL = $(shell ls $(TARGETDIR)/$(RISCV_TARGET)/device/rv$(XLEN)i_m)
RISCV_ISA_OPT = $(subst $(space),$(pipe),$(RISCV_ISA_ALL))
RISCV_ISA_ALL := $(filter-out Makefile.include,$(RISCV_ISA_ALL))
VERBOSE ?= 0
ifeq ($(VERBOSE),1)
export V=
export REDIR1 =
export REDIR2 =
else
export V=@
export REDIR1 = 1>/dev/null
export REDIR2 = 2>/dev/null
endif
default: all_variant
variant: verilator simulate verify
all_variant:
@for isa in $(RISCV_ISA_ALL); do \
$(MAKE) $(JOBS) RISCV_TARGET=$(RISCV_TARGET) RISCV_TARGET_FLAGS="$(RISCV_TARGET_FLAGS)" RISCV_DEVICE=$$isa variant; \
rc=$$?; \
if [ $$rc -ne 0 ]; then \
exit $$rc; \
fi \
done
build: compile
run: simulate
verilator:
@$(MAKE) -C riscv-steel/hardware/core/tests/verilator 1>/dev/null 2>/dev/null
compile:
$(V) $(MAKE) $(JOBS) \
RISCV_TARGET=$(RISCV_TARGET) \
RISCV_DEVICE=$(RISCV_DEVICE) \
compile -C $(SUITEDIR)
simulate:
$(V) $(MAKE) $(JOBS) \
RISCV_TARGET=$(RISCV_TARGET) \
RISCV_DEVICE=$(RISCV_DEVICE) \
run -C $(SUITEDIR)
verify: simulate
$(V) ./verify.sh || true
clean:
$(V) $(MAKE) $(JOBS) \
RISCV_TARGET=$(RISCV_TARGET) \
RISCV_DEVICE=$(RISCV_DEVICE) \
clean -C $(SUITEDIR)
$(V) $(MAKE) -C riscv-steel/hardware/core/tests/verilator clean
install:
$(V) ./install.sh || true
help:
@echo "RISC-V Architectural Tests"
@echo ""
@echo " Makefile Environment Variables to be set per Target"
@echo " -- TARGETDIR='<directory containing the target folder>'"
@echo " -- XLEN='<make supported xlen>'"
@echo " -- RISCV_TARGET='<name of target>'"
@echo " -- RISCV_TARGET_FLAGS='<any flags to be passed to target>'"
@echo " -- RISCV_DEVICE='$(RISCV_ISA_OPT)' [ leave empty to run all devices ]"
@echo " -- RISCV_TEST='<name of the test. eg. I-ADD-01'"
@echo " "
@echo " Makefile targets available"
@echo " -- build: To compile all the tests within the RISCV_DEVICE suite and generate the elfs. Note this will default to running on the I extension alone if RISCV_DEVICE is empty"
@echo " -- run: To run compiled tests on the target model and generate signatures. Note this will default to running on the I extension alone if RISCV_DEVICE is empty"
@echo " -- verify: To verify if the generated signatures match the corresponding reference signatures. Note this will default to running on the I extension alone if RISCV_DEVICE is empty"
@echo " -- postverify: To run post verification processing for a target, for example with this, riscvOVPsim runs instructional functional coverage on the tests"
@echo " -- clean : removes the working directory from the root folder and also from the respective device folders of the target"
@echo " -- default: build, run, and verify on all devices enabled"