From 7e2de602ee5277354b97df1eb57dd947f0e84b42 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 13 Aug 2021 15:04:06 +1000 Subject: [PATCH] makefile: Simplify microwatt-verilator target, add Docker image Recent versions of verilator support the --build option, allowing us to remove a step. Also add a Docker image for verilator. Signed-off-by: Anton Blanchard --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a4b8df5..63c0c6f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ GHDL ?= ghdl GHDLFLAGS=--std=08 CFLAGS=-O3 -Wall -VERILATOR_FLAGS=-O3 #--trace +# Need to investigate why yosys is hitting verilator warnings, and eventually turn on -Wall +VERILATOR_FLAGS=-O3 -Wno-fatal -Wno-CASEOVERLAP -Wno-UNOPTFLAT #--trace # It takes forever to build with optimisation, so disable by default #VERILATOR_CFLAGS=-O3 @@ -11,6 +12,7 @@ NEXTPNR ?= nextpnr-ecp5 ECPPACK ?= ecppack OPENOCD ?= openocd VUNITRUN ?= python3 ./run.py +VERILATOR ?= verilator # We need a version of GHDL built with either the LLVM or gcc backend. # Fedora provides this, but other distros may not. Another option is to use @@ -39,6 +41,7 @@ NEXTPNR = $(DOCKERBIN) $(DOCKERARGS) hdlc/nextpnr:ecp5 nextpnr-ecp5 ECPPACK = $(DOCKERBIN) $(DOCKERARGS) hdlc/prjtrellis ecppack OPENOCD = $(DOCKERBIN) $(DOCKERARGS) --device /dev/bus/usb hdlc/prog openocd VUNITRUN = $(DOCKERBIN) $(DOCKERARGS) ghdl/vunit:llvm python3 ./run.py +VERILATOR = $(DOCKERBIN) $(DOCKERARGS) verilator/verilator:latest endif VUNITARGS += -p10 @@ -201,10 +204,8 @@ microwatt.json: $(synth_files) $(RAM_INIT_FILE) microwatt.v: $(synth_files) $(RAM_INIT_FILE) $(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; write_verilog $@" -# Need to investigate why yosys is hitting verilator warnings, and eventually turn on -Wall microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uart-verilator.c - verilator $(VERILATOR_FLAGS) -CFLAGS "$(VERILATOR_CFLAGS) -DCLK_FREQUENCY=$(CLK_FREQUENCY)" --assert --cc $< --exe verilator/microwatt-verilator.cpp verilator/uart-verilator.c -o $@ -Iuart16550 -Wno-fatal -Wno-CASEOVERLAP -Wno-UNOPTFLAT - make -C obj_dir -f Vmicrowatt.mk + $(VERILATOR) $(VERILATOR_FLAGS) -CFLAGS "$(VERILATOR_CFLAGS) -DCLK_FREQUENCY=$(CLK_FREQUENCY)" -Iuart16550 --assert --cc --exe --build $^ -o $@ @cp -f obj_dir/microwatt-verilator microwatt-verilator microwatt_out.config: microwatt.json $(LPF) -- 2.30.2