1 #=======================================================================
2 # Makefile for riscv-tests/isa
3 #-----------------------------------------------------------------------
7 include $(isa_src_dir
)/rv64ui
/Makefrag
8 include $(isa_src_dir
)/rv64uf
/Makefrag
9 include $(isa_src_dir
)/rv64uv
/Makefrag
10 include $(isa_src_dir
)/rv64si
/Makefrag
11 include $(isa_src_dir
)/rv64sv
/Makefrag
12 include $(isa_src_dir
)/rv32ui
/Makefrag
16 #--------------------------------------------------------------------
18 #--------------------------------------------------------------------
21 RISCV_GCC_OPTS
= -nostdlib
-nostartfiles
-Wa
,-march
=RVIMAFDXhwacha
22 RISCV_OBJDUMP
= riscv-objdump
--disassemble-all
--section
=.text
--section
=.data
--section
=.bss
23 RISCV_SIM
= spike
--extension
=hwacha
25 vpath
%.S
$(isa_src_dir
)
27 #------------------------------------------------------------
28 # Build assembly tests
31 elf2hex
16 16384 $< > $@
34 $(RISCV_OBJDUMP
) $< > $@
39 define compile_template
41 $$($(1)_p_tests
): $(1)-p-
%: $(1)/%.S
42 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(isa_src_dir
)/..
/env
/p
-I
$(isa_src_dir
)/macros
/scalar
-T
$(isa_src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
43 tests
+= $$($(1)_p_tests
)
45 $$($(1)_pt_tests
): $(1)-pt-
%: $(1)/%.S
46 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(isa_src_dir
)/..
/env
/pt
-I
$(isa_src_dir
)/macros
/scalar
-T
$(isa_src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
47 tests
+= $$($(1)_pt_tests
)
49 $$($(1)_pm_tests
): $(1)-pm-
%: $(1)/%.S
50 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(isa_src_dir
)/..
/env
/pm
-I
$(isa_src_dir
)/macros
/scalar
-T
$(isa_src_dir
)/..
/env
/pm
/link.
ld $$< -o
$$@
51 tests
+= $$($(1)_pm_tests
)
53 $$($(1)_v_tests
): $(1)-v-
%: $(1)/%.S
54 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -std
=gnu99
-O2
-I
$(isa_src_dir
)/..
/env
/v
-I
$(isa_src_dir
)/macros
/scalar
-T
$(isa_src_dir
)/..
/env
/v
/link.
ld $(isa_src_dir
)/..
/env
/v
/entry.S
$(isa_src_dir
)/..
/env
/v
/vm.c
$$< -lc
-o
$$@
55 tests
+= $$($(1)_v_tests
)
57 $$($(1)_p_vec_tests
): $(1)-p-vec-
%: $(1)/%.S
58 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(isa_src_dir
)/..
/env
/p
-I
$(isa_src_dir
)/macros
/vector
-T
$(isa_src_dir
)/..
/env
/p
/link.
ld $$< -o
$$@
59 tests
+= $$($(1)_p_vec_tests
)
61 $$($(1)_pt_vec_tests
): $(1)-pt-vec-
%: $(1)/%.S
62 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -I
$(isa_src_dir
)/..
/env
/pt
-I
$(isa_src_dir
)/macros
/vector
-T
$(isa_src_dir
)/..
/env
/pt
/link.
ld $$< -o
$$@
63 tests
+= $$($(1)_pt_vec_tests
)
65 $$($(1)_v_vec_tests
): $(1)-v-vec-
%: $(1)/%.S
66 $$(RISCV_GCC
) $(2) $$(RISCV_GCC_OPTS
) -std
=gnu99
-O2
-I
$(isa_src_dir
)/..
/env
/v
-I
$(isa_src_dir
)/macros
/vector
-T
$(isa_src_dir
)/..
/env
/v
/link.
ld $(isa_src_dir
)/..
/env
/v
/entry.S
$(isa_src_dir
)/..
/env
/v
/vm.c
$$< -lc
-o
$$@
67 tests
+= $$($(1)_v_vec_tests
)
71 $(eval
$(call compile_template
,rv32ui
,-m32
))
72 $(eval
$(call compile_template
,rv64ui
))
73 $(eval
$(call compile_template
,rv64uf
))
74 $(eval
$(call compile_template
,rv64uv
))
75 $(eval
$(call compile_template
,rv64si
))
76 $(eval
$(call compile_template
,rv64sv
))
78 tests_dump
= $(addsuffix .dump
, $(tests
))
79 tests_hex
= $(addsuffix .hex
, $(tests
))
80 tests_out
= $(addsuffix .out
, $(spike_tests
))
83 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
86 junk
+= $(tests
) $(tests_dump
) $(tests_hex
) $(tests_out
)
88 #------------------------------------------------------------
91 all: $(tests_dump
) $(tests_hex
)
93 #------------------------------------------------------------