facc61191e389327b5e0811388092dc07b20ca2d
1 #=======================================================================
2 # Makefile for riscv-tests/isa
3 #-----------------------------------------------------------------------
7 include $(src_dir
)/rv64ui
/Makefrag
8 include $(src_dir
)/rv64um
/Makefrag
9 include $(src_dir
)/rv64ua
/Makefrag
10 include $(src_dir
)/rv64uf
/Makefrag
11 include $(src_dir
)/rv64ud
/Makefrag
12 include $(src_dir
)/rv64si
/Makefrag
13 include $(src_dir
)/rv64mi
/Makefrag
14 include $(src_dir
)/rv32ui
/Makefrag
15 include $(src_dir
)/rv32um
/Makefrag
16 include $(src_dir
)/rv32ua
/Makefrag
17 include $(src_dir
)/rv32si
/Makefrag
18 include $(src_dir
)/rv32mi
/Makefrag
22 #--------------------------------------------------------------------
24 #--------------------------------------------------------------------
26 RISCV_PREFIX ?
= riscv
$(XLEN
)-unknown-elf-
27 RISCV_GCC ?
= $(RISCV_PREFIX
)gcc
28 ENTROPY ?
= -DENTROPY
=$(shell echo
$$$$)
29 RISCV_GCC_OPTS ?
= $(ENTROPY
) -static
-mcmodel
=medany
-fvisibility
=hidden
-nostdlib
-nostartfiles
30 RISCV_OBJDUMP ?
= $(RISCV_PREFIX
)objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.text.init
--section
=.data
35 #------------------------------------------------------------
36 # Build assembly tests
39 $(RISCV_OBJDUMP
) $< > $@
45 $(RISCV_SIM
) --isa
=RV32
$< 2> $@
47 define compile_template
49 $$($(1)_p_tests
): $(1)-p-
%: $(1)/%.S
50 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(src_dir
)/..
/env
/p
-I
$(src_dir
)/macros
/scalar
-T
$(src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
51 $(1)_tests
+= $$($(1)_p_tests
)
53 $$($(1)_v_tests
): $(1)-v-
%: $(1)/%.S
54 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -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
$$< -lc
-o
$$@
55 $(1)_tests
+= $$($(1)_v_tests
)
57 $(1)_tests_dump
= $$(addsuffix .dump
, $$($(1)_tests
))
59 $(1): $$($(1)_tests_dump
)
63 tests
+= $$($(1)_tests
)
67 $(eval
$(call compile_template
,rv32ui
,-m32
))
68 $(eval
$(call compile_template
,rv32um
,-m32
))
69 $(eval
$(call compile_template
,rv32ua
,-m32
))
70 $(eval
$(call compile_template
,rv32si
,-m32
))
71 $(eval
$(call compile_template
,rv32mi
,-m32
))
73 $(eval
$(call compile_template
,rv64ui
))
74 $(eval
$(call compile_template
,rv64um
))
75 $(eval
$(call compile_template
,rv64ua
))
76 $(eval
$(call compile_template
,rv64uf
))
77 $(eval
$(call compile_template
,rv64ud
))
78 $(eval
$(call compile_template
,rv64si
))
79 $(eval
$(call compile_template
,rv64mi
))
82 tests_dump
= $(addsuffix .dump
, $(tests
))
83 tests_hex
= $(addsuffix .hex
, $(tests
))
84 tests_out
= $(addsuffix .out
, $(spike_tests
))
85 tests32_out
= $(addsuffix .out32
, $(spike32_tests
))
87 run
: $(tests_out
) $(tests32_out
)
88 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
89 $(tests_out
) $(tests32_out
); echo
;
91 junk
+= $(tests
) $(tests_dump
) $(tests_hex
) $(tests_out
) $(tests32_out
)
93 #------------------------------------------------------------
98 #------------------------------------------------------------