| 1 |
# Copyright cocotb contributors |
| 2 |
# Licensed under the Revised BSD License, see LICENSE for details. |
| 3 |
# SPDX-License-Identifier: BSD-3-Clause |
| 4 |
|
| 5 |
# Detect the version of Questa in use to choose the best flow. |
| 6 |
|
| 7 |
CMD_BIN := vsim |
| 8 |
|
| 9 |
ifdef MODELSIM_BIN_DIR |
| 10 |
CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null) |
| 11 |
else |
| 12 |
# auto-detect bin dir from system path |
| 13 |
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null) |
| 14 |
endif |
| 15 |
|
| 16 |
# Determine the version of Questa being used. |
| 17 |
QUESTA_VERSION := $(shell $(CMD) -version | $(PYTHON_BIN) -c 'import re,sys; print(re.sub(r".+vsim (\d+)\.(\d).+", "\\1 \\2", sys.stdin.read()))') |
| 18 |
QUESTA_VERSION_MAJOR := $(firstword $(QUESTA_VERSION)) |
| 19 |
QUESTA_VERSION_MINOR := $(lastword $(QUESTA_VERSION)) |
| 20 |
|
| 21 |
# Use the QIS/Qrun flow for Questa >= 2025.2 (the first version which fully |
| 22 |
# passes the cocotb regression suite). Use the compat flow otherwise. |
| 23 |
ifeq ($(shell test $(QUESTA_VERSION_MAJOR)$(QUESTA_VERSION_MINOR) -lt 20252; echo $$?),0) |
| 24 |
$(info Using the Questa compat flow for Questa version $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) < 2025.2. Run make with SIM=questa-qisqrun to force the newer QIS/Qrun flow.) |
| 25 |
include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-compat |
| 26 |
else |
| 27 |
$(info Using the Questa QIS/Qrun flow for Questa $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) >= 2025.2. Run make with SIM=questa-compat for the compat flow.) |
| 28 |
include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-qisqrun |
| 29 |
endif |