From: Sadoon Albader Date: Fri, 8 Sep 2023 14:47:41 +0000 (+0300) Subject: verilator optimizations up to 25% speedup X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=844de1745beb7f484239f0f5d443e5457744f09c;p=microwatt.git verilator optimizations up to 25% speedup --- diff --git a/Makefile b/Makefile index b764793..cca51a6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ GHDL ?= ghdl GHDLFLAGS=--std=08 -frelaxed CFLAGS=-O3 -Wall + +ifeq ($(shell uname -m),ppc64le) +CFLAG_ARCH_OPT=-mcpu=native +else +CFLAG_ARCH_OPT=-march=native +endif + +CFLAGS=-O3 -Wall $(CFLAG_ARCH_OPT) -mtune=native CXXFLAGS=-g -g GHDLSYNTH ?= ghdl.so @@ -250,6 +258,7 @@ microwatt.v: $(synth_files) $(RAM_INIT_FILE) $(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(GHDL_TARGET_GENERICS) $(synth_files) -e toplevel; write_verilog $@" THREADS=1 # How many threads should be used for verilator binary +THREADS=3 # How many threads should be used for verilator binary, 3 is optimal # Need to investigate why yosys is hitting verilator warnings, and eventually turn on -Wall # --top-module toplevel microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uart-verilator.c @@ -266,6 +275,11 @@ microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uar -Wno-WIDTH \ --savable \ --trace \ + --threads-dpi all --x-initial fast \ + -CFLAGS $(CFLAG_ARCH_OPT) \ + -CFLAGS -mtune=native \ + -CFLAGS -O3 \ + # -CFLAGS -flto #disabled for now, no measured performance benefit \ # --unroll-count 256 \ # --output-split 5000 \ # --output-split-cfuncs 500 \