opencos-eda 0.3.13__tar.gz → 0.3.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {opencos_eda-0.3.13/opencos_eda.egg-info → opencos_eda-0.3.14}/PKG-INFO +1 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/sim.py +71 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_config_defaults.yml +2 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/iverilog.py +1 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/questa_common.py +5 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/riviera.py +50 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/verilator.py +5 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/vivado.py +43 -7
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/yosys.py +7 -2
- {opencos_eda-0.3.13 → opencos_eda-0.3.14/opencos_eda.egg-info}/PKG-INFO +1 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/pyproject.toml +1 -1
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/LICENSE +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/LICENSE.spdx +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/README.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/Architecture.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/ConnectingApps.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/DEPS.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/Debug.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/DirectoryStructure.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/Installation.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/OcVivadoTcl.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/OpenQuestions.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/README.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/RtlCodingStyle.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/eda.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/docs/oc_cli.md +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/_version.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/_waves_pkg.sv +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/build.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/deps_help.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/elab.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/export.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/flist.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/lec.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/lint.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/multi.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/open.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/proj.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/shell.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/sweep.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/synth.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/targets.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/upload.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/commands/waves.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps/defaults.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps/deps_commands.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps/deps_file.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps/deps_processor.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/deps_schema.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_base.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_config.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_config_reduced.yml +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_deps_bash_completion.bash +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_deps_sanitize.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_extract_targets.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/eda_tool_helper.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/export_helper.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/export_json_convert.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/files.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/hw/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/hw/oc_cli.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/hw/pcie.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/names.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/peakrdl_cleanup.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/seed.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/cocotb.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/invio.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/invio_helpers.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/invio_yosys.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/modelsim_ase.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/quartus.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/questa.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/questa_fe.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/questa_fse.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/slang.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/slang_yosys.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/surelog.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/tools/tabbycad_yosys.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/util.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/__init__.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/dict_helpers.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/markup_helpers.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/status_constants.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/str_helpers.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/subprocess_helpers.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/vscode_helper.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos/utils/vsim_helper.py +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos_eda.egg-info/SOURCES.txt +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos_eda.egg-info/dependency_links.txt +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos_eda.egg-info/entry_points.txt +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos_eda.egg-info/requires.txt +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/opencos_eda.egg-info/top_level.txt +0 -0
- {opencos_eda-0.3.13 → opencos_eda-0.3.14}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencos-eda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.14
|
|
4
4
|
Summary: A simple Python package for wrapping RTL simuliatons and synthesis
|
|
5
5
|
Author-email: Simon Sabato <simon@cognichip.ai>, Drew Ranck <drew@cognichip.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cognichip/opencos
|
|
@@ -14,6 +14,8 @@ Note that CommandSim is also a base class for opencos.commands.elab.CommandElab.
|
|
|
14
14
|
import os
|
|
15
15
|
import shlex
|
|
16
16
|
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
17
19
|
from opencos import util, export_helper
|
|
18
20
|
from opencos.eda_base import CommandDesign, Tool
|
|
19
21
|
from opencos.utils import status_constants
|
|
@@ -84,6 +86,7 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
84
86
|
error_on_no_files_or_targets = True
|
|
85
87
|
error_on_missing_top = True
|
|
86
88
|
tool_config = {} # Children with Tool parent classes will set on Tool constructor.
|
|
89
|
+
library_map_supported = False
|
|
87
90
|
|
|
88
91
|
command_name = 'sim'
|
|
89
92
|
|
|
@@ -114,6 +117,8 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
114
117
|
'verilate-args': [],
|
|
115
118
|
'ext-defines-sv-fname': '',
|
|
116
119
|
'license-queue': False,
|
|
120
|
+
'library-map': [],
|
|
121
|
+
'add-top-library': [],
|
|
117
122
|
})
|
|
118
123
|
self.args_help.update({
|
|
119
124
|
'pre-sim-tcl': (
|
|
@@ -168,6 +173,17 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
168
173
|
'license-queue': (
|
|
169
174
|
'Set to enable env vars LICENSE_QUEUE=1 which has effects on certain simulators'
|
|
170
175
|
),
|
|
176
|
+
'library-map': (
|
|
177
|
+
'list arg (can set multiple) with values LibName:Path, only supported'
|
|
178
|
+
' by certain simulation tools.'
|
|
179
|
+
' The Path search is relative to the tool exe, one level above the tool exe,'
|
|
180
|
+
' or can be absolute path.'
|
|
181
|
+
),
|
|
182
|
+
'add-top-library': (
|
|
183
|
+
'Add additional top levels, for example if you added the "unisim" library'
|
|
184
|
+
' you may need to --add-top-library=unisim.glbl for it to work with Xilinx'
|
|
185
|
+
' based projects that require "glbl" to be present at simulation $root scope.'
|
|
186
|
+
),
|
|
171
187
|
|
|
172
188
|
})
|
|
173
189
|
|
|
@@ -175,6 +191,9 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
175
191
|
'uvm-version': { 'choices': ['1.2'] },
|
|
176
192
|
})
|
|
177
193
|
|
|
194
|
+
# only used if self.library_map_supported=True:
|
|
195
|
+
self.library_map = {} # lib-name: path-to.lib dict from self.args['library-map']
|
|
196
|
+
|
|
178
197
|
|
|
179
198
|
|
|
180
199
|
def process_parameters_get_list(
|
|
@@ -425,7 +444,7 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
425
444
|
cmds2 = self.get_simulate_command_lists()
|
|
426
445
|
cmds3 = self.get_post_simulate_command_lists()
|
|
427
446
|
'''
|
|
428
|
-
|
|
447
|
+
self.update_library_map()
|
|
429
448
|
|
|
430
449
|
|
|
431
450
|
def check_logs_for_errors( # pylint: disable=dangerous-default-value,too-many-locals,too-many-branches
|
|
@@ -686,3 +705,54 @@ class CommandSim(CommandDesign): # pylint: disable=too-many-public-methods
|
|
|
686
705
|
|
|
687
706
|
if 'LICENSE_QUEUE' not in os.environ:
|
|
688
707
|
os.environ['LICENSE_QUEUE'] = '1'
|
|
708
|
+
|
|
709
|
+
def update_library_map(self, base_search_paths: list | None = None) -> None:
|
|
710
|
+
'''
|
|
711
|
+
Returns None, uses self.args['library-map'] to update:
|
|
712
|
+
|
|
713
|
+
- self.library_map (dict)
|
|
714
|
+
- self.args['sim-library']
|
|
715
|
+
'''
|
|
716
|
+
if not self.args['library-map']:
|
|
717
|
+
return
|
|
718
|
+
|
|
719
|
+
if not self.library_map_supported:
|
|
720
|
+
tool = self.config.get('tool', None)
|
|
721
|
+
util.warning(f'Command: sim, --tool={tool}, args for --library-map are not supported:',
|
|
722
|
+
f'{self.args["library-map"]}')
|
|
723
|
+
return
|
|
724
|
+
|
|
725
|
+
for libmap in self.args['library-map']:
|
|
726
|
+
parts = libmap.split(':')
|
|
727
|
+
lib_name = parts[0]
|
|
728
|
+
lib_path = Path(':'.join(parts[1:]))
|
|
729
|
+
lib_abs_path = None
|
|
730
|
+
|
|
731
|
+
if not lib_name or not lib_path:
|
|
732
|
+
util.warning(f'library-map={libmap} could not parse {lib_name=} or {lib_path=}')
|
|
733
|
+
continue
|
|
734
|
+
|
|
735
|
+
if lib_name in self.library_map:
|
|
736
|
+
util.warning(
|
|
737
|
+
f'We have already mapped "{lib_name}" to {self.library_map[lib_name]}'
|
|
738
|
+
)
|
|
739
|
+
|
|
740
|
+
# We have to go looking for lib_path though
|
|
741
|
+
search_files = [lib_path]
|
|
742
|
+
if base_search_paths and isinstance(base_search_paths, list):
|
|
743
|
+
for x in base_search_paths:
|
|
744
|
+
search_files.append(Path(x) / lib_path)
|
|
745
|
+
for x in search_files:
|
|
746
|
+
if x.exists():
|
|
747
|
+
lib_abs_path = x.resolve()
|
|
748
|
+
util.info(f'library-map={libmap} found "{lib_name}" in: {lib_abs_path}')
|
|
749
|
+
break
|
|
750
|
+
util.debug(f'library-map={libmap} searching for "{lib_name}" in: {x}')
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
if lib_abs_path:
|
|
754
|
+
self.library_map[lib_name] = lib_abs_path
|
|
755
|
+
if lib_name not in self.args['sim-library']:
|
|
756
|
+
self.args['sim-library'].append(lib_name)
|
|
757
|
+
else:
|
|
758
|
+
util.warning(f'library-map={libmap}, for "{lib_name}" could not find {lib_path=}')
|
|
@@ -412,7 +412,8 @@ tools:
|
|
|
412
412
|
-acdb -acdb_cov sbfectapm
|
|
413
413
|
simulate-coverage-tcl:
|
|
414
414
|
- acdb save
|
|
415
|
-
- acdb report -
|
|
415
|
+
- acdb report -i work.acdb -txt -o cov.txt
|
|
416
|
+
- acdb report -i work.acdb -txt -o covg.txt -show covergroups
|
|
416
417
|
|
|
417
418
|
|
|
418
419
|
modelsim_ase:
|
|
@@ -70,6 +70,7 @@ class CommandSimIverilog(CommandSim, ToolIverilog):
|
|
|
70
70
|
# We do not override CommandSim.do_it()
|
|
71
71
|
def prepare_compile(self):
|
|
72
72
|
self.set_tool_defines()
|
|
73
|
+
self.update_library_map()
|
|
73
74
|
|
|
74
75
|
self.iverilog_command_lists = self.get_compile_command_lists()
|
|
75
76
|
self.iverilog_exec_command_lists = self.get_simulate_command_lists()
|
|
@@ -150,6 +150,7 @@ class CommonSimQuesta(CommandSim, ToolQuesta):
|
|
|
150
150
|
|
|
151
151
|
def prepare_compile(self):
|
|
152
152
|
self.set_tool_defines()
|
|
153
|
+
self.update_library_map()
|
|
153
154
|
self.write_vlog_dot_f()
|
|
154
155
|
self.write_vsim_dot_do(dot_do_to_write='all')
|
|
155
156
|
|
|
@@ -388,6 +389,10 @@ class CommonSimQuesta(CommandSim, ToolQuesta):
|
|
|
388
389
|
+ f" -sv_seed {self.args['seed']} {sim_plusargs_str} {vsim_suppress_list_str}" \
|
|
389
390
|
+ f" {voptargs_str} {vsim_ext_args} work.{self.args['top']}"
|
|
390
391
|
|
|
392
|
+
# If there are additional top level libs, we wont' add them to the vopt step, add
|
|
393
|
+
# to vsim only (after work.TOP):
|
|
394
|
+
for l in self.args['add-top-library']:
|
|
395
|
+
vsim_one_liner += f' {l}'
|
|
391
396
|
|
|
392
397
|
vsim_one_liner = vsim_one_liner.replace('\n', ' ')
|
|
393
398
|
|
|
@@ -9,6 +9,8 @@ Contains classes for ToolRiviera, CommandSimRiviera, CommandElabRiviera.
|
|
|
9
9
|
import os
|
|
10
10
|
import subprocess
|
|
11
11
|
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
12
14
|
from opencos import util
|
|
13
15
|
from opencos.commands import CommandFList
|
|
14
16
|
from opencos.files import safe_shutil_which
|
|
@@ -65,6 +67,8 @@ class ToolRiviera(ToolQuesta):
|
|
|
65
67
|
class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
66
68
|
'''CommandSimRiviera is a command handler for: eda sim --tool=riviera'''
|
|
67
69
|
|
|
70
|
+
library_map_supported = True
|
|
71
|
+
|
|
68
72
|
def __init__(self, config: dict):
|
|
69
73
|
CommonSimQuesta.__init__(self, config=config)
|
|
70
74
|
|
|
@@ -190,6 +194,9 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
190
194
|
'-dbg'
|
|
191
195
|
])
|
|
192
196
|
|
|
197
|
+
# Note, in Riviera we have to put sim libs in vsim call (with -L) and in vlog (with -l)
|
|
198
|
+
vlog_dot_f_lines.extend([f'-l {x}' for x in self.args['sim-library']])
|
|
199
|
+
|
|
193
200
|
for value in self.incdirs:
|
|
194
201
|
vlog_dot_f_lines += [ f"+incdir+{value}" ]
|
|
195
202
|
|
|
@@ -278,7 +285,10 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
278
285
|
)
|
|
279
286
|
)
|
|
280
287
|
|
|
281
|
-
|
|
288
|
+
# Note, in Riviera we have to put sim libs in vsim call (with -L) and in vlog (with -l)
|
|
289
|
+
# we previously updated self.args['sim-library'] with self.update_library_map()
|
|
290
|
+
vmap_lines_str = self.get_vmap_lines_str()
|
|
291
|
+
vsim_libs = ' '.join([f'-L {x}' for x in self.args['sim-library']])
|
|
282
292
|
|
|
283
293
|
vsim_one_liner = (
|
|
284
294
|
"vsim"
|
|
@@ -286,11 +296,16 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
286
296
|
f" {voptargs_str} {vsim_ext_args} {vsim_libs} work.{self.args['top']}"
|
|
287
297
|
)
|
|
288
298
|
|
|
299
|
+
|
|
300
|
+
for l in self.args['add-top-library']:
|
|
301
|
+
vsim_one_liner += f' {l}'
|
|
302
|
+
|
|
289
303
|
vsim_one_liner = vsim_one_liner.replace('\n', ' ') # needs to be a one-liner
|
|
290
304
|
|
|
291
305
|
vsim_vlogonly_dot_do_lines = [
|
|
292
306
|
"if {[file exists work]} { vdel -all work; }",
|
|
293
307
|
"vlib work;",
|
|
308
|
+
vmap_lines_str,
|
|
294
309
|
"if {[catch {vlog -f vlog.f} result]} {",
|
|
295
310
|
" echo \"Caught $result \";",
|
|
296
311
|
" if {[batch_mode]} {",
|
|
@@ -306,6 +321,7 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
306
321
|
"if {[file exists work]} { vdel -all work; }",
|
|
307
322
|
"vlib work;",
|
|
308
323
|
"set qc 30;",
|
|
324
|
+
vmap_lines_str,
|
|
309
325
|
"if {[catch {vlog -f vlog.f} result]} {",
|
|
310
326
|
" echo \"Caught $result \";",
|
|
311
327
|
" if {[batch_mode]} {",
|
|
@@ -327,6 +343,7 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
327
343
|
"if {[file exists work]} { vdel -all work; }",
|
|
328
344
|
"vlib work;",
|
|
329
345
|
"set qc 30;",
|
|
346
|
+
vmap_lines_str,
|
|
330
347
|
"if {[catch {vlog -f vlog.f} result]} {",
|
|
331
348
|
" echo \"Caught $result \";",
|
|
332
349
|
" if {[batch_mode]} {",
|
|
@@ -407,6 +424,38 @@ class CommandSimRiviera(CommonSimQuesta, ToolRiviera):
|
|
|
407
424
|
|
|
408
425
|
return ' '.join(vsim_suppress_list)
|
|
409
426
|
|
|
427
|
+
def update_library_map(self, base_search_paths: list | None = None) -> None:
|
|
428
|
+
'''Override from sim::CommandSim
|
|
429
|
+
|
|
430
|
+
We add some common places to look relative to the Riviera install paths
|
|
431
|
+
'''
|
|
432
|
+
bsp = []
|
|
433
|
+
if isinstance(base_search_paths, list):
|
|
434
|
+
bsp += base_search_paths
|
|
435
|
+
bsp += [
|
|
436
|
+
Path(self.sim_exe_base_path),
|
|
437
|
+
Path(self.sim_exe_base_path) / '..',
|
|
438
|
+
Path(self.sim_exe_base_path) / '..' / 'vlib',
|
|
439
|
+
]
|
|
440
|
+
super().update_library_map(base_search_paths=bsp)
|
|
441
|
+
|
|
442
|
+
def get_vmap_lines_str(self) -> str:
|
|
443
|
+
'''Returns an empty str, or single str in the form:
|
|
444
|
+
|
|
445
|
+
vmap -global LibraryName AbsolutePathToDotLibFile
|
|
446
|
+
vmap -global LibraryName2 AbsolutePathToAnotherDotLibFile
|
|
447
|
+
...
|
|
448
|
+
uses self.args['library-map'], updates self.args['sim-library']
|
|
449
|
+
'''
|
|
450
|
+
if not self.library_map:
|
|
451
|
+
return ''
|
|
452
|
+
|
|
453
|
+
lines = []
|
|
454
|
+
for lib_name, lib_file_path in self.library_map.items():
|
|
455
|
+
lines.append(f'vmap -global {lib_name} {lib_file_path}')
|
|
456
|
+
|
|
457
|
+
return '\n'.join(lines)
|
|
458
|
+
|
|
410
459
|
|
|
411
460
|
class CommandElabRiviera(CommandSimRiviera):
|
|
412
461
|
'''CommandElabRiviera is a command handler for: eda elab --tool=riviera'''
|
|
@@ -147,6 +147,7 @@ class VerilatorSim(CommandSim, ToolVerilator):
|
|
|
147
147
|
# We do not override CommandSim.do_it()
|
|
148
148
|
def prepare_compile(self):
|
|
149
149
|
self.set_tool_defines()
|
|
150
|
+
self.update_library_map()
|
|
150
151
|
|
|
151
152
|
# If there are C++ files here, then we will run Verilator in --cc mode:
|
|
152
153
|
if self.files_cpp:
|
|
@@ -249,6 +250,10 @@ class VerilatorSim(CommandSim, ToolVerilator):
|
|
|
249
250
|
'-top', self.args['top'],
|
|
250
251
|
]
|
|
251
252
|
|
|
253
|
+
if self.args['add-top-library']:
|
|
254
|
+
util.warning('--add-top-library: currently not supported in eda --tool=verilator:',
|
|
255
|
+
f'{self.args["add-top-library"]}')
|
|
256
|
+
|
|
252
257
|
if not lint_only:
|
|
253
258
|
verilate_command_list += [
|
|
254
259
|
'-o', 'sim.exe',
|
|
@@ -39,7 +39,10 @@ class ToolVivado(Tool):
|
|
|
39
39
|
})
|
|
40
40
|
self.args_help.update({
|
|
41
41
|
'part': 'Device used for commands: synth, build.',
|
|
42
|
-
'add-glbl-v':
|
|
42
|
+
'add-glbl-v': (
|
|
43
|
+
'(for simulation) add glbl.v to filelist, "glbl" to sim libraries, and "glbl"'
|
|
44
|
+
' as an additional top level hier.'
|
|
45
|
+
),
|
|
43
46
|
})
|
|
44
47
|
|
|
45
48
|
|
|
@@ -124,6 +127,8 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
124
127
|
Note that we attempt to run a generated .tcl script within vivado, that will perform the
|
|
125
128
|
3-step compile/elaborate/simulate steps'''
|
|
126
129
|
|
|
130
|
+
library_map_supported = True
|
|
131
|
+
|
|
127
132
|
def __init__(self, config: dict):
|
|
128
133
|
CommandSim.__init__(self, config)
|
|
129
134
|
ToolVivado.__init__(self, config=self.config)
|
|
@@ -139,7 +144,16 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
139
144
|
'gui': 'Run Vivado XSim in GUI mode',
|
|
140
145
|
'tcl-file': 'name of TCL file to be created for XSim',
|
|
141
146
|
'fpga': 'FPGA device name, can be used for various Xilinx IP or XCIs',
|
|
142
|
-
'add-glbl-v':
|
|
147
|
+
'add-glbl-v': (
|
|
148
|
+
'Use the glbl.v in xvlog, xelab for this version of Vivado. Adds glbl.v to'
|
|
149
|
+
' filelist(s), and add "glbl" as an additional top level hier to xelab.'
|
|
150
|
+
),
|
|
151
|
+
'library-map': (
|
|
152
|
+
'list arg (can set multiple) with values LibName:Path, for example:'
|
|
153
|
+
' --library-map=unisim:path/to/custom_lib_name.lib'
|
|
154
|
+
' The Path search is relative to the tool exe, one level above the tool exe,'
|
|
155
|
+
' or can be absolute path.'
|
|
156
|
+
)
|
|
143
157
|
})
|
|
144
158
|
|
|
145
159
|
self.sim_libraries = self.tool_config.get('sim-libraries', [])
|
|
@@ -165,6 +179,7 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
165
179
|
|
|
166
180
|
def prepare_compile(self):
|
|
167
181
|
self.set_tool_defines()
|
|
182
|
+
self.update_library_map()
|
|
168
183
|
|
|
169
184
|
# Don't use the return values, these will set values in self.vivado_tcl:
|
|
170
185
|
self.get_compile_command_lists()
|
|
@@ -321,11 +336,13 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
321
336
|
command_list += ['-debug', 'wave']
|
|
322
337
|
if util.args['verbose']:
|
|
323
338
|
command_list += ['-v', '2']
|
|
324
|
-
if self.args['sim-library']
|
|
339
|
+
if self.args['sim-library']:
|
|
325
340
|
self.sim_libraries += self.args['sim-library'] # Add any command line libraries
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
341
|
+
for x in self.sim_libraries:
|
|
342
|
+
command_list += ['-L', x]
|
|
343
|
+
if self.args['add-top-library']:
|
|
344
|
+
command_list += self.args['add-top-library'] # list
|
|
345
|
+
|
|
329
346
|
command_list += self.args['elab-args']
|
|
330
347
|
|
|
331
348
|
# For Windows compatibility, we have some issues with command/Powershell passing args
|
|
@@ -447,6 +464,10 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
447
464
|
command_list += self.tool_config.get('compile-args', '').split()
|
|
448
465
|
if util.args['verbose']:
|
|
449
466
|
command_list += ['-v', '2']
|
|
467
|
+
|
|
468
|
+
# If there were any external .lib files from --library-map args, add those now:
|
|
469
|
+
command_list.extend(self._get_xvlog_library_map_list())
|
|
470
|
+
|
|
450
471
|
for value in self.incdirs:
|
|
451
472
|
command_list.append('-i')
|
|
452
473
|
command_list.append(Path(value).as_posix())
|
|
@@ -491,13 +512,28 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
491
512
|
glbl_v = self.vivado_base_path.replace(
|
|
492
513
|
'bin', os.path.join('data', 'verilog', 'src', 'glbl.v')
|
|
493
514
|
)
|
|
494
|
-
if any(x.
|
|
515
|
+
if any(x and os.path.split(x)[1] == 'glbl.v' for x in self.files_v):
|
|
495
516
|
util.warning(f'--add-glbl-v: Not adding {glbl_v=} b/c glbl.v already in',
|
|
496
517
|
f'{self.files_v=}')
|
|
497
518
|
elif not os.path.exists(glbl_v):
|
|
498
519
|
self.error(f"Could not find file {glbl_v=}")
|
|
499
520
|
else:
|
|
500
521
|
self.files_v.insert(0, glbl_v)
|
|
522
|
+
# add to self.args['add-top-library']
|
|
523
|
+
if 'glbl' not in self.args['add-top-library']:
|
|
524
|
+
self.args['add-top-library'].append('glbl')
|
|
525
|
+
|
|
526
|
+
def _get_xvlog_library_map_list(self) -> list:
|
|
527
|
+
'''Returns list of lines used in vlog step for --library-map args
|
|
528
|
+
|
|
529
|
+
Note that Vivado does not do library name re-mapping, the name comes
|
|
530
|
+
from the .lib file internals.
|
|
531
|
+
'''
|
|
532
|
+
|
|
533
|
+
lines = []
|
|
534
|
+
for _, lib_file_path in self.library_map.items():
|
|
535
|
+
lines.append(f'-libmap {lib_file_path}')
|
|
536
|
+
return lines
|
|
501
537
|
|
|
502
538
|
|
|
503
539
|
def artifacts_add(self, name: str, typ: str, description: str) -> None:
|
|
@@ -22,7 +22,7 @@ def get_commands_to_run_scriptfiles(
|
|
|
22
22
|
|
|
23
23
|
list of yoysys script(s)'''
|
|
24
24
|
|
|
25
|
-
if script_fnames_list:
|
|
25
|
+
if not script_fnames_list:
|
|
26
26
|
return []
|
|
27
27
|
|
|
28
28
|
yosys_cmdlists = []
|
|
@@ -142,7 +142,12 @@ class CommonSynthYosys(CommandSynth, ToolYosys):
|
|
|
142
142
|
'yosys-scriptfile': (
|
|
143
143
|
'Instead of using a built-in flow from eda, use your own scripts that are called'
|
|
144
144
|
' via: yosys --scriptfile <this-arg>. You can set multiple args for multiple'
|
|
145
|
-
' scriptfile (appends)'
|
|
145
|
+
' scriptfile (appends). NOTE: the default for eda is to run in a work-dir such as'
|
|
146
|
+
' ./eda.work/<target>.synth/, which means you may want to use absolute paths for'
|
|
147
|
+
' source files (.sv, etc) in your custom scriptfile, or use ../.. to get back to '
|
|
148
|
+
' the current directory. If you want to run in place and avoid'
|
|
149
|
+
' ./eda.work/<target>.synth/ you can use arg --work-dir=. or to run in place from'
|
|
150
|
+
' the DEPS target directory, use --work-dir-use-target-dir'
|
|
146
151
|
),
|
|
147
152
|
'sta-scriptfile': (
|
|
148
153
|
'Instead of using a built-in flow from eda, use your own script that is called'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencos-eda
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.14
|
|
4
4
|
Summary: A simple Python package for wrapping RTL simuliatons and synthesis
|
|
5
5
|
Author-email: Simon Sabato <simon@cognichip.ai>, Drew Ranck <drew@cognichip.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cognichip/opencos
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|