opencos-eda 0.2.54__py3-none-any.whl → 0.2.56__py3-none-any.whl
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/commands/__init__.py +2 -0
- opencos/commands/flist.py +10 -0
- opencos/commands/lint.py +51 -0
- opencos/commands/sim.py +31 -0
- opencos/deps/defaults.py +2 -0
- opencos/deps/deps_file.py +3 -1
- opencos/deps/deps_processor.py +39 -1
- opencos/deps_schema.py +22 -0
- opencos/eda.py +16 -5
- opencos/eda_base.py +108 -10
- opencos/eda_config.py +2 -1
- opencos/eda_config_defaults.yml +13 -1
- opencos/export_helper.py +15 -5
- opencos/hw/oc_cli.py +1 -1
- opencos/names.py +4 -1
- opencos/tests/helpers.py +5 -0
- opencos/tests/test_eda_elab.py +26 -5
- opencos/tests/test_eda_synth.py +12 -0
- opencos/tools/invio.py +8 -1
- opencos/tools/invio_helpers.py +47 -8
- opencos/tools/invio_yosys.py +3 -2
- opencos/tools/iverilog.py +18 -0
- opencos/tools/modelsim_ase.py +19 -1
- opencos/tools/quartus.py +93 -12
- opencos/tools/questa.py +14 -0
- opencos/tools/questa_fse.py +13 -0
- opencos/tools/riviera.py +30 -3
- opencos/tools/slang.py +17 -1
- opencos/tools/slang_yosys.py +9 -0
- opencos/tools/surelog.py +18 -0
- opencos/tools/verilator.py +19 -0
- opencos/tools/vivado.py +26 -2
- opencos/tools/yosys.py +15 -0
- opencos/util.py +7 -1
- opencos/utils/str_helpers.py +8 -4
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/METADATA +2 -2
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/RECORD +42 -41
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/WHEEL +0 -0
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/entry_points.txt +0 -0
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/licenses/LICENSE +0 -0
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/licenses/LICENSE.spdx +0 -0
- {opencos_eda-0.2.54.dist-info → opencos_eda-0.2.56.dist-info}/top_level.txt +0 -0
opencos/eda_config_defaults.yml
CHANGED
|
@@ -7,6 +7,7 @@ DEFAULT_HANDLERS:
|
|
|
7
7
|
# These commands (sim, elab, etc) require a tool, but have a default handler
|
|
8
8
|
# base class:
|
|
9
9
|
sim : opencos.commands.CommandSim
|
|
10
|
+
lint : opencos.commands.CommandLint
|
|
10
11
|
elab : opencos.commands.CommandElab
|
|
11
12
|
synth : opencos.commands.CommandSynth
|
|
12
13
|
proj : opencos.commands.CommandProj
|
|
@@ -29,7 +30,8 @@ DEFAULT_HANDLERS:
|
|
|
29
30
|
|
|
30
31
|
DEFAULT_HANDLERS_HELP:
|
|
31
32
|
sim: Simulates a DEPS target.
|
|
32
|
-
|
|
33
|
+
lint: Syntax check, lint a DEPS target
|
|
34
|
+
elab: Elaborates a DEPS target (lint + elab, tool specific).
|
|
33
35
|
synth: Synthesizes a DEPS target.
|
|
34
36
|
flist: Create dependency from a DEPS target.
|
|
35
37
|
proj: Create a project from a DEPS target for GUI sim/waves/debug.
|
|
@@ -362,11 +364,13 @@ auto_tools_order:
|
|
|
362
364
|
requires_cmd:
|
|
363
365
|
- slang --version
|
|
364
366
|
handlers:
|
|
367
|
+
lint: opencos.tools.slang.CommandLintSlang
|
|
365
368
|
elab: opencos.tools.slang.CommandElabSlang
|
|
366
369
|
|
|
367
370
|
verilator:
|
|
368
371
|
exe: verilator
|
|
369
372
|
handlers:
|
|
373
|
+
lint: opencos.tools.verilator.VerilatorLint
|
|
370
374
|
elab: opencos.tools.verilator.VerilatorElab
|
|
371
375
|
sim: opencos.tools.verilator.VerilatorSim
|
|
372
376
|
|
|
@@ -382,6 +386,7 @@ auto_tools_order:
|
|
|
382
386
|
requires_cmd:
|
|
383
387
|
- surelog --version
|
|
384
388
|
handlers:
|
|
389
|
+
lint: opencos.tools.surelog.CommandLintSurelog
|
|
385
390
|
elab: opencos.tools.surelog.CommandElabSurelog
|
|
386
391
|
|
|
387
392
|
invio:
|
|
@@ -391,6 +396,7 @@ auto_tools_order:
|
|
|
391
396
|
requires_py:
|
|
392
397
|
- invio
|
|
393
398
|
handlers:
|
|
399
|
+
lint: opencos.tools.invio.CommandLintInvio
|
|
394
400
|
elab: opencos.tools.invio.CommandElabInvio
|
|
395
401
|
|
|
396
402
|
vaporview:
|
|
@@ -422,6 +428,7 @@ auto_tools_order:
|
|
|
422
428
|
vivado:
|
|
423
429
|
exe: vivado
|
|
424
430
|
handlers:
|
|
431
|
+
lint: opencos.tools.vivado.CommandLintVivado
|
|
425
432
|
elab: opencos.tools.vivado.CommandElabVivado
|
|
426
433
|
sim: opencos.tools.vivado.CommandSimVivado
|
|
427
434
|
synth: opencos.tools.vivado.CommandSynthVivado
|
|
@@ -469,6 +476,7 @@ auto_tools_order:
|
|
|
469
476
|
exe: qrun
|
|
470
477
|
requires_vsim_helper: True
|
|
471
478
|
handlers:
|
|
479
|
+
lint: opencos.tools.questa.CommandLintQuesta
|
|
472
480
|
elab: opencos.tools.questa.CommandElabQuesta
|
|
473
481
|
sim: opencos.tools.questa.CommandSimQuesta
|
|
474
482
|
flist: opencos.tools.questa.CommandFListQuesta
|
|
@@ -479,6 +487,7 @@ auto_tools_order:
|
|
|
479
487
|
- which riviera # Do not run it, make sure it's in PATH
|
|
480
488
|
requires_vsim_helper: True
|
|
481
489
|
handlers:
|
|
490
|
+
lint: opencos.tools.riviera.CommandLintRiviera
|
|
482
491
|
elab: opencos.tools.riviera.CommandElabRiviera
|
|
483
492
|
sim: opencos.tools.riviera.CommandSimRiviera
|
|
484
493
|
|
|
@@ -486,6 +495,7 @@ auto_tools_order:
|
|
|
486
495
|
exe: vsim
|
|
487
496
|
requires_vsim_helper: True
|
|
488
497
|
handlers:
|
|
498
|
+
lint: opencos.tools.modelsim_ase.CommandLintModelsimAse
|
|
489
499
|
elab: opencos.tools.modelsim_ase.CommandElabModelsimAse
|
|
490
500
|
sim: opencos.tools.modelsim_ase.CommandSimModelsimAse
|
|
491
501
|
|
|
@@ -493,6 +503,7 @@ auto_tools_order:
|
|
|
493
503
|
exe: vsim
|
|
494
504
|
requires_vsim_helper: True
|
|
495
505
|
handlers:
|
|
506
|
+
lint: opencos.tools.questa_fse.CommandLintQuestaFse
|
|
496
507
|
elab: opencos.tools.questa_fse.CommandElabQuestaFse
|
|
497
508
|
sim: opencos.tools.questa_fse.CommandSimQuestaFse
|
|
498
509
|
flist: opencos.tools.questa_fse.CommandFListQuestaFse
|
|
@@ -500,6 +511,7 @@ auto_tools_order:
|
|
|
500
511
|
iverilog:
|
|
501
512
|
exe: iverilog
|
|
502
513
|
handlers:
|
|
514
|
+
lint: opencos.tools.iverilog.CommandLintIverilog
|
|
503
515
|
elab: opencos.tools.iverilog.CommandElabIverilog
|
|
504
516
|
sim: opencos.tools.iverilog.CommandSimIverilog
|
|
505
517
|
|
opencos/export_helper.py
CHANGED
|
@@ -387,6 +387,13 @@ class ExportHelper:
|
|
|
387
387
|
paths.
|
|
388
388
|
'''
|
|
389
389
|
|
|
390
|
+
# We'll copy files_sv and files_v later, along with discovered included files,
|
|
391
|
+
# need to copy any others:
|
|
392
|
+
remaing_files_to_cp = []
|
|
393
|
+
for x in self.cmd_design_obj.files.keys():
|
|
394
|
+
if x not in self.cmd_design_obj.files_v + self.cmd_design_obj.files_sv:
|
|
395
|
+
remaing_files_to_cp.append(x)
|
|
396
|
+
|
|
390
397
|
# Also sets our list of included files.
|
|
391
398
|
self.included_files = get_list_sv_included_files(
|
|
392
399
|
all_src_files=self.cmd_design_obj.files_sv + self.cmd_design_obj.files_v,
|
|
@@ -398,7 +405,8 @@ class ExportHelper:
|
|
|
398
405
|
|
|
399
406
|
info(f"export_helper: {self.target=} included files {self.included_files=}")
|
|
400
407
|
|
|
401
|
-
|
|
408
|
+
|
|
409
|
+
for filename in remaing_files_to_cp:
|
|
402
410
|
dst = os.path.join(self.out_dir, os.path.split(filename)[1])
|
|
403
411
|
if not os.path.exists(dst):
|
|
404
412
|
shutil.copy(src=filename, dst=dst)
|
|
@@ -415,11 +423,13 @@ class ExportHelper:
|
|
|
415
423
|
|
|
416
424
|
info(f'export_helper: Creating DEPS.yml for {self.target=} in {self.out_dir=}')
|
|
417
425
|
|
|
418
|
-
# Need to strip path information from our files_sv and files_v
|
|
426
|
+
# Need to strip path information from our files_sv and files_v
|
|
427
|
+
# (and all source files: cpp, sdc, etc; but skip the non-source files):
|
|
419
428
|
deps_files = []
|
|
420
|
-
for fullpath in self.cmd_design_obj.
|
|
421
|
-
|
|
422
|
-
|
|
429
|
+
for fullpath in self.cmd_design_obj.files.keys():
|
|
430
|
+
if fullpath not in self.cmd_design_obj.files_non_source:
|
|
431
|
+
filename = os.path.split(fullpath)[1]
|
|
432
|
+
deps_files.append(filename)
|
|
423
433
|
|
|
424
434
|
|
|
425
435
|
data = {
|
opencos/hw/oc_cli.py
CHANGED
|
@@ -2508,7 +2508,7 @@ name_tables = { 'OC_VENDOR' : {},
|
|
|
2508
2508
|
}
|
|
2509
2509
|
|
|
2510
2510
|
def parse_names():
|
|
2511
|
-
name_tables.update(opencos_names.
|
|
2511
|
+
name_tables.update(opencos_names.NAMES) #update our global name_table from names.py
|
|
2512
2512
|
|
|
2513
2513
|
def lookup_table_string(table, index):
|
|
2514
2514
|
if isinstance(table, str) and table in name_tables:
|
opencos/names.py
CHANGED
|
@@ -13,11 +13,12 @@ just needs to set a couple of these statically.
|
|
|
13
13
|
all values in this file are in hex.
|
|
14
14
|
'''
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
NAMES = {
|
|
17
17
|
|
|
18
18
|
'OC_VENDOR': {
|
|
19
19
|
0: "None",
|
|
20
20
|
1: "Xilinx",
|
|
21
|
+
2: "Altera",
|
|
21
22
|
},
|
|
22
23
|
|
|
23
24
|
'OC_BOARD': {
|
|
@@ -28,11 +29,13 @@ table = {
|
|
|
28
29
|
4: "U55N",
|
|
29
30
|
5: "U50C",
|
|
30
31
|
6: "PYNQ-Z2",
|
|
32
|
+
7: "AG3C_DEVKIT",
|
|
31
33
|
},
|
|
32
34
|
|
|
33
35
|
'OC_LIBRARY': {
|
|
34
36
|
0: "None",
|
|
35
37
|
1: "Ultrascale+",
|
|
38
|
+
2: "Agilex3"
|
|
36
39
|
},
|
|
37
40
|
|
|
38
41
|
'PLL_TYPES': {
|
opencos/tests/helpers.py
CHANGED
|
@@ -65,6 +65,11 @@ def eda_elab_wrap(*args):
|
|
|
65
65
|
main_args = [x for x in list(args) if (x != 'elab' and '--seed' not in x)]
|
|
66
66
|
return eda.main('elab', *main_args)
|
|
67
67
|
|
|
68
|
+
def eda_lint_wrap(*args):
|
|
69
|
+
'''Calls eda.main for 'elab'.'''
|
|
70
|
+
main_args = [x for x in list(args) if (x != 'lint' and '--seed' not in x)]
|
|
71
|
+
return eda.main('lint', *main_args)
|
|
72
|
+
|
|
68
73
|
def assert_sim_log_passes(
|
|
69
74
|
filepath: str, want_str: str = 'TEST PASS',
|
|
70
75
|
err_strs: list = ['Error', 'ERROR', 'TEST FAIL']
|
opencos/tests/test_eda_elab.py
CHANGED
|
@@ -5,7 +5,7 @@ import pytest
|
|
|
5
5
|
|
|
6
6
|
from opencos import eda_tool_helper
|
|
7
7
|
from opencos.tests import helpers
|
|
8
|
-
from opencos.tests.helpers import eda_wrap, eda_elab_wrap
|
|
8
|
+
from opencos.tests.helpers import eda_wrap, eda_elab_wrap, eda_lint_wrap
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
thispath = os.path.dirname(__file__)
|
|
@@ -29,6 +29,16 @@ list_of_elab_tools = [
|
|
|
29
29
|
'invio_yosys',
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
+
list_of_lint_tools = [
|
|
33
|
+
'slang',
|
|
34
|
+
'verilator',
|
|
35
|
+
'vivado',
|
|
36
|
+
'modelsim_ase'
|
|
37
|
+
'questa_fse',
|
|
38
|
+
'invio',
|
|
39
|
+
'surelog',
|
|
40
|
+
]
|
|
41
|
+
|
|
32
42
|
list_of_elab_tools_cant_sim = [
|
|
33
43
|
'slang',
|
|
34
44
|
'invio',
|
|
@@ -36,6 +46,11 @@ list_of_elab_tools_cant_sim = [
|
|
|
36
46
|
'invio_yosys',
|
|
37
47
|
]
|
|
38
48
|
|
|
49
|
+
list_of_commands = [
|
|
50
|
+
'elab',
|
|
51
|
+
'lint',
|
|
52
|
+
]
|
|
53
|
+
|
|
39
54
|
def skip_it(tool) -> bool:
|
|
40
55
|
'''Returns True if this test should be skipped
|
|
41
56
|
|
|
@@ -44,27 +59,33 @@ def skip_it(tool) -> bool:
|
|
|
44
59
|
'''
|
|
45
60
|
return bool( tool not in tools_loaded )
|
|
46
61
|
|
|
62
|
+
@pytest.mark.parametrize("command", list_of_commands)
|
|
47
63
|
@pytest.mark.parametrize("tool", list_of_elab_tools)
|
|
48
64
|
class Tests:
|
|
49
65
|
'''Test tools from list_of_elab_tools for 'eda elab' and 'eda multi elab'.'''
|
|
50
66
|
|
|
51
|
-
def test_args_elab(self, tool):
|
|
67
|
+
def test_args_elab(self, command, tool):
|
|
52
68
|
'''tests: eda elab --tool oclib_priarb'''
|
|
69
|
+
if command == 'lint' and tool not in list_of_lint_tools:
|
|
70
|
+
pytest.skip(f"lint skipped for {tool=} b/c it can't run lint")
|
|
53
71
|
if skip_it(tool):
|
|
54
72
|
pytest.skip(f"{tool=} skipped, {tools_loaded=}")
|
|
55
73
|
return # skip/pass
|
|
56
74
|
chdir_remove_work_dir('../../lib')
|
|
57
|
-
|
|
75
|
+
if command == 'elab':
|
|
76
|
+
rc = eda_elab_wrap('--tool', tool, 'oclib_priarb')
|
|
77
|
+
else:
|
|
78
|
+
rc = eda_lint_wrap('--tool', tool, 'oclib_priarb')
|
|
58
79
|
print(f'{rc=}')
|
|
59
80
|
assert rc == 0
|
|
60
81
|
|
|
61
|
-
def test_args_multi_elab(self, tool):
|
|
82
|
+
def test_args_multi_elab(self, command, tool):
|
|
62
83
|
'''tests: eda multi elab --tool oclib_*arb'''
|
|
63
84
|
if skip_it(tool):
|
|
64
85
|
pytest.skip(f"{tool=} skipped, {tools_loaded=}")
|
|
65
86
|
return # skip/pass
|
|
66
87
|
chdir_remove_work_dir('../../lib')
|
|
67
|
-
rc = eda_wrap('multi',
|
|
88
|
+
rc = eda_wrap('multi', command, '--tool', tool, 'oclib_*arb')
|
|
68
89
|
print(f'{rc=}')
|
|
69
90
|
assert rc == 0
|
|
70
91
|
|
opencos/tests/test_eda_synth.py
CHANGED
|
@@ -8,6 +8,7 @@ import pytest
|
|
|
8
8
|
from opencos import eda, eda_tool_helper
|
|
9
9
|
from opencos.tests import helpers
|
|
10
10
|
from opencos.tests.helpers import Helpers
|
|
11
|
+
from opencos.utils.markup_helpers import yaml_safe_load
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
THISPATH = os.path.dirname(__file__)
|
|
@@ -108,6 +109,17 @@ class TestsSlangYosys(Helpers):
|
|
|
108
109
|
rc = self.log_it(cmd_str, use_eda_wrap=False)
|
|
109
110
|
assert rc == 0
|
|
110
111
|
|
|
112
|
+
# Since vanilla yosys won't use the SDC file, let's at least confirm
|
|
113
|
+
# that EDA used it and tracked it:
|
|
114
|
+
eda_config_yml_path = os.path.join(
|
|
115
|
+
os.getcwd(), 'eda.work', 'oclib_fifo_with_sdc.synth', 'eda_output_config.yml'
|
|
116
|
+
)
|
|
117
|
+
data = yaml_safe_load(eda_config_yml_path)
|
|
118
|
+
assert 'files_sdc' in data
|
|
119
|
+
assert data['files_sdc']
|
|
120
|
+
assert data['files_sdc'][0].endswith('oclib_fifo_yosys.sdc')
|
|
121
|
+
|
|
122
|
+
|
|
111
123
|
@pytest.mark.skipif('vivado' not in tools_loaded, reason="requires vivado")
|
|
112
124
|
@pytest.mark.skipif(not vivado_has_xpms(), reason="requires install to have XPMs")
|
|
113
125
|
class TestsVivado(Helpers):
|
opencos/tools/invio.py
CHANGED
|
@@ -38,6 +38,8 @@ class ToolInvio(Tool):
|
|
|
38
38
|
class CommandElabInvio(CommandElab, ToolInvio):
|
|
39
39
|
'''Command handler for: eda elab --tool=invio'''
|
|
40
40
|
|
|
41
|
+
command_name = 'elab'
|
|
42
|
+
|
|
41
43
|
def __init__(self, config:dict):
|
|
42
44
|
CommandElab.__init__(self, config)
|
|
43
45
|
ToolInvio.__init__(self, config=self.config)
|
|
@@ -72,7 +74,7 @@ class CommandElabInvio(CommandElab, ToolInvio):
|
|
|
72
74
|
'''Returns list of util.ShellCommandList, for slang we'll run this in elaborate()'''
|
|
73
75
|
invio_blackbox_list = self.args.get('invio-blackbox', [])
|
|
74
76
|
invio_dict = invio_helpers.get_invio_command_dict(
|
|
75
|
-
self, blackbox_list=invio_blackbox_list,
|
|
77
|
+
self, blackbox_list=invio_blackbox_list,
|
|
76
78
|
)
|
|
77
79
|
return invio_dict['command_lists']
|
|
78
80
|
|
|
@@ -84,3 +86,8 @@ class CommandElabInvio(CommandElab, ToolInvio):
|
|
|
84
86
|
def get_elaborate_command_lists(self, **kwargs) -> list:
|
|
85
87
|
'''We only use 'compile' commands for invio elab, do not use elaborate commands'''
|
|
86
88
|
return []
|
|
89
|
+
|
|
90
|
+
class CommandLintInvio(CommandElabInvio):
|
|
91
|
+
'''Command handler for: eda lint --tool=invio'''
|
|
92
|
+
|
|
93
|
+
command_name = 'lint'
|
opencos/tools/invio_helpers.py
CHANGED
|
@@ -34,6 +34,7 @@ def write_py_file(
|
|
|
34
34
|
py_filename: str = 'run_invio.py',
|
|
35
35
|
v_filename: str = '',
|
|
36
36
|
blackbox_list: list = [],
|
|
37
|
+
sim_lint: bool = False,
|
|
37
38
|
sim_elab: bool = False,
|
|
38
39
|
**kwargs
|
|
39
40
|
) -> dict:
|
|
@@ -60,6 +61,12 @@ def write_py_file(
|
|
|
60
61
|
'from invio import init, define_macro, add_include_directory, \\',
|
|
61
62
|
' add_verilog_file, add_sv_file, elaborate, elaborate_pct, analyze, \\',
|
|
62
63
|
' print_instance_hierarchy, write_design, report_analyzed_files',
|
|
64
|
+
]
|
|
65
|
+
if command_design_obj.parameters:
|
|
66
|
+
lines += [
|
|
67
|
+
'from invio import get_parameters, report_parameters, replace_expression_of_parameter'
|
|
68
|
+
]
|
|
69
|
+
lines += [
|
|
63
70
|
'import os, shutil',
|
|
64
71
|
'',
|
|
65
72
|
'for p in ["invio"]:',
|
|
@@ -137,10 +144,34 @@ def write_py_file(
|
|
|
137
144
|
tee_fpath = 'invio.log')]
|
|
138
145
|
})
|
|
139
146
|
|
|
140
|
-
|
|
147
|
+
lines += [
|
|
148
|
+
'assert analyze()',
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
if command_design_obj.parameters:
|
|
152
|
+
lines += [
|
|
153
|
+
'',
|
|
154
|
+
f'new_parameters = {command_design_obj.parameters}',
|
|
155
|
+
'for x in get_parameters():',
|
|
156
|
+
' name_parts = x.full_name.split("::")',
|
|
157
|
+
' mod, pname = name_parts[-2], name_parts[-1]',
|
|
158
|
+
f' if pname in new_parameters and mod == "{top}":',
|
|
159
|
+
' new_value = str(new_parameters[pname]) # invio needs str type for all',
|
|
160
|
+
' print(f"PARAMETER UPDATE: {mod}.{pname} ---> {new_value}")',
|
|
161
|
+
' replace_expression_of_parameter(x, new_value)',
|
|
162
|
+
'report_parameters()',
|
|
163
|
+
'',
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
if sim_lint:
|
|
167
|
+
# lint (skip elaborate steps -- from eda.CommandLintInvio)
|
|
168
|
+
lines += [
|
|
169
|
+
'report_analyzed_files()',
|
|
170
|
+
'print_instance_hierarchy()',
|
|
171
|
+
]
|
|
172
|
+
elif sim_elab:
|
|
141
173
|
# elab (non-synthesis), runs the following (from eda.CommandElabInvio)
|
|
142
174
|
lines += [
|
|
143
|
-
'assert analyze()',
|
|
144
175
|
f"assert elaborate('{top}', pct_elaboration=True, forceBlackbox={blackbox_list})",
|
|
145
176
|
'assert elaborate_pct()',
|
|
146
177
|
'',
|
|
@@ -150,7 +181,6 @@ def write_py_file(
|
|
|
150
181
|
else:
|
|
151
182
|
# synthesis-style elab (from eda.CommandElabInvioYosys)
|
|
152
183
|
lines += [
|
|
153
|
-
'assert analyze()',
|
|
154
184
|
f"assert elaborate('{top}', rtl_elaboration=True, forceBlackbox={blackbox_list})",
|
|
155
185
|
'',
|
|
156
186
|
'report_analyzed_files()',
|
|
@@ -206,14 +236,23 @@ def write_py_file(
|
|
|
206
236
|
|
|
207
237
|
|
|
208
238
|
|
|
209
|
-
def get_invio_command_dict(
|
|
210
|
-
|
|
239
|
+
def get_invio_command_dict(
|
|
240
|
+
command_design_obj:object, v_filename='', py_filename='run_invio.py',
|
|
241
|
+
blackbox_list=[],
|
|
242
|
+
**kwargs
|
|
243
|
+
) -> dict:
|
|
211
244
|
'''Creates a .py file from an eda.CommandDesign. Returns a dict with
|
|
212
245
|
|
|
213
246
|
information about what to run.'''
|
|
214
247
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
cmd_name = getattr(command_design_obj, 'command_name', '')
|
|
249
|
+
sim_lint = cmd_name == 'lint'
|
|
250
|
+
sim_elab = cmd_name == 'elab'
|
|
251
|
+
|
|
252
|
+
invio_dict = write_py_file(
|
|
253
|
+
command_design_obj, v_filename=v_filename,
|
|
254
|
+
py_filename=py_filename, blackbox_list=blackbox_list,
|
|
255
|
+
sim_elab=sim_elab, sim_lint=sim_lint, **kwargs
|
|
256
|
+
)
|
|
218
257
|
|
|
219
258
|
return invio_dict
|
opencos/tools/invio_yosys.py
CHANGED
|
@@ -59,7 +59,7 @@ class CommandSynthInvioYosys(CommonSynthYosys, ToolInvioYosys):
|
|
|
59
59
|
|
|
60
60
|
# Generate run_invio.py:
|
|
61
61
|
invio_dict = invio_helpers.get_invio_command_dict(
|
|
62
|
-
self, blackbox_list=invio_blackbox_list,
|
|
62
|
+
self, blackbox_list=invio_blackbox_list,
|
|
63
63
|
)
|
|
64
64
|
# run run_invio.py:
|
|
65
65
|
if not self.args.get('stop-before-compile', False):
|
|
@@ -146,9 +146,10 @@ class CommandSynthInvioYosys(CommonSynthYosys, ToolInvioYosys):
|
|
|
146
146
|
class CommandElabInvioYosys(CommandSynthInvioYosys):
|
|
147
147
|
'''Run invio + yosys as elab only (does not run the synthesis portion)'''
|
|
148
148
|
|
|
149
|
+
command_name = 'elab'
|
|
150
|
+
|
|
149
151
|
def __init__(self, config):
|
|
150
152
|
super().__init__(config)
|
|
151
|
-
self.command_name = 'elab'
|
|
152
153
|
self.args.update({
|
|
153
154
|
'stop-after-compile': True, # In the case of Invio/Yosys we run the Invio step
|
|
154
155
|
'lint': True
|
opencos/tools/iverilog.py
CHANGED
|
@@ -136,6 +136,11 @@ class CommandSimIverilog(CommandSim, ToolIverilog):
|
|
|
136
136
|
# +define+{k}={v}, but also for SystemVerilog plusargs
|
|
137
137
|
command_list += [ '-D', f'{k}={sanitize_defines_for_sh(v)}' ]
|
|
138
138
|
|
|
139
|
+
# parameters
|
|
140
|
+
command_list.extend(
|
|
141
|
+
self.process_parameters_get_list(arg_prefix=f'-P{self.args["top"]}.')
|
|
142
|
+
)
|
|
143
|
+
|
|
139
144
|
if not self.files_sv and not self.files_v:
|
|
140
145
|
if not self.args['stop-before-compile']:
|
|
141
146
|
self.error(f'{self.target=} {self.files_sv=} and {self.files_v=} are empty,',
|
|
@@ -164,6 +169,19 @@ class CommandSimIverilog(CommandSim, ToolIverilog):
|
|
|
164
169
|
class CommandElabIverilog(CommandSimIverilog):
|
|
165
170
|
'''CommandElabIverilog is a command handler for: eda elab --tool=iverilog'''
|
|
166
171
|
|
|
172
|
+
command_name = 'elab'
|
|
173
|
+
|
|
174
|
+
def __init__(self, config:dict):
|
|
175
|
+
super().__init__(config)
|
|
176
|
+
self.args['stop-after-elaborate'] = True
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class CommandLintIverilog(CommandSimIverilog):
|
|
180
|
+
'''CommandLintIverilog is a command handler for: eda lint --tool=iverilog'''
|
|
181
|
+
|
|
182
|
+
command_name = 'lint'
|
|
183
|
+
|
|
167
184
|
def __init__(self, config:dict):
|
|
168
185
|
super().__init__(config)
|
|
186
|
+
self.args['stop-after-compile'] = True
|
|
169
187
|
self.args['stop-after-elaborate'] = True
|
opencos/tools/modelsim_ase.py
CHANGED
|
@@ -94,7 +94,8 @@ class CommandSimModelsimAse(CommandSim, ToolModelsimAse):
|
|
|
94
94
|
return
|
|
95
95
|
if self.args['stop-after-compile']:
|
|
96
96
|
vsim_command_lists = self.get_compile_command_lists()
|
|
97
|
-
self.run_commands_check_logs(vsim_command_lists, log_filename='sim.log'
|
|
97
|
+
self.run_commands_check_logs(vsim_command_lists, log_filename='sim.log',
|
|
98
|
+
must_strings=['Errors: 0'], use_must_strings=False)
|
|
98
99
|
|
|
99
100
|
def elaborate(self):
|
|
100
101
|
if self.args['stop-before-compile']:
|
|
@@ -222,6 +223,10 @@ class CommandSimModelsimAse(CommandSim, ToolModelsimAse):
|
|
|
222
223
|
typ='waveform', description='Modelsim/Questa Waveform WLF (Wave Log Format) file'
|
|
223
224
|
)
|
|
224
225
|
|
|
226
|
+
# parameters
|
|
227
|
+
if self.parameters:
|
|
228
|
+
voptargs_str += ' ' + ' '.join(self.process_parameters_get_list(arg_prefix='-G'))
|
|
229
|
+
|
|
225
230
|
# TODO(drew): support self.args['sim_libary', 'elab-args', sim-args'] (3 lists)
|
|
226
231
|
# to add to vsim_one_liner.
|
|
227
232
|
|
|
@@ -369,6 +374,19 @@ class CommandSimModelsimAse(CommandSim, ToolModelsimAse):
|
|
|
369
374
|
class CommandElabModelsimAse(CommandSimModelsimAse):
|
|
370
375
|
'''CommandElabModelsimAse is a command handler for: eda elab --tool=modelsim_ase'''
|
|
371
376
|
|
|
377
|
+
command_name = 'elab'
|
|
378
|
+
|
|
379
|
+
def __init__(self, config:dict):
|
|
380
|
+
super().__init__(config)
|
|
381
|
+
self.args['stop-after-elaborate'] = True
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class CommandLintModelsimAse(CommandSimModelsimAse):
|
|
385
|
+
'''CommandLintModelsimAse is a command handler for: eda lint --tool=modelsim_ase'''
|
|
386
|
+
|
|
387
|
+
command_name = 'lint'
|
|
388
|
+
|
|
372
389
|
def __init__(self, config:dict):
|
|
373
390
|
super().__init__(config)
|
|
391
|
+
self.args['stop-after-compile'] = True
|
|
374
392
|
self.args['stop-after-elaborate'] = True
|