Skip to content

Commit

Permalink
modelsim: gui startup do-file cleanups from vsim options, since vunit…
Browse files Browse the repository at this point in the history
… overrides it`s own
  • Loading branch information
alexrayne committed Oct 2, 2024
1 parent b3823a6 commit 49f44f4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions vunit/sim_if/modelsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pathlib import Path
import os
import logging
from typing import Optional, Set, Union
from configparser import RawConfigParser
from ..exceptions import CompileError
from ..ostools import Process, file_exists
Expand Down Expand Up @@ -391,6 +392,32 @@ def _vsim_extra_ini(self, config):
write_modelsimini(cfg, self._sim_cfg_file_name)
return

def _create_gui_script(self, common_file_name, config):
cfg = parse_modelsimini(self._sim_cfg_file_name)
vsimcfg = dict(cfg.items("vsim"))
if "shutdownfile" in vsimcfg:
dofile = vsimcfg["shutdownfile"]
self._dostartup_cleanup(dofile)

return super()._create_gui_script(common_file_name, config)

def _dostartup_cleanup(self, dofile : str):
"""
cleanup restore session do-file from vsim command options, since it breaks options invoked
by vunit
"""
if file_exists(dofile):
dofinal = [];
with open(dofile, 'rt') as file_in:
## dofinal = filter(lambda line: not line.startswith("vsim"), file_in )
for line in file_in:
if not line.startswith("vsim"):
dofinal.append(line)

with open(dofile, 'wt') as file_out:
file_out.writelines(dofinal)


def merge_coverage(self, file_name, args=None):
"""
Merge coverage from all test cases
Expand Down

0 comments on commit 49f44f4

Please sign in to comment.