initial commit
[riscv-tests.git] / isa / rv64sv / Makefile
1 #=======================================================================
2 # Makefile for riscv-tests
3 #-----------------------------------------------------------------------
4
5 default: all
6
7 #--------------------------------------------------------------------
8 # Sources
9 #--------------------------------------------------------------------
10
11 rv64sv_sc_tests = \
12 illegal_tvec_cmd illegal_tvec_regid \
13 illegal_vt_inst illegal_vt_regid \
14 ma_utld ma_utsd ma_vld ma_vsd \
15 ma_vt_inst \
16
17 rv64sv_mc_tests = \
18
19 rv64sv_sc_vec_tests = \
20
21 #--------------------------------------------------------------------
22 # Build rules
23 #--------------------------------------------------------------------
24
25 RISCV_GCC = riscv-gcc
26 RISCV_GCC_OPTS = -nostdlib -nostartfiles
27 RISCV_OBJDUMP = riscv-objdump --disassemble-all --disassemble-zeroes --section=.text --section=.data --section=.bss
28 RISCV_SIM = riscv-isa-run
29
30 #------------------------------------------------------------
31 # Build assembly tests
32
33 %.hex: %
34 elf2hex 16 16384 $< > $@
35
36 %.dump: %
37 $(RISCV_OBJDUMP) $< > $@
38
39 %.out: %
40 $(RISCV_SIM) $< 2> $@
41
42 rv64sv_p_tests_bin = $(addprefix rv64sv-p-, $(rv64sv_sc_tests))
43 rv64sv_p_tests_dump = $(addsuffix .dump, $(rv64sv_p_tests_bin))
44 rv64sv_p_tests_hex = $(addsuffix .hex, $(rv64sv_p_tests_bin))
45 rv64sv_p_tests_out = $(addsuffix .out, $(rv64sv_p_tests_bin))
46
47 $(rv64sv_p_tests_bin): rv64sv-p-%: %.S
48 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/scalar -T../../env/p/link.ld $< -o $@
49
50 rv64sv_pm_tests_bin = $(addprefix rv64sv-pm-, $(rv64sv_mc_tests))
51 rv64sv_pm_tests_dump = $(addsuffix .dump, $(rv64sv_pm_tests_bin))
52 rv64sv_pm_tests_hex = $(addsuffix .hex, $(rv64sv_pm_tests_bin))
53 rv64sv_pm_tests_out = $(addsuffix .out, $(rv64sv_pm_tests_bin))
54
55 $(rv64sv_pm_tests_bin): rv64sv-pm-%: %.S
56 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pm -I../macros/scalar -T../../env/pm/link.ld $< -o $@
57
58 rv64sv_p_vec_tests_bin = $(addprefix rv64sv-p-vec-, $(rv64sv_sc_vec_tests))
59 rv64sv_p_vec_tests_dump = $(addsuffix .dump, $(rv64sv_p_vec_tests_bin))
60 rv64sv_p_vec_tests_hex = $(addsuffix .hex, $(rv64sv_p_vec_tests_bin))
61 rv64sv_p_vec_tests_out = $(addsuffix .out, $(rv64sv_p_vec_tests_bin))
62
63 $(rv64sv_p_vec_tests_bin): rv64sv-p-vec-%: %.S
64 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/p -I../macros/vector -T../../env/p/link.ld $< -o $@
65
66 rv64sv_pt_vec_tests_bin = $(addprefix rv64sv-pt-vec-, $(rv64sv_sc_vec_tests))
67 rv64sv_pt_vec_tests_dump = $(addsuffix .dump, $(rv64sv_pt_vec_tests_bin))
68 rv64sv_pt_vec_tests_hex = $(addsuffix .hex, $(rv64sv_pt_vec_tests_bin))
69 rv64sv_pt_vec_tests_out = $(addsuffix .out, $(rv64sv_pt_vec_tests_bin))
70
71 $(rv64sv_pt_vec_tests_bin): rv64sv-pt-vec-%: %.S
72 $(RISCV_GCC) $(RISCV_GCC_OPTS) -I../../env/pt -I../macros/vector -T../../env/pt/link.ld $< -o $@
73
74 riscv-: \
75 $(rv64sv_p_tests_dump) $(rv64sv_p_tests_hex) \
76 $(rv64sv_pm_tests_dump) $(rv64sv_pm_tests_hex) \
77 $(rv64sv_p_vec_tests_dump) $(rv64sv_p_vec_tests_hex) \
78 $(rv64sv_pt_vec_tests_dump) $(rv64sv_pt_vec_tests_hex) \
79
80 out =
81
82 run: $(out)
83 echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
84 $(out); echo;
85
86 junk += \
87 $(rv64sv_p_tests_bin) $(rv64sv_p_tests_dump) $(rv64sv_p_tests_hex) $(rv64sv_p_tests_out) \
88 $(rv64sv_pm_tests_bin) $(rv64sv_pm_tests_dump) $(rv64sv_pm_tests_hex) $(rv64sv_pm_tests_out) \
89 $(rv64sv_p_vec_tests_bin) $(rv64sv_p_vec_tests_dump) $(rv64sv_p_vec_tests_hex) $(rv64sv_p_vec_tests_out) \
90 $(rv64sv_pt_vec_tests_bin) $(rv64sv_pt_vec_tests_dump) $(rv64sv_pt_vec_tests_hex) $(rv64sv_pt_vec_tests_out) \
91
92 #------------------------------------------------------------
93 # Default
94
95 all: riscv-
96
97 #------------------------------------------------------------
98 # Clean up
99
100 clean:
101 rm -rf $(junk)