From d7a11e0e8584e088921c9486c4f064eaf5e004f7 Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Fri, 24 Feb 2023 12:17:46 -0500 Subject: counter: simple simulation of a counter --- counter/Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 counter/Makefile (limited to 'counter/Makefile') diff --git a/counter/Makefile b/counter/Makefile new file mode 100644 index 0000000..da512e5 --- /dev/null +++ b/counter/Makefile @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2023 Brian Woods +# SPDX-License-Identifier: GPL-2.0-or-later + +# this is for ghdl-gcc, I've not tested it on ghdl-llvm but it will not +# work with ghdl-mcode + +SRC=simulation.vhd top.vhd counter.vhd +OBJ=$(SRC:.vhd=.o) +TOP=simulation +TOP_OBJ=e~$(TOP).o +WAVE=simulation.ghw +WORKLIB=work +FLAGS=--std=08 --work=$(WORKLIB) +TIME=1us + +.PHONY: all clean sim + +all: $(TOP) + +%.o: %.vhd + ghdl -a $(FLAGS) $< + +$(TOP): $(OBJ) + ghdl -e $(FLAGS) $@ + +$(WAVE): $(TOP) + ghdl -r $(FLAGS) $< --wave=$@ --stop-time=$(TIME) + +sim: $(WAVE) + gtkwave $< + +clean: + rm -f $(OBJ) $(TOP_OBJ) $(TOP) $(WAVE) $(WORKLIB)-obj*.cf -- cgit v1.2.3