1 Star 0 Fork 0

alapha23/riscv-mini

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
Donggyu Kim 提交于 2018-05-11 19:40 . support custom benchmark
default: compile
base_dir = $(abspath .)
src_dir = $(base_dir)/src/main
gen_dir = $(base_dir)/generated-src
out_dir = $(base_dir)/outputs
SBT = sbt
SBT_FLAGS = -ivy $(base_dir)/.ivy2
sbt:
$(SBT) $(SBT_FLAGS)
compile: $(gen_dir)/Tile.v
$(gen_dir)/Tile.v: $(wildcard $(src_dir)/scala/*.scala)
$(SBT) $(SBT_FLAGS) "run $(gen_dir)"
CXXFLAGS += -std=c++11 -Wall -Wno-unused-variable
# compile verilator
VERILATOR = verilator --cc --exe
VERILATOR_FLAGS = --assert -Wno-STMTDLY -O3 --trace \
--top-module Tile -Mdir $(gen_dir)/VTile.csrc \
-CFLAGS "$(CXXFLAGS) -include $(gen_dir)/VTile.csrc/VTile.h"
$(base_dir)/VTile: $(gen_dir)/Tile.v $(src_dir)/cc/top.cc $(src_dir)/cc/mm.cc $(src_dir)/cc/mm.h
$(VERILATOR) $(VERILATOR_FLAGS) -o $@ $< $(word 2, $^) $(word 3, $^)
$(MAKE) -C $(gen_dir)/VTile.csrc -f VTile.mk
verilator: $(base_dir)/VTile
# isa tests + benchmarks with verilator
test_hex_files = $(wildcard $(base_dir)/src/test/resources/*.hex)
test_out_files = $(foreach f,$(test_hex_files),$(patsubst %.hex,%.out,$(out_dir)/$(notdir $f)))
$(test_out_files): $(out_dir)/%.out: $(base_dir)/VTile $(base_dir)/src/test/resources/%.hex
mkdir -p $(out_dir)
$^ $(patsubst %.out,%.vcd,$@) 2> $@
run-tests: $(test_out_files)
# run custom benchamrk
custom_bmark_hex ?= $(base_dir)/custom-bmark/main.hex
custom_bmark_out = $(patsubst %.hex,%.out,$(out_dir)/$(notdir $(custom_bmark_hex)))
$(custom_bmark_hex):
$(MAKE) -C custom-bmark
$(custom_bmark_out): $(base_dir)/VTile $(custom_bmark_hex)
mkdir -p $(out_dir)
$^ $(patsubst %.out,%.vcd,$@) 2> $@
run-custom-bmark: $(custom_bmark_out)
# unit tests + integration tests
test:
$(SBT) $(SBT_FLAGS) test
clean:
rm -rf $(gen_dir) $(out_dir) test_run_dir
cleanall: clean
rm -rf target project/target
.PHONY: sbt compile verilator run-tests run-custom-bmark test clean cleanall
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alapha23/riscv-mini.git
git@gitee.com:alapha23/riscv-mini.git
alapha23
riscv-mini
riscv-mini
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385