Files
vortex/rtl/Makefile
wgulian3 f126a23114 Generate define overrides based on env vars for C and Verilog.
gen_config.py has two main jobs. First it parses env vars for anything starting with V_ and treats this as an override define. These defines are inserted into the emitted .h and .v headers with correct syntax for C and Verilog preprocessors, respectively. Second, it translates VX_define.v including all conditional definition rules into a C header. This way, all values defined in VX_define.v can also be referenced in corresponding runtime or Verilator code.
2020-03-26 04:08:43 -04:00

93 lines
2.4 KiB
Makefile

all: RUNFILE
INCLUDE=-I. -Ishared_memory -Icache -IVX_cache -IVX_cache/interfaces -Iinterfaces/ -Ipipe_regs/ -Icompat/ -Isimulate
SINGLE_CORE=Vortex.v
MULTI_CORE=Vortex_SOC.v
EXE=--exe ./simulate/test_bench.cpp
MULTI_EXE=--exe ./simulate/multi_test_bench.cpp
COMP=--compiler gcc --language 1800-2009
WNO=-Wno-UNDRIVEN --Wno-PINMISSING -Wno-STMTDLY -Wno-WIDTH -Wno-UNSIGNED -Wno-UNOPTFLAT -Wno-LITENDIAN
# WNO=
# LIGHTW=
LIGHTW=-Wno-UNOPTFLAT
# LIB=-LDFLAGS '-L/usr/local/systemc/'
LIB=
CF=-CFLAGS '-std=c++11 -fms-extensions'
CFRel=-CFLAGS '-std=c++11 -fms-extensions -O3 -DVL_THREADED'
DEB=--trace --prof-cfuncs -DVL_DEBUG=1
MAKECPP=(cd obj_dir && make -j -f VVortex.mk OPT='-DVL_DEBUG' VL_DEBUG=1 DVL_DEBUG=1)
MAKECPPRel=(cd obj_dir && make -j -f VVortex.mk)
MAKEMULTICPP=(cd obj_dir && make -j -f VVortex_SOC.mk OPT='-DVL_DEBUG' VL_DEBUG=1 DVL_DEBUG=1)
THREADS ?= $(shell python3 -c 'import multiprocessing as mp; print(max(1, mp.cpu_count() // 2))' )
.PHONY: build_config
build_config:
./gen_config.py --rtl_locations
# -LDFLAGS '-lsystemc'
VERILATOR: build_config
echo "#define VCD_OFF" > simulate/tb_debug.h
verilator $(COMP) -cc $(SINGLE_CORE) $(INCLUDE) $(EXE) $(LIB) $(CF) $(LIGHTW)
VERILATORnoWarnings: build_config
echo "#define VCD_OFF" > simulate/tb_debug.h
verilator $(COMP) -cc $(SINGLE_CORE) $(INCLUDE) $(EXE) $(LIB) $(CF) $(WNO) $(DEB)
VERILATORnoWarningsRel: build_config
echo "#define VCD_OFF" > simulate/tb_debug.h
verilator $(COMP) -cc $(SINGLE_CORE) $(INCLUDE) $(EXE) $(LIB) $(CFRel) $(WNO) --threads $(THREADS)
VERILATORMULTInoWarnings: build_config
echo "#define VCD_OFF" > simulate/tb_debug.h
verilator $(COMP) -cc $(MULTI_CORE) $(INCLUDE) $(MULTI_EXE) $(LIB) $(CF) $(WNO) $(DEB)
compdebug: build_config
echo "#define VCD_OUTPUT" > simulate/tb_debug.h
verilator_bin_dbg $(COMP) -cc $(SINGLE_CORE) $(INCLUDE) $(EXE) $(LIB) -CFLAGS '-std=c++11 -DVL_DEBUG' $(WNO) $(DEB)
compdebugmulti: build_config
echo "#define VCD_OUTPUT" > simulate/tb_debug.h
verilator_bin_dbg $(COMP) -cc $(MULTI_CORE) $(INCLUDE) $(MULTI_EXE) $(LIB) -CFLAGS '-std=c++11 -DVL_DEBUG' $(WNO) $(DEB)
RUNFILE: VERILATOR
$(MAKECPP)
debug: compdebug
$(MAKECPP)
w: VERILATORnoWarnings
$(MAKECPP)
wRel: VERILATORnoWarningsRel
$(MAKECPPRel)
multicore: VERILATORMULTInoWarnings
$(MAKEMULTICPP)
dmulticore: compdebugmulti
$(MAKEMULTICPP)
run: w
(cd obj_dir && ./VVortex)
runRel: wRel
(cd obj_dir && ./VVortex)
clean:
rm -rf obj_dir