Skip to content

Instantly share code, notes, and snippets.

@fcayci
Created October 24, 2018 19:50
Show Gist options
  • Select an option

  • Save fcayci/e2c5fe3d6b3ce179bdb63de4e5208055 to your computer and use it in GitHub Desktop.

Select an option

Save fcayci/e2c5fe3d6b3ce179bdb63de4e5208055 to your computer and use it in GitHub Desktop.
ghdl makefile
# Make sure ghdl and gtkwave is in your PATH
SRCS = design.vhd
TB = design_tb.vhd
CC = ghdl
SIM = gtkwave
ARCHNAME=$(shell grep architecture $(TB) | cut -f 4 -d ' ')
SIMNAME = wave.vcd
all: check analyze
@echo "Done..."
check:
@echo "Checking the design..."
@$(CC) -s $(SRCS) $(TB)
analyze:
@echo "Analyzing the design..."
@$(CC) -a $(SRCS) $(TB)
simulate:
@echo "Simulating the design..."
@$(CC) -e $(ARCHNAME)
@$(CC) -r $(ARCHNAME) --vcd=$(SIMNAME)
@$(SIM) $(SIMNAME) 2> /dev/null
clean:
@echo "WARNING: Cleaning..."
@rm -f $(ARCHNAME)
@rm -f *.o
@rm -f *.cf
@rm -f $(SIMNAME)
.PHONY: all check analyze simulate clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment