Debian Codegraph @

src/cocotb_tools/makefiles/simulators/Makefile.xcelium

raw
1 # Copyright cocotb contributors
2 # Copyright (c) 2013, 2018 Potential Ventures Ltd
3 # Copyright (c) 2013 SolarFlare Communications Inc
4 # Licensed under the Revised BSD License, see LICENSE for details.
5 # SPDX-License-Identifier: BSD-3-Clause
6
7 # Common Makefile for Cadence Xcelium
8
9 CMD_BIN := xrun
10
11 ifdef XCELIUM_BIN_DIR
12 CMD := $(shell :; command -v $(XCELIUM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
13 else
14 # auto-detect bin dir from system path
15 CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
16 XCELIUM_BIN_DIR := $(shell dirname $(CMD))
17 endif
18
19 ifdef VERILOG_INCLUDE_DIRS
20 COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
21 endif
22
23 EXTRA_ARGS += $(COMPILE_ARGS)
24 EXTRA_ARGS += $(SIM_ARGS)
25 EXTRA_ARGS += -licqueue
26
27 ifeq ($(PYTHON_ARCH),64bit)
28 EXTRA_ARGS += -64
29 endif
30
31 EXTRA_ARGS += -xmlibdirpath $(SIM_BUILD)
32 ifeq ($(DEBUG),1)
33 EXTRA_ARGS += -pliverbose
34 EXTRA_ARGS += -messages
35 EXTRA_ARGS += -plidebug # Enhance the profile output with PLI info
36 EXTRA_ARGS += -plierr_verbose # Expand handle info in PLI/VPI/VHPI messages
37 EXTRA_ARGS += -vpicompat 1800v2005 # <1364v1995|1364v2001|1364v2005|1800v2005> Specify the IEEE VPI
38 else
39 EXTRA_ARGS += -plinowarn
40 endif
41
42 ifeq ($(GUI),1)
43 EXTRA_ARGS += -gui
44 else
45 EXTRA_ARGS +=
46 endif
47
48 # Xcelium errors out if multiple timescales are specified on the command line.
49 ifneq (,$(filter -timescale%,$(EXTRA_ARGS)))
50 $(error Please use COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION to specify timescale.)
51 endif
52
53 # Loading the VHPI library causes an error, so we always load the VPI library and supply
54 # GPI_EXTRA=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium) if needed.
55
56 # Xcelium will use default vlog_startup_routines symbol only if VPI library name is libvpi.so
57 GPI_ARGS = -loadvpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi xcelium):vlog_startup_routines_bootstrap
58 ifeq ($(TOPLEVEL_LANG),verilog)
59 HDL_SOURCES = $(VERILOG_SOURCES)
60 ROOT_LEVEL = $(COCOTB_TOPLEVEL)
61 EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
62 ifneq ($(VHDL_SOURCES),)
63 HDL_SOURCES += $(VHDL_SOURCES)
64 GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
65 endif
66 else ifeq ($(TOPLEVEL_LANG),vhdl)
67 GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
68 EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
69 # Xcelium 23.09.004 fixes cocotb issue #1076 as long as the following define
70 # is set.
71 EXTRA_ARGS += -NEW_VHPI_PROPAGATE_DELAY
72 ifdef RTL_LIBRARY
73 $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
74 TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
75 else
76 TOPLEVEL_LIBRARY ?= work
77 endif
78 MAKE_LIB = -makelib $(TOPLEVEL_LIBRARY)
79 END_LIB = -endlib
80 HDL_SOURCES = $(VHDL_SOURCES)
81 ifneq ($(VERILOG_SOURCES),)
82 HDL_SOURCES += $(VERILOG_SOURCES)
83 endif
84 else
85 $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
86 endif
87
88 # Builds a list of arguments to support VHDL libraries specified in VHDL_SOURCES_*:
89 LIBS := $(foreach LIB, $(VHDL_LIB_ORDER),-makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -endlib)
90
91 $(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
92 $(RM) $(COCOTB_RESULTS_FILE)
93
94 # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
95 $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
96 $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
97
98 set -o pipefail; \
99 COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
100 $(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
101 -vhdl_time_precision "$(COCOTB_HDL_TIMEPRECISION)" \
102 $(EXTRA_ARGS) $(GPI_ARGS) $(INCDIRS) -access +rwc -createdebugdb $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(END_LIB) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
103
104 $(call check_results)