1 #=======================================================================
2 # Makefile for riscv-tests/isa
3 #-----------------------------------------------------------------------
10 include $(src_dir
)/rv64ui
/Makefrag
11 include $(src_dir
)/rv64uc
/Makefrag
12 include $(src_dir
)/rv64um
/Makefrag
13 include $(src_dir
)/rv64ua
/Makefrag
14 include $(src_dir
)/rv64uf
/Makefrag
15 include $(src_dir
)/rv64ud
/Makefrag
16 include $(src_dir
)/rv64si
/Makefrag
17 include $(src_dir
)/rv64mi
/Makefrag
19 include $(src_dir
)/rv32ui
/Makefrag
20 include $(src_dir
)/rv32uc
/Makefrag
21 include $(src_dir
)/rv32um
/Makefrag
22 include $(src_dir
)/rv32ua
/Makefrag
23 include $(src_dir
)/rv32uf
/Makefrag
24 include $(src_dir
)/rv32ud
/Makefrag
25 include $(src_dir
)/rv32si
/Makefrag
26 include $(src_dir
)/rv32mi
/Makefrag
30 #--------------------------------------------------------------------
32 #--------------------------------------------------------------------
34 RISCV_PREFIX ?
= riscv
$(XLEN
)-unknown-elf-
35 RISCV_GCC ?
= $(RISCV_PREFIX
)gcc
36 RISCV_GCC_OPTS ?
= -static
-mcmodel
=medany
-fvisibility
=hidden
-nostdlib
-nostartfiles
37 RISCV_OBJDUMP ?
= $(RISCV_PREFIX
)objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.text.init
--section
=.data
42 #------------------------------------------------------------
43 # Build assembly tests
46 $(RISCV_OBJDUMP
) $< > $@
49 $(RISCV_SIM
) --isa
=rv64gc
$< 2> $@
52 $(RISCV_SIM
) --isa
=rv32gc
$< 2> $@
54 define compile_template
56 $$($(1)_p_tests
): $(1)-p-
%: $(1)/%.S
57 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(src_dir
)/..
/env
/p
-I
$(src_dir
)/macros
/scalar
-T
$(src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
58 $(1)_tests
+= $$($(1)_p_tests
)
60 $$($(1)_v_tests
): $(1)-v-
%: $(1)/%.S
61 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -DENTROPY
=0x
$$(shell echo \
$$@ | md5sum | cut
-c
1-7) -std
=gnu99
-O2
-I
$(src_dir
)/..
/env
/v
-I
$(src_dir
)/macros
/scalar
-T
$(src_dir
)/..
/env
/v
/link.
ld $(src_dir
)/..
/env
/v
/entry.S
$(src_dir
)/..
/env
/v
/*.c
$$< -o
$$@
62 $(1)_tests
+= $$($(1)_v_tests
)
64 $(1)_tests_dump
= $$(addsuffix .dump
, $$($(1)_tests
))
66 $(1): $$($(1)_tests_dump
)
70 tests
+= $$($(1)_tests
)
74 $(eval
$(call compile_template
,rv32ui
,-march
=rv32g
-mabi
=ilp32
))
75 $(eval
$(call compile_template
,rv32uc
,-march
=rv32g
-mabi
=ilp32
))
76 $(eval
$(call compile_template
,rv32um
,-march
=rv32g
-mabi
=ilp32
))
77 $(eval
$(call compile_template
,rv32ua
,-march
=rv32g
-mabi
=ilp32
))
78 $(eval
$(call compile_template
,rv32uf
,-march
=rv32g
-mabi
=ilp32
))
79 $(eval
$(call compile_template
,rv32ud
,-march
=rv32g
-mabi
=ilp32
))
80 $(eval
$(call compile_template
,rv32si
,-march
=rv32g
-mabi
=ilp32
))
81 $(eval
$(call compile_template
,rv32mi
,-march
=rv32g
-mabi
=ilp32
))
83 $(eval
$(call compile_template
,rv64ui
,-march
=rv64g
-mabi
=lp64
))
84 $(eval
$(call compile_template
,rv64uc
,-march
=rv64g
-mabi
=lp64
))
85 $(eval
$(call compile_template
,rv64um
,-march
=rv64g
-mabi
=lp64
))
86 $(eval
$(call compile_template
,rv64ua
,-march
=rv64g
-mabi
=lp64
))
87 $(eval
$(call compile_template
,rv64uf
,-march
=rv64g
-mabi
=lp64
))
88 $(eval
$(call compile_template
,rv64ud
,-march
=rv64g
-mabi
=lp64
))
89 $(eval
$(call compile_template
,rv64si
,-march
=rv64g
-mabi
=lp64
))
90 $(eval
$(call compile_template
,rv64mi
,-march
=rv64g
-mabi
=lp64
))
93 tests_dump
= $(addsuffix .dump
, $(tests
))
94 tests_hex
= $(addsuffix .hex
, $(tests
))
95 tests_out
= $(addsuffix .out
, $(spike_tests
))
96 tests32_out
= $(addsuffix .out32
, $(spike32_tests
))
98 run
: $(tests_out
) $(tests32_out
)
100 junk
+= $(tests
) $(tests_dump
) $(tests_hex
) $(tests_out
) $(tests32_out
)
102 #------------------------------------------------------------
107 #------------------------------------------------------------