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))
|
2024-01-01 03:09:46 +00:00
|
|
|
CPPSRC += $(SRC_AUTO_BIND)
|
|
|
|
NXDC_FILES = $(abspath constr/top.nxdc)
|
|
|
|
|
2023-12-23 11:41:15 +00:00
|
|
|
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
|
2024-01-01 03:09:46 +00:00
|
|
|
NVBOARD_HOME ?= $(abspath ../nvboard)
|
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:17:34 +00:00
|
|
|
sim: VERILATOR_FLAGS += --trace
|
2023-12-23 12:21:56 +00:00
|
|
|
sim: $(VSRC) $(CPPSRC) $(OBJDIR)/Vexample
|
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 10:28:18 +00:00
|
|
|
|
2023-12-23 12:20:35 +00:00
|
|
|
$(OBJDIR)/Vexample: $(SUBMAKE)
|
2023-12-23 12:20:56 +00:00
|
|
|
$(MAKE) -C $(OBJDIR) -f $(notdir $(SUBMAKE)) Vexample
|
2023-12-23 12:20:35 +00:00
|
|
|
|
2023-12-23 12:17:34 +00:00
|
|
|
$(SUBMAKE): $(VSRC) $(CPPSRC) $(OBJDIR)
|
2024-01-01 03:09:46 +00:00
|
|
|
verilator $(VERILATOR_FLAGS) \
|
|
|
|
--Mdir $(abspath $(OBJDIR)) $(VSRC) $(CPPSRC)
|
|
|
|
# $(addprefix -CFLAGS , $(CXXFLAGS)) $(addprefix -LDFLAGS , $(LDFLAGS)) \
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2023-12-23 12:17:34 +00:00
|
|
|
$(OBJDIR):
|
2023-12-23 09:33:03 +00:00
|
|
|
mkdir -p $(OBJDIR)
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2024-01-01 03:09:46 +00:00
|
|
|
SRC_AUTO_BIND = $(abspath $(PREFIX)/auto_bind.cpp)
|
|
|
|
$(SRC_AUTO_BIND): $(NXDC_FILES)
|
|
|
|
python3 $(NVBOARD_HOME)/scripts/auto_pin_bind.py $^ $@
|
|
|
|
|
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)
|