1 #=======================================================================
2 # UCB VLSI FLOW: Makefile for riscv-bmarks/mt
3 #-----------------------------------------------------------------------
4 # Henry Cook (hcook@cs.berkeley.edu)
10 common
= ..
/benchmarks
/common
12 instname
= riscv-bmarks-mt
13 instbasedir
= $(UCB_VLSI_HOME
)/install
15 #--------------------------------------------------------------------
17 #--------------------------------------------------------------------
87 #--------------------------------------------------------------------
89 #--------------------------------------------------------------------
92 RISCV_GCC_OPTS
= -Wa
,-march
=RVIMAFDXhwacha
-std
=gnu99
-O2
-ffast-math
93 RISCV_LINK
= riscv-gcc
-T
$(common
)/test.
ld $(incs
)
94 RISCV_LINK_OPTS
= -nostdlib
-nostartfiles
-ffast-math
-lc
95 RISCV_OBJDUMP
= riscv-objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.data
98 VPATH
+= $(addprefix $(bmarkdir
)/, $(bmarks
))
101 incs
+= -I.
-I
$(bmarkdir
)/..
/env
-I
$(common
) $(addprefix -I
$(bmarkdir
)/, $(bmarks
))
104 #include $(patsubst %, $(bmarkdir)/%/bmark.mk, $(bmarks))
106 #------------------------------------------------------------
107 # Build and run benchmarks on riscv simulator
108 #------------------------------------------------------------
110 bmarks_riscv_obj
= $(addsuffix .o
, $(bmarks
))
111 bmarks_riscv_bin
= $(addsuffix .riscv
, $(bmarks
))
112 bmarks_riscv_dump
= $(addsuffix .riscv.dump
, $(bmarks
))
113 bmarks_riscv_hex
= $(addsuffix .riscv.hex
, $(bmarks
))
114 bmarks_riscv_out
= $(addsuffix .riscv.out
, $(bmarks
))
116 bmarks_defs
= -DPREALLOCATE
=1 -DHOST_DEBUG
=0
117 bmarks_cycles
= 80000
120 elf2hex
16 32768 $< > $@
122 $(bmarks_riscv_bin
): %.riscv
: %.o syscalls.o crt.o
123 $(RISCV_LINK
) $< syscalls.o crt.o
$(RISCV_LINK_OPTS
) -o
$@
125 $(bmarks_riscv_dump
): %.riscv.dump
: %.riscv
126 $(RISCV_OBJDUMP
) $< > $@
128 $(bmarks_riscv_out
): %.riscv.out
: %.riscv
132 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) -D__ASSEMBLY__
=1 \
136 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
139 riscv
: $(bmarks_riscv_dump
) $(bmarks_riscv_hex
)
140 run-riscv
: $(bmarks_riscv_out
)
141 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
143 junk
+= $(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(bmarks_riscv_hex
) $(bmarks_riscv_out
)
146 #------------------------------------------------------------
151 #------------------------------------------------------------
154 date_suffix
= $(shell date
+%Y-
%m-
%d_
%H-
%M
)
155 install_dir
= $(instbasedir
)/$(instname
)-$(date_suffix
)
156 latest_install
= $(shell ls
-1 -d
$(instbasedir
)/$(instname
)* | tail
-n
1)
160 cp
-r
$(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(install_dir
)
163 rm -rf
$(instbasedir
)/$(instname
)
164 ln
-s
$(latest_install
) $(instbasedir
)/$(instname
)
166 #------------------------------------------------------------
170 rm -rf
$(objs
) $(junk
)