summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoruvok2025-12-28 14:01:42 +0100
committeruvok2025-12-28 14:01:42 +0100
commit40245bbc8c364c4e1673332c9fcc243ede6dc264 (patch)
tree1674c34793672b0b07640c69f0d1126a7862a9e8 /Makefile
parentaa6519203d9af798acc9ed46d964705315b3b5d5 (diff)
make: Add rules for verilator simulation
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 15 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 9e0aae7..f6aa04b 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,9 @@ clean:
simu: $(PROGRAM).lxt2
gtkwave $<
+simu2: verilator.$(PROGRAM)/dump.vvp
+ gtkwave $<
+
lint: $(PROGRAM).v
verilator --lint-only -Wall -Wno-PROCASSINIT $(PROGRAM).v
@@ -96,6 +99,18 @@ lint: $(PROGRAM).v
%.vvp: %.v %.tb.v
iverilog -DDUMP_FILE_NAME='"$*.lxt2"' -g2012 -o $*.vvp $*.v $*.tb.v
+# verilog unfortunately exits on any warning
+# also on warnings "boohoo, you specified timings in some modules and not in others"
+# since this is fucking annoying, I choose to ignore the exit code.
+verilator.%: %.v %.tb.v
+ verilator -DDUMP_FILE_NAME='"dump.vvp"' --trace --timing --main --exe --Mdir verilator.$(PROGRAM) $(PROGRAM).tb.v || true
+
+# need to specify RM for some reason
+# verilators makefiles doesn't specify the variable
+verilator.%/dump.vvp: verilator.%
+ $(MAKE) -C verilator.$(*) -f V$(*).mk RM=rm
+ cd verilator.$(*) && ./V$(*)
+
## inter-file dependencies
-include $(DEPS)
-include $($(wildcard *.fs:.fs=.dep)