# ------------------------------------------------- # Global options # ------------------------------------------------- LANG_STD := 93c IEEE_STD := standard WORK_PATH := work SOURCE_PATH := src LIB_PATH := ../lib # ------------------------------------------------- # Target options # ------------------------------------------------- TARGET := tb_cpu SOURCES := $(SOURCE_PATH)/cpu_pkg.vhd \ $(SOURCE_PATH)/stack.vhd \ $(SOURCE_PATH)/pc.vhd \ $(SOURCE_PATH)/reg_dual.vhd \ $(SOURCE_PATH)/dpath_ctrl.vhd \ $(SOURCE_PATH)/cpu.vhd \ $(SOURCE_PATH)/alu.vhd \ $(SOURCE_PATH)/$(TARGET).vhd # ------------------------------------------------- GHDL_OPT := --workdir=$(WORK_PATH) --std=$(LANG_STD) --ieee=$(IEEE_STD) # ------------------------------------------------- all: elaborate .PHONY: syntax syntax: ghdl -s $(GHDL_OPT) $(SOURCES) import: ghdl -i $(GHDL_OPT) $(LIB_PATH)/*.vhd $(SOURCES) analyze: ghdl -a $(GHDL_OPT) $(LIB_PATH)/*.vhd $(SOURCES) anaborate: ghdl -c $(GHDL_OPT) $(LIB_PATH)/*.vhd $(SOURCES) -e $(TARGET) makeunit: analyze ghdl -m $(GHDL_OPT) $(TARGET) elaborate: analyze ghdl -e $(GHDL_OPT) $(TARGET) run: elaborate ghdl -r $(GHDL_OPT) $(TARGET) --vcd=$(TARGET).vcd --wave=$(TARGET).ghw --assert-level=error show: $(TARGET).vcd gtkwave $(TARGET).ghw $(TARGET).sav xref: import mkdir -p html ghdl --xref-html $(SOURCES) tree: elaborate ./$(TARGET) --no-run --disp-tree=inst # ------------------------------------------------- .PHONY: clean clean: rm -rf $(TARGET) cd $(WORK_PATH); rm -rf *.o *.cf # -------------------------------------------------