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
= -std
=gnu99
-T common
/test.
ld -O3
-nostdlib
-nostartfiles
-funroll-all-loops
93 RISCV_LINK
= riscv-gcc
-T
$(common
)/test.
ld
94 RISCV_LINK_MT
= riscv-gcc
-T
$(common
)/test-mt.
ld
96 RISCV_LINK_SYSCALL
= $(common
)/syscalls.c
-lc
97 RISCV_OBJDUMP
= riscv-objdump
--disassemble-all
--disassemble-zeroes
--section
=.text
--section
=.text.startup
--section
=.data
100 VPATH
+= $(addprefix $(bmarkdir
)/, $(bmarks
))
103 incs
+= -I.
-I
$(common
) $(addprefix -I
$(bmarkdir
)/, $(bmarks
))
106 #include $(patsubst %, $(bmarkdir)/%/bmark.mk, $(bmarks))
108 #------------------------------------------------------------
109 # Build and run benchmarks on riscv simulator
110 #------------------------------------------------------------
112 bmarks_riscv_obj
= $(addsuffix .o
, $(bmarks
))
113 bmarks_riscv_bin
= $(addsuffix .riscv
, $(bmarks
))
114 bmarks_riscv_dump
= $(addsuffix .riscv.dump
, $(bmarks
))
115 bmarks_riscv_hex
= $(addsuffix .riscv.hex
, $(bmarks
))
116 bmarks_riscv_out
= $(addsuffix .riscv.out
, $(bmarks
))
118 bmarks_defs
= -DPREALLOCATE
=1 -DHOST_DEBUG
=0
119 bmarks_cycles
= 80000
122 elf2hex
16 32768 $< > $@
124 $(bmarks_riscv_bin
): %.riscv
: %.o crt-mt.o
125 $(RISCV_LINK_MT
) crt-mt.o
$< $(RISCV_LINK_SYSCALL
) -o
$@
127 $(bmarks_riscv_dump
): %.riscv.dump
: %.riscv
128 $(RISCV_OBJDUMP
) $< > $@
130 $(bmarks_riscv_out
): %.riscv.out
: %.riscv
134 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
138 $(RISCV_GCC
) $(RISCV_GCC_OPTS
) $(bmarks_defs
) \
141 riscv
: $(bmarks_riscv_dump
) $(bmarks_riscv_hex
)
142 run-riscv
: $(bmarks_riscv_out
)
143 echo
; perl
-ne
'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
145 junk
+= $(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(bmarks_riscv_hex
) $(bmarks_riscv_out
)
148 #------------------------------------------------------------
153 #------------------------------------------------------------
156 date_suffix
= $(shell date
+%Y-
%m-
%d_
%H-
%M
)
157 install_dir
= $(instbasedir
)/$(instname
)-$(date_suffix
)
158 latest_install
= $(shell ls
-1 -d
$(instbasedir
)/$(instname
)* | tail
-n
1)
162 cp
-r
$(bmarks_riscv_bin
) $(bmarks_riscv_dump
) $(install_dir
)
165 rm -rf
$(instbasedir
)/$(instname
)
166 ln
-s
$(latest_install
) $(instbasedir
)/$(instname
)
168 #------------------------------------------------------------
172 rm -rf
$(objs
) $(junk
)