From 2e5b437fc94aa989ca81aa820739178281d218d8 Mon Sep 17 00:00:00 2001 From: Brian Woods Date: Thu, 23 Mar 2023 22:30:40 -0400 Subject: counter_v: add counter example in verilog Uses icarus verilog and gtkwave to simulate a simple counter. --- counter_v/Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 counter_v/Makefile (limited to 'counter_v/Makefile') diff --git a/counter_v/Makefile b/counter_v/Makefile new file mode 100644 index 0000000..9f096cd --- /dev/null +++ b/counter_v/Makefile @@ -0,0 +1,29 @@ +# 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.v top.v counter.v +# top module, we also use this for the object name +TOP=sim_test +# this needs to match what's in top sim file +WAVE_DUMP=simulation.vcd +WAVE_CONF=$(TOP).gtkw +FLAGS= + +.PHONY: all clean sim + +all: $(TOP) + +$(TOP): $(SRC) + iverilog -o $@ $(FLAGS) -s $@ $^ + +$(WAVE_DUMP): $(TOP) + vvp $< + +sim: $(WAVE_DUMP) + gtkwave --save $(WAVE_CONF) --saveonexit $< + +clean: + rm -f $(TOP) $(WAVE_DUMP) $(WAVE_CONF) -- cgit v1.2.3