Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/acceptance/test_artificial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestVunitArtificial(unittest.TestCase):
"""

def setUp(self):
if simulator_is("activehdl"):
if simulator_is("activehdl", "incisive"):
self.output_path = str(ROOT / "artificial_out")
else:
# Spaces in path intentional to verify that it is supported
Expand Down
61 changes: 44 additions & 17 deletions vunit/sim_if/incisive.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (c) 2014-2020, Lars Asplund lars.anders.asplund@gmail.com

"""
Interface for the Cadence Incisive simulator
Interface for the Cadence Incisive/Xcelium simulator
"""

from pathlib import Path
Expand All @@ -26,10 +26,12 @@ class IncisiveInterface( # pylint: disable=too-many-instance-attributes
SimulatorInterface
):
"""
Interface for the Cadence Incisive simulator
Interface for the Cadence Incisive/Xcelium simulator
"""

name = "incisive"
executable_name = "xrun"
option_prefix = "xm"
supports_gui_flag = True
package_users_depend_on_bodies = False

Expand Down Expand Up @@ -76,15 +78,22 @@ def from_args(cls, args, output_path, **kwargs):
@classmethod
def find_prefix_from_path(cls):
"""
Find incisive simulator from PATH environment variable
Find incisive/xcelium simulator from PATH environment variable
"""
return cls.find_toolchain(["irun"])
prefix = cls.find_toolchain([cls.executable_name])
if prefix is None:
cls.executable_name = "irun"
cls.option_prefix = "nc"
prefix = cls.find_toolchain([cls.executable_name])
return prefix

@staticmethod
def supports_vhdl_contexts():
"""
Returns True when this simulator supports VHDL 2008 contexts
"""
if IncisiveInterface.executable_name == "xrun":
return True
return False

def __init__( # pylint: disable=too-many-arguments
Expand All @@ -107,7 +116,7 @@ def find_cds_root_irun(self):
Finds irun cds root
"""
return subprocess.check_output(
[str(Path(self._prefix) / "cds_root"), "irun"]
[str(Path(self._prefix) / "cds_root"), self.executable_name]
).splitlines()[0]

def find_cds_root_virtuoso(self):
Expand Down Expand Up @@ -173,16 +182,19 @@ def compile_source_file_command(self, source_file):

raise CompileError

@staticmethod
def _vhdl_std_opt(vhdl_standard):
def _vhdl_std_opt(self, vhdl_standard):
"""
Convert standard to format of irun command line flag
"""
if vhdl_standard == VHDL.STD_2002:
return "-v200x -extv200x"

if vhdl_standard == VHDL.STD_2008:
return "-v200x -extv200x"
return (
"-v200x -extv200x" + " -inc_v200x_pkg"
if self.executable_name == "xrun"
else ""
)

if vhdl_standard == VHDL.STD_1993:
return "-v93"
Expand All @@ -193,7 +205,7 @@ def compile_vhdl_file_command(self, source_file):
"""
Returns command to compile a VHDL file
"""
cmd = str(Path(self._prefix) / "irun")
cmd = str(Path(self._prefix) / self.executable_name)
args = []
args += ["-compile"]
args += ["-nocopyright"]
Expand All @@ -217,7 +229,10 @@ def compile_vhdl_file_command(self, source_file):
args += ["-messages"]
args += ["-libverbose"]
args += source_file.compile_options.get("incisive.irun_vhdl_flags", [])
args += ['-nclibdirname "%s"' % str(Path(source_file.library.directory).parent)]
args += [
'-%slibdirname "%s"'
% (self.option_prefix, str(Path(source_file.library.directory).parent))
]
args += ["-makelib %s" % source_file.library.directory]
args += ['"%s"' % source_file.name]
args += ["-endlib"]
Expand All @@ -232,7 +247,7 @@ def compile_verilog_file_command(self, source_file):
"""
Returns commands to compile a Verilog file
"""
cmd = str(Path(self._prefix) / "irun")
cmd = str(Path(self._prefix) / self.executable_name)
args = []
args += ["-compile"]
args += ["-nocopyright"]
Expand Down Expand Up @@ -267,7 +282,10 @@ def compile_verilog_file_command(self, source_file):

for key, value in source_file.defines.items():
args += ["-define %s=%s" % (key, value.replace('"', '\\"'))]
args += ['-nclibdirname "%s"' % str(Path(source_file.library.directory).parent)]
args += [
'-%slibdirname "%s"'
% (self.option_prefix, str(Path(source_file.library.directory).parent))
]
args += ["-makelib %s" % source_file.library.name]
args += ['"%s"' % source_file.name]
args += ["-endlib"]
Expand Down Expand Up @@ -322,7 +340,7 @@ def simulate( # pylint: disable=too-many-locals
steps = ["elaborate", "simulate"]

for step in steps:
cmd = str(Path(self._prefix) / "irun")
cmd = str(Path(self._prefix) / self.executable_name)
args = []
if step == "elaborate":
args += ["-elaborate"]
Expand All @@ -338,17 +356,18 @@ def simulate( # pylint: disable=too-many-locals
args += ["-nowarn DLCPTH"] # "cds.lib Invalid path"
args += ["-nowarn DLCVAR"] # "cds.lib Invalid environment variable ''."
args += [
"-ncerror EVBBOL"
"-%serror EVBBOL" % self.option_prefix
] # promote to error: "bad boolean literal in generic association"
args += [
"-ncerror EVBSTR"
"-%serror EVBSTR" % self.option_prefix
] # promote to error: "bad string literal in generic association"
args += [
"-ncerror EVBNAT"
"-%serror EVBNAT" % self.option_prefix
] # promote to error: "bad natural literal in generic association"
args += ["-work work"]
args += [
'-nclibdirname "%s"' % (str(Path(self._output_path) / "libraries"))
'-%slibdirname "%s"'
% (self.option_prefix, str(Path(self._output_path) / "libraries"))
] # @TODO: ugly
args += config.sim_options.get("incisive.irun_sim_flags", [])
args += ['-cdslib "%s"' % self._cdslib]
Expand All @@ -362,6 +381,14 @@ def simulate( # pylint: disable=too-many-locals
args += self._generic_args(config.entity_name, config.generics)
for library in self._libraries:
args += ['-reflib "%s"' % library.directory]
args += ['-input "@set intovf_severity_level ignore"']
if config.sim_options.get("disable_ieee_warnings", False):
args += [
'-input "@set pack_assert_off { std_logic_arith numeric_std }"'
]
args += [
'-input "@set assert_stop_level %s"' % config.vhdl_assert_stop_level
]
if launch_gui:
args += ["-access +rwc"]
# args += ['-linedebug']
Expand Down
8 changes: 4 additions & 4 deletions vunit/vhdl/logging/src/log_deprecated_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ package body log_deprecated_pkg is
end if;
end function;

impure function get_logger_display_handler return log_handler_t is
impure function get_logger_display_handler(logger : logger_t) return log_handler_t is
begin
for idx in 0 to num_log_handlers(logger) - 1 loop
if get_file_name(get_log_handler(logger, idx)) = stdout_file_name then
Expand All @@ -112,7 +112,7 @@ package body log_deprecated_pkg is
return null_log_handler;
end function;

impure function get_logger_file_handler return log_handler_t is
impure function get_logger_file_handler(logger : logger_t) return log_handler_t is
begin
for idx in 0 to num_log_handlers(logger) - 1 loop
if get_file_name(get_log_handler(logger, idx)) /= stdout_file_name then
Expand All @@ -123,14 +123,14 @@ package body log_deprecated_pkg is
return null_log_handler;
end function;
begin
logger_display_handler := get_logger_display_handler;
logger_display_handler := get_logger_display_handler(logger);
if new_logger or (logger_display_handler = null_log_handler) then
logger_display_handler := new_log_handler(stdout_file_name, real_format(display_format), true);
else
init_log_handler(logger_display_handler, real_format(display_format), stdout_file_name, true);
end if;

logger_file_handler := get_logger_file_handler;
logger_file_handler := get_logger_file_handler(logger);
if new_logger or (logger_file_handler = null_log_handler) then
logger_file_handler := new_log_handler(file_name, real_format(file_format), false);
else
Expand Down