Skip to content

Instantly share code, notes, and snippets.

@moriglia
Created October 4, 2023 09:47
Show Gist options
  • Save moriglia/b703a8cbd295c37c5bd0c109d43bf477 to your computer and use it in GitHub Desktop.
Save moriglia/b703a8cbd295c37c5bd0c109d43bf477 to your computer and use it in GitHub Desktop.
Makefile for running verilog testbenches
OUTDIR ?= build
IPROOT ?= ../..
IPPATT ?= $(foreach dir,$(wildcard $(IPROOT)/*/hdl),-y$(dir))
.PHONY: setup default
default: $(OUTDIR)/$(subst .v,.vcd,$(shell find . -name "tb_*.v" -printf "%P\n"))
setup: build
build:
rm -rf build
ln -s -n $(shell mktemp -d /tmp/icarus-session-XXXXXX) build
$(OUTDIR)/tb_%.vvp : tb_%.v ../hdl/%.v build
iverilog -o $@ $< $(IPPATT)
$(OUTDIR)/tb_%.vcd: $(OUTDIR)/tb_%.vvp
vvp $< -dumpfile=$@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment