tb_cxxrtl Makefile: better support for building multiple tb configurations

This commit is contained in:
Luke Wren 2023-03-24 18:44:37 +00:00
parent cbb490da6a
commit 97509f548a
2 changed files with 12 additions and 7 deletions

View File

@ -1,2 +1,5 @@
tb tb
dut.cpp dut.cpp
build.*
tb_multicore

View File

@ -1,20 +1,22 @@
TOP := tb TOP := tb
DOTF := tb.f DOTF := tb.f
CONFIG := default CONFIG := default
TBEXEC := $(patsubst %.f,%,DOTF)
.PHONY: clean all .PHONY: clean all
all: tb all: $(TBEXEC)
SYNTH_CMD += read_verilog -I ../../../hdl -DCONFIG_HEADER="config_$(CONFIG).vh" $(shell listfiles $(DOTF)); SYNTH_CMD += read_verilog -I ../../../hdl -DCONFIG_HEADER="config_$(CONFIG).vh" $(shell listfiles $(DOTF));
SYNTH_CMD += hierarchy -top $(TOP); SYNTH_CMD += hierarchy -top $(TOP);
SYNTH_CMD += write_cxxrtl dut.cpp SYNTH_CMD += write_cxxrtl build-$(DOTF)/dut.cpp
dut.cpp: $(shell listfiles $(DOTF)) build-$(DOTF)/dut.cpp: $(shell listfiles $(DOTF))
yosys -p '$(SYNTH_CMD)' 2>&1 > cxxrtl.log mkdir -p build-$(DOTF)
yosys -p '$(SYNTH_CMD)' 2>&1 > build-$(DOTF)/cxxrtl.log
clean:: clean::
rm -f dut.cpp cxxrtl.log tb rm -f build-$(DOTF) $(TBEXEC)
tb: dut.cpp tb.cpp $(TBEXEC): build-$(DOTF)/dut.cpp tb.cpp
clang++ -O3 -std=c++14 $(addprefix -D,$(CDEFINES)) -I $(shell yosys-config --datdir)/include tb.cpp -o tb clang++ -O3 -std=c++14 $(addprefix -D,$(CDEFINES)) -I $(shell yosys-config --datdir)/include -I build-$(DOTF) tb.cpp -o $(TBEXEC)