2014-09-01 05:26:55 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Sources
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Verilog sources
|
|
|
|
|
2017-03-28 06:24:44 +02:00
|
|
|
bb_vsrcs = \
|
2016-09-02 03:38:39 +02:00
|
|
|
$(base_dir)/vsrc/jtag_vpi.v \
|
2017-05-19 07:49:59 +02:00
|
|
|
$(base_dir)/vsrc/plusarg_reader.v \
|
2017-02-17 11:49:35 +01:00
|
|
|
$(base_dir)/vsrc/ClockDivider2.v \
|
2017-05-14 22:29:36 +02:00
|
|
|
$(base_dir)/vsrc/ClockDivider3.v \
|
2016-09-14 20:50:28 +02:00
|
|
|
$(base_dir)/vsrc/AsyncResetReg.v \
|
2016-08-19 18:46:43 +02:00
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
sim_vsrcs = \
|
2016-09-19 22:46:45 +02:00
|
|
|
$(generated_dir)/$(long_name).v \
|
|
|
|
$(generated_dir)/$(long_name).behav_srams.v \
|
2016-09-02 03:38:39 +02:00
|
|
|
$(base_dir)/vsrc/$(TB).v \
|
2016-08-16 07:03:03 +02:00
|
|
|
$(base_dir)/vsrc/SimDTM.v \
|
2017-04-12 05:03:34 +02:00
|
|
|
$(base_dir)/vsrc/SimJTAG.v \
|
2016-08-19 18:46:43 +02:00
|
|
|
$(bb_vsrcs)
|
2014-09-01 05:26:55 +02:00
|
|
|
|
|
|
|
# C sources
|
|
|
|
|
|
|
|
sim_csrcs = \
|
2016-08-16 07:03:03 +02:00
|
|
|
$(base_dir)/csrc/SimDTM.cc \
|
2017-04-12 05:03:34 +02:00
|
|
|
$(base_dir)/csrc/SimJTAG.cc \
|
|
|
|
$(base_dir)/csrc/remote_bitbang.cc \
|
2018-02-23 21:32:10 +01:00
|
|
|
$(base_dir)/csrc/jtag_vpi.c
|
2014-09-01 05:26:55 +02:00
|
|
|
|
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 "-std=c++11" \
|
|
|
|
-CC "-Wl,-rpath,$(RISCV)/lib" \
|
|
|
|
$(RISCV)/lib/libfesvr.so \
|
2016-06-24 05:54:07 +02:00
|
|
|
-sverilog \
|
2015-10-31 05:14:33 +01:00
|
|
|
+incdir+$(generated_dir) \
|
2016-08-19 23:44:48 +02:00
|
|
|
+define+CLOCK_PERIOD=1.0 $(sim_vsrcs) $(sim_csrcs) \
|
2016-04-02 01:40:13 +02:00
|
|
|
+define+PRINTF_COND=$(TB).printf_cond \
|
2016-08-16 07:03:03 +02:00
|
|
|
+define+STOP_COND=!$(TB).reset \
|
2016-08-29 21:29:01 +02:00
|
|
|
+define+RANDOMIZE_MEM_INIT \
|
|
|
|
+define+RANDOMIZE_REG_INIT \
|
|
|
|
+define+RANDOMIZE_GARBAGE_ASSIGN \
|
|
|
|
+define+RANDOMIZE_INVALID_ASSIGN \
|
2014-09-01 05:26:55 +02:00
|
|
|
+libext+.v \
|
|
|
|
|
2016-08-19 18:46:43 +02:00
|
|
|
VCS_OPTS += +vpi
|
|
|
|
VCS_OPTS += -P $(base_dir)/vsrc/jtag_vpi.tab
|
|
|
|
VCS_OPTS += -CC "-DVCS_VPI"
|
|
|
|
|
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Build the simulator
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2016-09-19 22:46:45 +02:00
|
|
|
simv = $(sim_dir)/simv-$(PROJECT)-$(CONFIG)
|
2017-02-03 04:24:55 +01:00
|
|
|
$(simv) : $(sim_vsrcs) $(sim_csrcs)
|
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
|
|
|
|
2016-09-19 22:46:45 +02:00
|
|
|
simv_debug = $(sim_dir)/simv-$(PROJECT)-$(CONFIG)-debug
|
2017-02-03 04:24:55 +01:00
|
|
|
$(simv_debug) : $(sim_vsrcs) $(sim_csrcs)
|
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
|