build test code into build directory

This commit is contained in:
2021-07-02 01:28:23 -06:00
parent 180f05fb0a
commit efd4cb6e48
4 changed files with 34 additions and 29 deletions

20
Makefile Normal file
View File

@@ -0,0 +1,20 @@
BUILD_DIR = build
SOURCE_V = $(wildcard hdl/*.v)
TESTBENCH_V = $(wildcard hdl/tb/*.v)
all: sim
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/tb.out: $(SOURCE_V) $(TESTBENCH_V) | $(BUILD_DIR)
iverilog $^ -o $@
sim: $(BUILD_DIR)/tb.out
cd $(BUILD_DIR) && ./tb.out
clean:
rm -rf $(BUILD_DIR)
.SECONDARY:
.PHONY: all clean sim