aboutsummaryrefslogtreecommitdiff
path: root/Makefile.example
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-12-24 09:22:34 +0100
committerWojciech Kosior <kwojtus@protonmail.com>2020-12-24 09:22:34 +0100
commitf122fa70e30a7d7744b38fa22bd1d5aa949e8277 (patch)
tree8d0ed8590eb5bb6cbb85ded102a4e4e440f28913 /Makefile.example
parent6abc6fd5a869976b4e31e12908e835827399deec (diff)
downloadAGH-engineering-thesis-f122fa70e30a7d7744b38fa22bd1d5aa949e8277.tar.gz
AGH-engineering-thesis-f122fa70e30a7d7744b38fa22bd1d5aa949e8277.zip
prepare makefile infrastructure for writing examples
Diffstat (limited to 'Makefile.example')
-rw-r--r--Makefile.example39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile.example b/Makefile.example
new file mode 100644
index 0000000..e44cf9c
--- /dev/null
+++ b/Makefile.example
@@ -0,0 +1,39 @@
+# This Makefile is to be included by Makefile of each example
+
+ifndef PROJ_DIR
+PROJ_DIR := ../../
+endif
+
+def : simulate
+
+include $(PROJ_DIR)/Makefile.util
+
+DESIGN_DIR := $(PROJ_DIR)/design/
+FONT := $(DESIGN_DIR)/font.mem
+
+IVFLAGS += -I$(PROJ_DIR)/include/
+
+ROM_DEFINES = \
+ -DROM_WORDS_COUNT=$(call FILE_LINES,instructions.mem) \
+ -DEMBEDDED_ROM_FILE=\"instructions.mem\" \
+ -DFONT_FILE=\"$(FONT)\"
+
+example.vvp : $(DESIGN_DIR)/*.v soc_with_peripherals.v flash_memory.v sram.v \
+ vga_display.v example_toplevel.v $(FONT) messages.vh \
+ instructions.mem
+ $(IV) $(IVFLAGS) $(SIMFLAGS) -DSIMULATION $(ROM_DEFINES) \
+ -s example $(filter %.v,$^) -o $@
+
+simulate : example.vvp
+ $(VVP) $<
+
+design.v : instructions.mem $(DESIGN_DIR)/*.v $(FONT)
+ $(IV) $(IVFLAGS) $(ROM_DEFINES) -E $(filter %.v,$^) -o $@
+
+clean :
+ find . -name "*.vvp" -delete
+ rm $(call FIND_GENERATED_FILES,.) $(addprefix design.,v json asc bin) \
+ $(addsuffix .log,yosys pnr) VGAdump.mem VGAdump.ppm \
+ 2>/dev/null || true
+
+.PHONY : def simulate clean