2023-12-23 09:27:29 +00:00
|
|
|
VSRC := $(wildcard vsrc/*.v)
|
2023-12-23 11:41:15 +00:00
|
|
|
CPPSRC := $(addprefix $(PWD)/,$(wildcard csrc/*.cpp))
|
|
|
|
PREFIX ?= build
|
2023-12-23 09:29:41 +00:00
|
|
|
OBJDIR := $(PREFIX)/obj
|
2023-12-23 12:12:41 +00:00
|
|
|
SUBMAKE := $(OBJDIR)/Vexample.mk
|
2023-12-23 12:10:23 +00:00
|
|
|
VERILATOR_FLAGS := --cc --exe
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2023-12-23 12:12:41 +00:00
|
|
|
all: sim
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2023-12-23 12:12:41 +00:00
|
|
|
sim: $(OBJDIR) $(VSRC) $(CPPSRC) $(SUBMAKE)
|
2023-12-23 09:27:29 +00:00
|
|
|
$(call git_commit, "sim RTL") # DO NOT REMOVE THIS LINE!!!
|
2023-12-23 11:41:35 +00:00
|
|
|
@echo "Running" $(OBJDIR)/Vexample "..."
|
|
|
|
@echo "================================"
|
2023-12-23 12:12:41 +00:00
|
|
|
@$(OBJDIR)/Vexample
|
2023-12-23 12:00:32 +00:00
|
|
|
|
2023-12-23 12:10:23 +00:00
|
|
|
trace: VERILATOR_FLAGS += --trace
|
2023-12-23 12:12:41 +00:00
|
|
|
trace: $(OBJDIR) $(VSRC) $(CPPSRC) $(SUBMAKE)
|
2023-12-23 12:00:32 +00:00
|
|
|
$(call git_commit, "trace RTL") # DO NOT REMOVE THIS LINE!!!
|
2023-12-23 11:50:34 +00:00
|
|
|
@$(OBJDIR)/Vexample
|
2023-12-23 10:28:18 +00:00
|
|
|
|
2023-12-23 12:12:41 +00:00
|
|
|
$(SUBMAKE): $(VSRC) $(CPPSRC)
|
|
|
|
verilator $(VERILATOR_FLAGS) --Mdir $(PWD)/$(OBJDIR) $(VSRC) $(CPPSRC)
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2023-12-23 09:33:03 +00:00
|
|
|
$(OBJDIR): $(VSRC) $(CPPSRC)
|
|
|
|
mkdir -p $(OBJDIR)
|
2023-12-23 12:10:23 +00:00
|
|
|
verilator $(VERILATOR_FLAGS) --Mdir $(PWD)/$(OBJDIR) $(VSRC) $(CPPSRC)
|
2023-12-23 09:27:29 +00:00
|
|
|
|
|
|
|
include ../Makefile
|
2023-12-23 09:33:39 +00:00
|
|
|
|
2023-12-23 10:28:18 +00:00
|
|
|
.PHONY: clean
|
2023-12-23 09:33:39 +00:00
|
|
|
|
|
|
|
clean:
|
2023-12-23 11:32:07 +00:00
|
|
|
$(RM) -r $(OBJDIR)
|