2014-09-01 05:26:55 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Sources
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Verilog sources
|
|
|
|
|
|
|
|
sim_vsrcs = \
|
2014-09-12 07:11:58 +02:00
|
|
|
$(generated_dir)/$(MODEL).$(CONFIG).v \
|
|
|
|
$(generated_dir)/consts.$(CONFIG).vh \
|
|
|
|
$(generated_dir)/memdessertMemDessert.$(CONFIG).v \
|
2015-07-17 21:02:02 +02:00
|
|
|
$(base_dir)/vsrc/$(TB).v \
|
2014-09-11 02:14:55 +02:00
|
|
|
$(base_dir)/vsrc/backup_mem.v \
|
2014-09-01 05:26:55 +02:00
|
|
|
|
|
|
|
# C sources
|
|
|
|
|
|
|
|
sim_csrcs = \
|
2015-12-02 02:31:10 +01:00
|
|
|
$(base_dir)/csrc/vcs_main.$(TB).cc \
|
2014-09-01 05:26:55 +02:00
|
|
|
$(base_dir)/csrc/mm.cc \
|
|
|
|
$(base_dir)/csrc/mm_dramsim2.cc \
|
|
|
|
|
2014-09-04 18:49:57 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build Verilog
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
verilog: $(sim_vsrcs)
|
|
|
|
|
|
|
|
.PHONY: verilog
|
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build rules
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
VCS = vcs -full64
|
|
|
|
|
2014-09-25 15:43:03 +02:00
|
|
|
VCS_OPTS = -notice -line +lint=all,noVCDE,noONGS,noUI -error=PCWM-L -timescale=1ns/10ps -quiet \
|
2014-09-01 05:26:55 +02:00
|
|
|
+rad +v2k +vcs+lic+wait \
|
|
|
|
+vc+list -CC "-I$(VCS_HOME)/include" \
|
|
|
|
-CC "-I$(RISCV)/include" \
|
|
|
|
-CC "-I$(realpath $(base_dir))/dramsim2" \
|
|
|
|
-CC "-std=c++11" \
|
|
|
|
-CC "-Wl,-rpath,$(RISCV)/lib" \
|
2015-11-06 01:42:05 +01:00
|
|
|
-CC "-include $(consts_header)" \
|
2016-02-18 00:23:18 +01:00
|
|
|
-CC "-include $(scr_header)" \
|
2014-09-01 05:26:55 +02:00
|
|
|
-e vcs_main \
|
|
|
|
$(RISCV)/lib/libfesvr.so \
|
|
|
|
$(sim_dir)/libdramsim.a \
|
2015-10-31 05:14:33 +01:00
|
|
|
+incdir+$(generated_dir) \
|
2014-09-01 05:26:55 +02:00
|
|
|
+define+CLOCK_PERIOD=0.5 $(sim_vsrcs) $(sim_csrcs) \
|
2015-07-17 21:02:02 +02:00
|
|
|
+define+PRINTF_COND=$(TB).verbose \
|
2014-09-01 05:26:55 +02:00
|
|
|
+libext+.v \
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build the simulator
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2015-07-28 09:23:31 +02:00
|
|
|
simv = $(sim_dir)/simv-$(MODEL)-$(CONFIG)
|
2015-11-05 19:15:02 +01:00
|
|
|
$(simv) : $(sim_vsrcs) $(sim_csrcs) $(sim_dir)/libdramsim.a $(consts_header)
|
2014-09-01 05:26:55 +02:00
|
|
|
cd $(sim_dir) && \
|
2015-11-06 01:42:05 +01:00
|
|
|
rm -rf csrc && \
|
2014-09-01 05:26:55 +02:00
|
|
|
$(VCS) $(VCS_OPTS) -o $(simv) \
|
2015-06-26 08:17:35 +02:00
|
|
|
-debug_pp \
|
2014-09-01 05:26:55 +02:00
|
|
|
|
2015-07-28 09:23:31 +02:00
|
|
|
simv_debug = $(sim_dir)/simv-$(MODEL)-$(CONFIG)-debug
|
2015-11-05 19:15:02 +01:00
|
|
|
$(simv_debug) : $(sim_vsrcs) $(sim_csrcs) $(sim_dir)/libdramsim.a $(consts_header)
|
2014-09-01 05:26:55 +02:00
|
|
|
cd $(sim_dir) && \
|
2015-11-06 01:42:05 +01:00
|
|
|
rm -rf csrc && \
|
2014-09-01 05:26:55 +02:00
|
|
|
$(VCS) $(VCS_OPTS) -o $(simv_debug) \
|
|
|
|
+define+DEBUG -debug_pp \
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Run
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
seed = $(shell date +%s)
|
|
|
|
exec_simv = $(simv) -q +ntb_random_seed_automatic
|
|
|
|
exec_simv_debug = $(simv_debug) -q +ntb_random_seed_automatic
|