change dir structure
This commit is contained in:
89
sims/verisim/Makefile
Normal file
89
sims/verisim/Makefile
Normal file
@@ -0,0 +1,89 @@
|
||||
base_dir=$(abspath ../..)
|
||||
sim_dir=$(abspath .)
|
||||
|
||||
PROJECT ?= example
|
||||
MODEL ?= TestHarness
|
||||
CONFIG ?= DefaultExampleConfig
|
||||
CFG_PROJECT ?= $(PROJECT)
|
||||
TB ?= TestDriver
|
||||
TOP ?= ExampleTop
|
||||
|
||||
sim_name = verilator
|
||||
|
||||
sim = $(sim_dir)/simulator-$(PROJECT)-$(CONFIG)
|
||||
sim_debug = $(sim_dir)/simulator-$(PROJECT)-$(CONFIG)-debug
|
||||
|
||||
default: $(sim)
|
||||
|
||||
debug: $(sim_debug)
|
||||
|
||||
CXXFLAGS := $(CXXFLAGS) -O1 -std=c++11 -I$(RISCV)/include -D__STDC_FORMAT_MACROS
|
||||
LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L$(sim_dir) -lfesvr -lpthread
|
||||
|
||||
include $(base_dir)/Makefrag
|
||||
include $(sim_dir)/Makefrag-verilator
|
||||
ifneq ($(filter run% %.run %.out %.vpd %.vcd,$(MAKECMDGOALS)),)
|
||||
-include $(build_dir)/$(long_name).d
|
||||
endif
|
||||
|
||||
sim_blackboxes = \
|
||||
$(build_dir)/firrtl_black_box_resource_files.f
|
||||
|
||||
rocketchip_vsrc_dir = $(ROCKETCHIP_DIR)/src/main/resources/vsrc
|
||||
|
||||
sim_vsrcs = \
|
||||
$(VERILOG_FILE) \
|
||||
$(HARNESS_FILE) \
|
||||
$(SMEMS_FILE)
|
||||
|
||||
model_dir = $(build_dir)/$(long_name)
|
||||
model_dir_debug = $(build_dir)/$(long_name).debug
|
||||
|
||||
model_header = $(model_dir)/V$(MODEL).h
|
||||
model_header_debug = $(model_dir_debug)/V$(MODEL).h
|
||||
|
||||
model_mk = $(model_dir)/V$(MODEL).mk
|
||||
model_mk_debug = $(model_dir_debug)/V$(MODEL).mk
|
||||
|
||||
$(model_mk): $(sim_vsrcs) $(sim_dotf) $(INSTALLED_VERILATOR)
|
||||
rm -rf $(build_dir)/$(long_name)
|
||||
mkdir -p $(build_dir)/$(long_name)
|
||||
$(VERILATOR) $(VERILATOR_FLAGS) -Mdir $(build_dir)/$(long_name) \
|
||||
-o $(sim) $(sim_vsrcs) -f $(sim_dotf) -f $(sim_blackboxes) -LDFLAGS "$(LDFLAGS)" \
|
||||
-CFLAGS "-I$(build_dir) -include $(build_dir)/$(long_name).plusArgs -include $(model_header)"
|
||||
touch $@
|
||||
|
||||
$(sim): $(model_mk)
|
||||
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name) -f V$(MODEL).mk
|
||||
|
||||
|
||||
$(model_mk_debug): $(sim_vsrcs) $(sim_dotf) $(INSTALLED_VERILATOR)
|
||||
rm -rf $(build_dir)/$(long_name)
|
||||
mkdir -p $(build_dir)/$(long_name).debug
|
||||
$(VERILATOR) $(VERILATOR_FLAGS) -Mdir $(build_dir)/$(long_name).debug --trace \
|
||||
-o $(sim_debug) $(sim_vsrcs) -f $(sim_dotf) -f $(sim_blackboxes) -LDFLAGS "$(LDFLAGS)" \
|
||||
-CFLAGS "-I$(build_dir) -include $(build_dir)/$(long_name).plusArgs -include $(model_header_debug)"
|
||||
touch $@
|
||||
|
||||
$(sim_debug): $(model_mk_debug)
|
||||
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(MODEL).mk
|
||||
|
||||
$(output_dir)/%.out: $(output_dir)/% $(sim)
|
||||
$(sim) +verbose +max-cycles=1000000 $< 3>&1 1>&2 2>&3 | spike-dasm > $@
|
||||
|
||||
$(output_dir)/%.run: $(output_dir)/% $(sim)
|
||||
$(sim) +max-cycles=1000000 $< && touch $@
|
||||
|
||||
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
|
||||
rm -f $@.vcd && mkfifo $@.vcd
|
||||
vcd2vpd $@.vcd $@ > /dev/null &
|
||||
$(sim_debug) -v$@.vcd +max-cycles=1000000 $<
|
||||
|
||||
run-regression-tests: $(addprefix $(output_dir)/,$(addsuffix .out,$(regression-tests)))
|
||||
|
||||
run-regression-tests-fast: $(addprefix $(output_dir)/,$(addsuffix .run,$(regression-tests)))
|
||||
|
||||
run-regression-tests-debug: $(addprefix $(output_dir)/,$(addsuffix .vpd,$(regression-tests)))
|
||||
|
||||
clean: clean-scala
|
||||
rm -rf generated-src ./simulator-*
|
||||
Reference in New Issue
Block a user