@@ -27,6 +27,17 @@ class Xcelium(Edatool):
2727 TCL_SCRIPT_TYPES = ["tclSource" ]
2828 DPIC_LIB_TYPES = ["dpiLibrary" ]
2929
30+ #: Map file type to xrun argument that will enable particular Verilog or VHDL features
31+ FILE_TYPE_TO_FEATURE_FLAG = {
32+ "verilogSource-95" : "-v1995" ,
33+ "verilogSource-1995" : "-v1995" ,
34+ "verilogSource-2001" : "-v2001" ,
35+ "vhdlSource-93" : "-v93" ,
36+ "vhdlSource-1993" : "-v93" ,
37+ "vhdlSource-2008" : "-v200x" ,
38+ "vhdlSource-2019" : "-v2019" ,
39+ }
40+
3041 def setup (self , edam ):
3142 super ().setup (edam )
3243
@@ -38,7 +49,6 @@ def setup(self, edam):
3849 src_files = []
3950 tcl_files = []
4051 dpi_libraries = []
41- has_system_verilog = False
4252
4353 # Move different type of files to a separate list
4454 for f in self .files :
@@ -49,18 +59,19 @@ def setup(self, edam):
4959 file_type = f .get ("file_type" , "" )
5060
5161 # Verilog source files
52- if file_type in self .V_SRC_FILE_TYPES :
62+ if any ( map ( file_type . startswith , self .V_SRC_FILE_TYPES )) :
5363 if self ._add_include_dir (f , incdirs , force_slash = True ):
5464 # This file is a include file
5565 include_files .append (f ["name" ])
5666 else :
57- if file_type .startswith ("systemVerilogSource" ):
58- has_system_verilog = True
59-
6067 # This file is a normal source file
6168 src_files .append (f )
6269 unused_files .remove (f )
6370
71+ if file_type .startswith ("vhdlSource" ):
72+ src_files .append (f )
73+ unused_files .remove (f )
74+
6475 if file_type in self .TCL_SCRIPT_TYPES :
6576 tcl_files .append (f ["name" ])
6677 unused_files .remove (f )
@@ -74,7 +85,6 @@ def setup(self, edam):
7485
7586 # Append option flags
7687 en_64bit_cmd = [] if self .tool_options .get ("32bit" ) else ["-64bit" ]
77- sv_cmd = ["-sv" ] if has_system_verilog else []
7888
7989 # Append timescale option
8090 timescale_cmd = (
@@ -120,7 +130,10 @@ def setup(self, edam):
120130 # different file_type, logical_name or defines compared
121131 # to the previous file, we put it in a new file group
122132 for f in src_files :
123- lib = f .get ("logical_name" , "" )
133+ # The 'worklib' is the default library in Xcelium
134+ # We need to use -makelib <library> <option>... <file>... -endlib to group files
135+ # This is required to support compiling mixed-languages and mixed-standards altogether
136+ lib = f .get ("logical_name" , "worklib" )
124137 defines = f .get ("define" , {})
125138 file_type = f .get ("file_type" )
126139 fileopts = (file_type , lib , defines )
@@ -133,11 +146,15 @@ def setup(self, edam):
133146 for fg in filegroups :
134147 # Ignore empty file groups
135148 if fg [1 ]:
136- (_ , lib , defines ) = fg [0 ]
149+ (file_type , lib , defines ) = fg [0 ]
137150 if lib :
138151 files_cmd += ["-makelib" , lib ]
139152 for k , v in defines .items ():
140153 files_cmd += ["-define" , f"{ k } ={ v } " ]
154+ if file_type .startswith ("systemVerilogSource" ):
155+ files_cmd += ["-sv" ]
156+ if file_type in self .FILE_TYPE_TO_FEATURE_FLAG :
157+ files_cmd += [self .FILE_TYPE_TO_FEATURE_FLAG [file_type ]]
141158 files_cmd += fg [1 ]
142159 if lib :
143160 files_cmd += ["-endlib" ]
@@ -166,7 +183,6 @@ def setup(self, edam):
166183
167184 self .xrun_f = (
168185 en_64bit_cmd
169- + sv_cmd
170186 + dpi_lib_cmd
171187 + macro_def_cmd
172188 + vlogparam_cmd
0 commit comments