aboutsummaryrefslogtreecommitdiff
path: root/counter/Makefile
diff options
context:
space:
mode:
authorBrian Woods2023-02-24 12:17:46 -0500
committerBrian Woods2023-02-24 13:20:19 -0500
commitd7a11e0e8584e088921c9486c4f064eaf5e004f7 (patch)
treed82a56d3c0fc9e1434aa6cc514f7616bc4c5c092 /counter/Makefile
parent353910fa6f1ef1b1eed5b8c4db6d528e521ce127 (diff)
counter: simple simulation of a countercounter
Diffstat (limited to 'counter/Makefile')
-rw-r--r--counter/Makefile33
1 files changed, 33 insertions, 0 deletions
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