1 #=======================================================================
2 # Makefile for riscv-tests/isa
3 #-----------------------------------------------------------------------
7 include $(src_dir
)/rv64ui
/Makefrag
8 include $(src_dir
)/rv64uf
/Makefrag
9 include $(src_dir
)/rv64si
/Makefrag
10 include $(src_dir
)/rv64mi
/Makefrag
11 include $(src_dir
)/rv32ui
/Makefrag
12 include $(src_dir
)/rv32si
/Makefrag
13 include $(src_dir
)/rv32mi
/Makefrag
17 #--------------------------------------------------------------------
19 #--------------------------------------------------------------------
21 RISCV_PREFIX ?
= riscv64-unknown-elf-
22 RISCV_GCC ?
= $(RISCV_PREFIX
)gcc
23 ENTROPY ?
= -DENTROPY
=$(shell echo
$$$$)
24 RISCV_GCC_OPTS ?
= $(ENTROPY
) -static
-mcmodel
=medany
-fvisibility
=hidden
-nostdlib
-nostartfiles
25 RISCV_OBJDUMP ?
= $(RISCV_PREFIX
)objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.text.init
--section
=.data
31 #------------------------------------------------------------
32 # Build assembly tests
35 $(RISCV_OBJDUMP
) $< > $@
41 $(RISCV_SIM
) --isa
=RV32
$< 2> $@
43 define compile_template
45 $$($(1)_p_tests
): $(1)-p-
%: $(1)/%.S
46 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(src_dir
)/..
/env
/p
-I
$(src_dir
)/macros
/scalar
-T
$(src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
47 $(1)_tests
+= $$($(1)_p_tests
)
49 $$($(1)_v_tests
): $(1)-v-
%: $(1)/%.S
50 $$(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
$$@
51 $(1)_tests
+= $$($(1)_v_tests
)
53 $(1)_tests_dump
= $$(addsuffix .dump
, $$($(1)_tests
))
55 $(1): $$($(1)_tests_dump
)
59 tests
+= $$($(1)_tests
)
63 $(eval
$(call compile_template
,rv32ui
,-m32
))
64 $(eval
$(call compile_template
,rv32si
,-m32
))
65 $(eval
$(call compile_template
,rv32mi
,-m32
))
67 $(eval
$(call compile_template
,rv64ui
))
68 $(eval
$(call compile_template
,rv64uf
))
69 $(eval
$(call compile_template
,rv64si
))
70 $(eval
$(call compile_template
,rv64mi
))
73 tests_dump
= $(addsuffix .dump
, $(tests
))
74 tests_hex
= $(addsuffix .hex
, $(tests
))
75 tests_out
= $(addsuffix .out
, $(spike_tests
))
76 tests32_out
= $(addsuffix .out32
, $(spike32_tests
))
78 run
: $(tests_out
) $(tests32_out
)
79 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
80 $(tests_out
) $(tests32_out
); echo
;
82 junk
+= $(tests
) $(tests_dump
) $(tests_hex
) $(tests_out
) $(tests32_out
)
84 #------------------------------------------------------------
89 #------------------------------------------------------------