Created
May 23, 2014 06:48
-
-
Save tanitanin/04d7ef132cd0ae18c0c6 to your computer and use it in GitHub Desktop.
Verilog simulation by using iVerilog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile for iVerilog testing | |
SRC_DIR := src | |
TEST_DIR := test | |
SIM_DIR := sim | |
TESTS := $(sort $(patsubst $(TEST_DIR)/%.v,$(SIM_DIR)/%.vcd,$(wildcard $(TEST_DIR)/test_*.v))) | |
VERILOGS := $(sort $(wildcard $(SRC_DIR)/*.v)) | |
.PHONY: $(SIM_DIR)/test_%.sim | |
$(SIM_DIR)/test_%.sim: $(TEST_DIR)/test_%.v | |
iverilog -o $@ -s test_$* $< $(VERILOGS) | |
.PHONY: $(SIM_DIR)/test_%.vcd | |
$(SIM_DIR)/test_%.vcd: $(SIM_DIR)/test_%.sim | |
vvp -l $(patsubst %.sim,%.log,$<) $< | |
.PHONY: all | |
all: test | |
.PHONY: test | |
test: $(TESTS) | |
.PHONY: wave | |
%: $(SIM_DIR)/test_%.vcd | |
gtkwave $< & | |
.PHONY: clean | |
clean: | |
rm -rf sim/*.sim sim/test_*.vcd sim/*.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment