Improved build system's handling of verilator
This commit is contained in:
parent
e8b84a38b6
commit
8070d4e58a
@ -13,6 +13,7 @@ NUMACTL=#numactl -m 0 -C 0,1 --
|
||||
|
||||
ifeq "${QUIET}" "1"
|
||||
QUIET_AS = @echo ' AS '$@;
|
||||
QUIET_CC = @echo ' CC '$@;
|
||||
QUIET_VVP = @echo ' VVP '$@;
|
||||
QUIET_IVERILOG = @echo ' IVERILOG '$@;
|
||||
QUIET_VERILATOR = @echo ' VERILATOR '$@;
|
||||
|
@ -29,14 +29,31 @@ MICROCODE=ucode.txt
|
||||
NO_ASM=0
|
||||
include ../common.mk
|
||||
|
||||
#build options
|
||||
VERILATOR_OPTS += --cc --exe
|
||||
|
||||
#binary options
|
||||
VERILATOR_OPTS += --trace-fst --threads 1 --autoflush
|
||||
|
||||
#linter options
|
||||
VERILATOR_OPTS += -Wall --Wno-DECLFILENAME -Wno-SYNCASYNCNET -Wno-MULTIDRIVEN
|
||||
|
||||
#optimisation options
|
||||
VERILATOR_OPTS += -x-assign fast --x-initial fast
|
||||
#For testing use:
|
||||
#VERILATOR_OPTS=-x-assign unique --x-initial unique
|
||||
|
||||
# COMPILING
|
||||
${SYSTEM_VVP} : ${TOP_LEVEL_SOURCE} ${SOURCES} ${INCLUDES} ${EVENT_SIM_TESTBENCH}
|
||||
${QUIET_IVERILOG}
|
||||
${Q}iverilog -g2012 -o "$@" ${TOP_LEVEL_SOURCE} ${SOURCES} ${EVENT_SIM_TESTBENCH}
|
||||
|
||||
${VERILATOR_BIN}: ${VERILATOR_TESTBENCH} ${TOP_LEVEL_SOURCE} ${SOURCES} ${INCLUDES}
|
||||
${VERILATOR_BIN}: ${VERILATOR_BIN}.mk
|
||||
${Q}make ${MAKEOPTS} OPT_FAST="-O2 -march=native -mtune=native" -C obj_dir -f ../verilator_makefile Vsystem
|
||||
|
||||
${VERILATOR_BIN}.mk: ${VERILATOR_TESTBENCH} ${TOP_LEVEL_SOURCE} ${SOURCES} ${INCLUDES}
|
||||
${QUIET_VERILATOR}
|
||||
${Q}verilator --trace-fst --cc --exe --build -j 0 $^ -Wall --Wno-DECLFILENAME -Wno-SYNCASYNCNET -Wno-MULTIDRIVEN 2>&1 --threads 1 --autoflush >/dev/null #TODO: remove the silencing and make the generated Makefiles print quietly as well
|
||||
${Q}verilator ${VERILATOR_OPTS} $^
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
21
system/verilator_makefile
Normal file
21
system/verilator_makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# This file is basicly to make verilator compilation look pretty.
|
||||
# If the project doesn't compile it might be because verilator handles compilation
|
||||
# differently and this patch doesn't work anymore. In such case remove everything
|
||||
# except the include Vsystem.mk line and try again.
|
||||
VM_DEFAULT_RULES=0
|
||||
|
||||
include Vsystem.mk
|
||||
|
||||
include ../../common.mk
|
||||
|
||||
%.o: %.cpp
|
||||
${QUIET_CC}
|
||||
${Q}$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<
|
||||
|
||||
$(VK_SLOW_OBJS): %.o: %.cpp
|
||||
${QUIET_CC}
|
||||
${Q}$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_SLOW) -c -o $@ $<
|
||||
|
||||
$(VK_GLOBAL_OBJS): %.o: %.cpp
|
||||
${QUIET_CC}
|
||||
${Q}$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_GLOBAL) -c -o $@ $<
|
Loading…
Reference in New Issue
Block a user