1 #=======================================================================
2 # Makefile for riscv-tests/isa
3 #-----------------------------------------------------------------------
9 include $(src_dir
)/rv64ui
/Makefrag
10 include $(src_dir
)/rv64uc
/Makefrag
11 include $(src_dir
)/rv64um
/Makefrag
12 include $(src_dir
)/rv64ua
/Makefrag
13 include $(src_dir
)/rv64uf
/Makefrag
14 include $(src_dir
)/rv64ud
/Makefrag
15 include $(src_dir
)/rv64si
/Makefrag
16 include $(src_dir
)/rv64mi
/Makefrag
17 include $(src_dir
)/rv32ui
/Makefrag
18 include $(src_dir
)/rv32uc
/Makefrag
19 include $(src_dir
)/rv32um
/Makefrag
20 include $(src_dir
)/rv32ua
/Makefrag
21 include $(src_dir
)/rv32uf
/Makefrag
22 include $(src_dir
)/rv32si
/Makefrag
23 include $(src_dir
)/rv32mi
/Makefrag
27 #--------------------------------------------------------------------
29 #--------------------------------------------------------------------
31 RISCV_PREFIX ?
= riscv
$(XLEN
)-unknown-elf-
32 RISCV_GCC ?
= $(RISCV_PREFIX
)gcc
33 RISCV_GCC_OPTS ?
= -static
-mcmodel
=medany
-fvisibility
=hidden
-nostdlib
-nostartfiles
34 RISCV_OBJDUMP ?
= $(RISCV_PREFIX
)objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.text.init
--section
=.data
39 #------------------------------------------------------------
40 # Build assembly tests
43 $(RISCV_OBJDUMP
) $< > $@
46 $(RISCV_SIM
) --isa
=rv64gc
$< 2> $@
49 $(RISCV_SIM
) --isa
=rv32gc
$< 2> $@
51 define compile_template
53 $$($(1)_p_tests
): $(1)-p-
%: $(1)/%.S
54 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(src_dir
)/..
/env
/p
-I
$(src_dir
)/macros
/scalar
-T
$(src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
55 $(1)_tests
+= $$($(1)_p_tests
)
57 $$($(1)_v_tests
): $(1)-v-
%: $(1)/%.S
58 $$(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
$$@
59 $(1)_tests
+= $$($(1)_v_tests
)
61 $(1)_tests_dump
= $$(addsuffix .dump
, $$($(1)_tests
))
63 $(1): $$($(1)_tests_dump
)
67 tests
+= $$($(1)_tests
)
71 $(eval
$(call compile_template
,rv32ui
,-march
=rv32g
-mabi
=ilp32
))
72 $(eval
$(call compile_template
,rv32uc
,-march
=rv32g
-mabi
=ilp32
))
73 $(eval
$(call compile_template
,rv32um
,-march
=rv32g
-mabi
=ilp32
))
74 $(eval
$(call compile_template
,rv32ua
,-march
=rv32g
-mabi
=ilp32
))
75 $(eval
$(call compile_template
,rv32uf
,-march
=rv32g
-mabi
=ilp32
))
76 $(eval
$(call compile_template
,rv32si
,-march
=rv32g
-mabi
=ilp32
))
77 $(eval
$(call compile_template
,rv32mi
,-march
=rv32g
-mabi
=ilp32
))
79 $(eval
$(call compile_template
,rv64ui
,-march
=rv64g
-mabi
=lp64
))
80 $(eval
$(call compile_template
,rv64uc
,-march
=rv64g
-mabi
=lp64
))
81 $(eval
$(call compile_template
,rv64um
,-march
=rv64g
-mabi
=lp64
))
82 $(eval
$(call compile_template
,rv64ua
,-march
=rv64g
-mabi
=lp64
))
83 $(eval
$(call compile_template
,rv64uf
,-march
=rv64g
-mabi
=lp64
))
84 $(eval
$(call compile_template
,rv64ud
,-march
=rv64g
-mabi
=lp64
))
85 $(eval
$(call compile_template
,rv64si
,-march
=rv64g
-mabi
=lp64
))
86 $(eval
$(call compile_template
,rv64mi
,-march
=rv64g
-mabi
=lp64
))
89 tests_dump
= $(addsuffix .dump
, $(tests
))
90 tests_hex
= $(addsuffix .hex
, $(tests
))
91 tests_out
= $(addsuffix .out
, $(spike_tests
))
92 tests32_out
= $(addsuffix .out32
, $(spike32_tests
))
94 run
: $(tests_out
) $(tests32_out
)
96 junk
+= $(tests
) $(tests_dump
) $(tests_hex
) $(tests_out
) $(tests32_out
)
98 #------------------------------------------------------------
103 #------------------------------------------------------------