Skip to content

Commit c519d96

Browse files
committed
Added modelsim_vcom_flags and modelsim_vlog_flags compile options #97
1 parent aba54c4 commit c519d96

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

user_guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ vu.set_compile_option("ghdl_flags", ["--no-vital-checks"])
328328
* `ghdl_flags`
329329
- Extra arguments passed to `ghdl -a` command. Must be a list of strings.
330330
- Example `vu.set_compile_option("ghdl_flags", ["--no-vital-checks"])`.
331+
* `modelsim_vcom_flags`
332+
- Extra arguments passed to ModelSim `vcom` command. Must be a list of strings.
333+
* `modelsim_vlog_flags`
334+
- Extra arguments passed to ModelSim `vlog` command. Must be a list of strings.
331335

332336
## Ctrl-C when using Git/MSYS Bash on Windows
333337
VUnit will catch Ctrl-C and perform a clean shutdown closing all started simulation processes and printing the test report so far. On Git/MSYS Bash on Windows however there is a mechanism that hard kills a process a very short time after pressing Ctrl-C often prohibiting VUnit from completing its shutdown. This can leave simulation process open which have to be manually killed. See this [stack overflow post](http://stackoverflow.com/questions/23678045/control-c-kills-ipython-in-git-bash-on-windows-7) for tips on how to remove this mechanism.

vunit/modelsim_interface.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
33
# You can obtain one at http://mozilla.org/MPL/2.0/.
44
#
5-
# Copyright (c) 2014-2015, Lars Asplund lars.anders.asplund@gmail.com
5+
# Copyright (c) 2014-2016, Lars Asplund lars.anders.asplund@gmail.com
66

77
"""
88
Interface towards Mentor Graphics ModelSim
@@ -173,19 +173,23 @@ def compile_project(self, project, vhdl_standard):
173173
print('Compiling ' + source_file.name + ' into ' + source_file.library.name + ' ...')
174174

175175
if source_file.file_type == 'vhdl':
176-
success = self.compile_vhdl_file(source_file.name, source_file.library.name, vhdl_standard)
176+
success = self.compile_vhdl_file(source_file.name,
177+
source_file.library.name,
178+
vhdl_standard,
179+
source_file.compile_options)
177180
elif source_file.file_type == 'verilog':
178181
success = self.compile_verilog_file(source_file.name,
179182
source_file.library.name,
180-
source_file.include_dirs)
183+
source_file.include_dirs,
184+
source_file.compile_options)
181185
else:
182186
raise RuntimeError("Unkown file type: " + source_file.file_type)
183187

184188
if not success:
185189
raise CompileError("Failed to compile '%s'" % source_file.name)
186190
project.update(source_file)
187191

188-
def compile_vhdl_file(self, source_file_name, library_name, vhdl_standard):
192+
def compile_vhdl_file(self, source_file_name, library_name, vhdl_standard, compile_options):
189193
"""
190194
Compiles a vhdl file into a specific library using a specfic vhdl_standard
191195
"""
@@ -196,15 +200,15 @@ def compile_vhdl_file(self, source_file_name, library_name, vhdl_standard):
196200
coverage_args = ["+cover=" + to_coverage_args(self._coverage)]
197201

198202
proc = Process([join(self._prefix, 'vcom'), '-quiet', '-modelsimini', self._modelsim_ini] +
199-
coverage_args +
203+
coverage_args + compile_options.get("modelsim_vcom_flags", []) +
200204
['-' + vhdl_standard, '-work', library_name, source_file_name])
201205

202206
proc.consume_output()
203207
except Process.NonZeroExitCode:
204208
return False
205209
return True
206210

207-
def compile_verilog_file(self, source_file_name, library_name, include_dirs):
211+
def compile_verilog_file(self, source_file_name, library_name, include_dirs, compile_options):
208212
"""
209213
Compiles a verilog file into a specific library
210214
"""
@@ -216,6 +220,7 @@ def compile_verilog_file(self, source_file_name, library_name, include_dirs):
216220

217221
args = [join(self._prefix, 'vlog'), '-sv', '-quiet', '-modelsimini', self._modelsim_ini]
218222
args += coverage_args
223+
args += compile_options.get("modelsim_vlog_flags", [])
219224
args += ['-work', library_name, source_file_name]
220225

221226
for library in self._libraries.values():

vunit/project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@ def __hash__(self):
561561
def __repr__(self):
562562
return "SourceFile(%s, %s)" % (self.name, self.library.name)
563563

564-
_allowed_compile_options = ["ghdl_flags"]
564+
_allowed_compile_options = ["ghdl_flags",
565+
"modelsim_vcom_flags",
566+
"modelsim_vlog_flags"]
565567

566568
def set_compile_option(self, name, value):
567569
"""

0 commit comments

Comments
 (0)