restructure testbenches and common code

This commit is contained in:
2022-12-01 00:45:57 -07:00
parent a2b0b2a709
commit ebc3b22ac7
7 changed files with 184 additions and 8 deletions

23
lib/tb/Makefile Normal file
View File

@@ -0,0 +1,23 @@
all: verify
TESTBENCH_V = $(wildcard *_tb.sv)
SOURCE_V = $(wildcard ../*.v ../*.sv)
LOGS = $(TESTBENCH_V:.sv=.log)
# Hardware compilation
%.out: %.sv $(SOURCE_V)
iverilog -g2012 -o $@ $^
# Run test
%.vcd %.log: %.out
./$< | tee $(patsubst %.out, %.log, $<)
verify: $(LOGS)
@! grep -q "ERROR" $^
@grep -q "SUCCESS" $^
clean:
rm -rf *.vcd *.log *.out
.SECONDARY: %.log %.vcd
.PHONY: all clean verify