2024-01-13 11:08:31 +08:00
|
|
|
PLDM_TB_TOP = tb_top
|
|
|
|
PLDM_TOP_MODULE = $(SIM_TOP)
|
|
|
|
|
2024-02-08 16:30:59 +08:00
|
|
|
PLDM_SCRIPTS_DIR = $(abspath ./scripts/palladium)
|
2024-01-13 11:08:31 +08:00
|
|
|
PLDM_BUILD_DIR = $(abspath $(BUILD_DIR)/pldm-compile)
|
|
|
|
PLDM_CC_OBJ_DIR = $(abspath $(PLDM_BUILD_DIR)/cc_obj)
|
|
|
|
|
|
|
|
# Macro Flags
|
|
|
|
PLDM_MACRO_FLAGS = +define+TOP_MODULE=$(PLDM_TOP_MODULE)
|
|
|
|
PLDM_MACRO_FLAGS += +define+PALLADIUM
|
|
|
|
PLDM_MACRO_FLAGS += +define+RANDOMIZE_MEM_INIT
|
|
|
|
PLDM_MACRO_FLAGS += +define+RANDOMIZE_REG_INIT
|
|
|
|
PLDM_MACRO_FLAGS += +define+RANDOMIZE_DELAY=0
|
2024-01-22 11:57:30 +08:00
|
|
|
ifeq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
PLDM_MACRO_FLAGS += +define+SYNTHESIS +define+TB_NO_DPIC
|
|
|
|
else
|
2024-03-01 13:46:26 +08:00
|
|
|
PLDM_MACRO_FLAGS += +define+DIFFTEST +define+DISABLE_SIMJTAG_DPIC
|
|
|
|
ifneq ($(DIFFTEST_RAM_DPIC), 1)
|
|
|
|
PLDM_MACRO_FLAGS += +define+DISABLE_DIFFTEST_RAM_DPIC
|
|
|
|
endif
|
2024-03-11 09:23:07 +08:00
|
|
|
ifneq ($(DIFFTEST_FLASH_DPIC), 1)
|
|
|
|
PLDM_MACRO_FLAGS += +define+DISABLE_DIFFTEST_FLASH_DPIC
|
|
|
|
endif
|
2024-01-13 11:08:31 +08:00
|
|
|
endif
|
|
|
|
PLDM_MACRO_FLAGS += $(PLDM_EXTRA_MACRO)
|
|
|
|
|
2024-03-01 13:46:26 +08:00
|
|
|
ifeq ($(WORKLOAD_SWITCH),1)
|
|
|
|
PLDM_MACRO_FLAGS += +define+ENABLE_WORKLOAD_SWITCH
|
|
|
|
endif
|
2024-03-13 21:02:35 +08:00
|
|
|
ifeq ($(WITH_DRAMSIM3),1)
|
|
|
|
PLDM_MACRO_FLAGS += +define+WITH_DRAMSIM3
|
|
|
|
endif
|
2024-03-01 13:46:26 +08:00
|
|
|
|
2024-01-13 11:08:31 +08:00
|
|
|
# UA Args
|
|
|
|
IXCOM_FLAGS = -clean -64 -ua +sv +ignoreSimVerCheck +xe_alt_xlm
|
2024-01-22 11:57:30 +08:00
|
|
|
ifeq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
IXCOM_FLAGS += +1xua
|
|
|
|
else
|
2024-01-17 11:56:45 +08:00
|
|
|
IXCOM_FLAGS += +iscDelay+tb_top -enableLargeSizeMem
|
2024-01-13 11:08:31 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Compiler Args
|
|
|
|
IXCOM_FLAGS += -xecompile compilerOptions=$(PLDM_SCRIPTS_DIR)/compilerOptions.qel
|
2024-01-18 11:24:33 +08:00
|
|
|
IXCOM_FLAGS += +gfifoDisp+tb_top
|
2024-01-17 11:57:36 +08:00
|
|
|
IXCOM_FLAGS += $(addprefix -incdir , $(PLDM_VSRC_DIR))
|
2024-01-13 11:08:31 +08:00
|
|
|
IXCOM_FLAGS += $(PLDM_MACRO_FLAGS)
|
|
|
|
IXCOM_FLAGS += +dut+$(PLDM_TB_TOP)
|
2024-01-22 11:57:30 +08:00
|
|
|
ifeq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
PLDM_CLOCK = clock_gen
|
|
|
|
PLDM_CLOCK_DEF = $(PLDM_SCRIPTS_DIR)/$(PLDM_CLOCK).xel
|
|
|
|
PLDM_CLOCK_SRC = $(PLDM_BUILD_DIR)/$(PLDM_CLOCK).sv
|
|
|
|
IXCOM_FLAGS += +dut+$(PLDM_CLOCK) $(PLDM_CLOCK_SRC)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Other Args
|
|
|
|
IXCOM_FLAGS += -v $(PLDM_IXCOM)/IXCclkgen.sv
|
2024-01-22 11:57:30 +08:00
|
|
|
ifneq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
IXCOM_FLAGS += +rtlCommentPragma +tran_relax -relativeIXCDIR -rtlNameForGenerate
|
|
|
|
endif
|
|
|
|
IXCOM_FLAGS += +tfconfig+$(PLDM_SCRIPTS_DIR)/argConfigs.qel
|
|
|
|
|
|
|
|
# Verilog Files
|
2024-03-05 14:59:58 +08:00
|
|
|
PLDM_VSRC_DIR = $(RTL_DIR) $(GEN_VSRC_DIR) $(abspath ./src/test/vsrc)
|
2024-01-13 11:08:31 +08:00
|
|
|
PLDM_VFILELIST = $(PLDM_BUILD_DIR)/vfiles.f
|
|
|
|
IXCOM_FLAGS += -F $(PLDM_VFILELIST)
|
|
|
|
|
|
|
|
# VLAN Flags
|
2024-01-22 11:57:30 +08:00
|
|
|
ifneq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
VLAN_FLAGS = -64 -sv
|
|
|
|
VLAN_FLAGS += $(addprefix -incdir , $(PLDM_VSRC_DIR))
|
2024-01-16 14:51:58 +08:00
|
|
|
VLAN_FLAGS += -vtimescale 1ns/1ns
|
2024-01-13 11:08:31 +08:00
|
|
|
VLAN_FLAGS += $(PLDM_MACRO_FLAGS)
|
|
|
|
VLAN_FLAGS += -F $(PLDM_VFILELIST)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# SoftWare Compile
|
|
|
|
PLDM_SIMTOOL = $(shell cds_root xrun)/tools/include
|
|
|
|
PLDM_IXCOM = $(shell cds_root ixcom)/share/uxe/etc/ixcom
|
|
|
|
DPILIB_EMU = $(PLDM_BUILD_DIR)/libdpi_emu.so
|
|
|
|
PLDM_CSRC_DIR = $(abspath ./src/test/csrc/vcs)
|
|
|
|
PLDM_CXXFILES = $(SIM_CXXFILES) $(shell find $(PLDM_CSRC_DIR) -name "*.cpp")
|
|
|
|
PLDM_CXXFLAGS = -m64 -c -fPIC -g -std=c++11 -I$(PLDM_IXCOM) -I$(PLDM_SIMTOOL)
|
2024-03-19 14:52:47 +08:00
|
|
|
PLDM_CXXFLAGS += $(subst \\\",\", $(SIM_CXXFLAGS)) -I$(PLDM_CSRC_DIR) -DNUM_CORES=$(NUM_CORES)
|
2024-01-13 11:08:31 +08:00
|
|
|
|
2024-03-13 21:02:35 +08:00
|
|
|
ifeq ($(WITH_DRAMSIM3),1)
|
|
|
|
PLDM_LD_LIB = -L $(DRAMSIM3_HOME)/ -ldramsim3 -Wl,-rpath-link=$(DRAMSIM3_HOME)/libdramsim3.so
|
|
|
|
endif
|
|
|
|
|
2024-01-13 11:08:31 +08:00
|
|
|
# XMSIM Flags
|
2024-01-16 14:51:58 +08:00
|
|
|
XMSIM_FLAGS = --xmsim -64 +xcprof -profile -PROFTHREAD
|
2024-01-22 11:57:30 +08:00
|
|
|
ifneq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
XMSIM_FLAGS += -sv_lib ${DPILIB_EMU}
|
|
|
|
endif
|
|
|
|
XMSIM_FLAGS += $(PLDM_EXTRA_ARGS)
|
|
|
|
XMSIM_FLAGS += --
|
|
|
|
|
|
|
|
$(PLDM_BUILD_DIR):
|
|
|
|
mkdir -p $(PLDM_BUILD_DIR)
|
|
|
|
|
|
|
|
$(PLDM_CC_OBJ_DIR):
|
|
|
|
mkdir -p $(PLDM_CC_OBJ_DIR)
|
|
|
|
|
|
|
|
$(PLDM_VFILELIST):
|
|
|
|
find $(PLDM_VSRC_DIR) -name "*.v" -or -name "*.sv" >> $(PLDM_VFILELIST)
|
|
|
|
|
|
|
|
$(PLDM_CLOCK_SRC): $(PLDM_CLOCK_DEF)
|
|
|
|
ixclkgen -input $(PLDM_CLOCK_DEF) -output $(PLDM_CLOCK_SRC) -module $(PLDM_CLOCK) -hierarchy "$(PLDM_TB_TOP)."
|
|
|
|
|
|
|
|
|
2024-01-22 11:57:30 +08:00
|
|
|
ifeq ($(SYNTHESIS), 1)
|
2024-01-13 11:08:31 +08:00
|
|
|
pldm-build: $(PLDM_BUILD_DIR) $(PLDM_VFILELIST) $(PLDM_CLOCK_SRC)
|
|
|
|
cd $(PLDM_BUILD_DIR) && \
|
|
|
|
ixcom $(IXCOM_FLAGS) -l $(PLDM_BUILD_DIR)/ixcom.log
|
|
|
|
else
|
2024-09-14 11:33:15 +08:00
|
|
|
pldm-build: $(PLDM_BUILD_DIR) $(PLDM_VFILELIST) $(DPILIB_EMU)
|
2024-01-13 11:08:31 +08:00
|
|
|
cd $(PLDM_BUILD_DIR) && \
|
|
|
|
vlan $(VLAN_FLAGS) -l $(PLDM_BUILD_DIR)/vlan.log && \
|
2024-09-14 11:33:15 +08:00
|
|
|
ixcom $(IXCOM_FLAGS) -l $(PLDM_BUILD_DIR)/ixcom.log
|
|
|
|
|
|
|
|
$(DPILIB_EMU): $(PLDM_CC_OBJ_DIR)
|
2024-01-13 11:08:31 +08:00
|
|
|
cd $(PLDM_CC_OBJ_DIR) && \
|
|
|
|
$(CC) $(PLDM_CXXFLAGS) $(PLDM_CXXFILES) && \
|
2024-09-14 11:33:15 +08:00
|
|
|
$(CC) -o $@ -m64 -shared *.o $(PLDM_LD_LIB)
|
2024-01-13 11:08:31 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
pldm-run: $(PLDM_BUILD_DIR)
|
|
|
|
cd $(PLDM_BUILD_DIR) && \
|
|
|
|
xeDebug $(XMSIM_FLAGS) -input $(PLDM_SCRIPTS_DIR)/run.tcl -l run-$$(date +%Y%m%d-%H%M%S).log
|
|
|
|
|
|
|
|
pldm-debug: $(PLDM_BUILD_DIR)
|
|
|
|
cd $(PLDM_BUILD_DIR) && \
|
2024-03-11 09:40:52 +08:00
|
|
|
xeDebug $(XMSIM_FLAGS) -fsdb -input $(PLDM_SCRIPTS_DIR)/run_debug.tcl -l debug-$$(date +%Y%m%d-%H%M%S).log
|
2024-01-13 11:08:31 +08:00
|
|
|
|
|
|
|
pldm-clean:
|
|
|
|
rm -rf $(PLDM_BUILD_DIR)
|