opencos-eda 0.2.34__tar.gz → 0.2.36__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.2.34/opencos_eda.egg-info → opencos_eda-0.2.36}/PKG-INFO +1 -1
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/deps_helpers.py +12 -7
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_config_defaults.yml +0 -1
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_deps_bash_completion.bash +1 -1
- opencos_eda-0.2.36/opencos/eda_extract_targets.py +117 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/export_helper.py +20 -19
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/verilator.py +5 -2
- {opencos_eda-0.2.34 → opencos_eda-0.2.36/opencos_eda.egg-info}/PKG-INFO +1 -1
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos_eda.egg-info/SOURCES.txt +1 -1
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos_eda.egg-info/entry_points.txt +1 -1
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/pyproject.toml +2 -2
- opencos_eda-0.2.34/opencos/eda_extract_deps_keys.py +0 -81
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/LICENSE +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/LICENSE.spdx +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/README.md +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/__init__.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/_version.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/_waves_pkg.sv +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/__init__.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/build.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/elab.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/export.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/flist.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/multi.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/open.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/proj.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/sim.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/sweep.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/synth.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/upload.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/commands/waves.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/deps_schema.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_base.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_config.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_config_max_verilator_waivers.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_config_reduced.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/eda_tool_helper.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/export_json_convert.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/files.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/names.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/oc_cli.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/pcie.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/peakrdl_cleanup.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/seed.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/__init__.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/custom_config.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/command_order/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/error_msgs/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/iverilog_test/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/no_deps_here/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/non_sv_reqs/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/tags_with_tools/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/deps_files/test_err_fatal/DEPS.yml +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/helpers.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_build.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_deps_helpers.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_deps_schema.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_eda.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_eda_elab.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_eda_synth.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_oc_cli.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tests/test_tools.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/__init__.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/invio.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/invio_helpers.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/invio_yosys.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/iverilog.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/modelsim_ase.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/questa.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/slang.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/slang_yosys.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/surelog.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/tabbycad_yosys.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/vivado.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/tools/yosys.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos/util.py +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos_eda.egg-info/dependency_links.txt +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos_eda.egg-info/requires.txt +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/opencos_eda.egg-info/top_level.txt +0 -0
- {opencos_eda-0.2.34 → opencos_eda-0.2.36}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencos-eda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.36
|
|
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
|
|
@@ -261,7 +261,8 @@ def get_all_targets(
|
|
|
261
261
|
base_path: str = os.getcwd(),
|
|
262
262
|
filter_str: str = '',
|
|
263
263
|
filter_using_multi: str = '',
|
|
264
|
-
error_on_empty_return: bool = True
|
|
264
|
+
error_on_empty_return: bool = True,
|
|
265
|
+
lstrip_path: bool = True
|
|
265
266
|
) -> list:
|
|
266
267
|
'''Returns a list of [dir/target, ... ] using relpath from base_path
|
|
267
268
|
|
|
@@ -273,6 +274,8 @@ def get_all_targets(
|
|
|
273
274
|
To all targets from dirs.
|
|
274
275
|
'''
|
|
275
276
|
|
|
277
|
+
_path_lprefix = str(Path('.')) + os.path.sep
|
|
278
|
+
|
|
276
279
|
if filter_using_multi:
|
|
277
280
|
targets = []
|
|
278
281
|
orig_dir = os.path.abspath(os.getcwd())
|
|
@@ -295,9 +298,10 @@ def get_all_targets(
|
|
|
295
298
|
this_dir, leaf_target = os.path.split(target)
|
|
296
299
|
if fnmatch_or_re(pattern=filter_str,
|
|
297
300
|
string=leaf_target):
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
t = os.path.join(os.path.relpath(this_dir, start=base_path), leaf_target)
|
|
302
|
+
if lstrip_path:
|
|
303
|
+
t = t.removeprefix(_path_lprefix)
|
|
304
|
+
targets.add(t)
|
|
301
305
|
targets = list(targets)
|
|
302
306
|
if not targets and error_on_empty_return:
|
|
303
307
|
error(f'get_all_targets: {base_path=} {filter_using_multi=} returned no targets')
|
|
@@ -314,9 +318,10 @@ def get_all_targets(
|
|
|
314
318
|
for leaf_target in deps_data_get_all_targets(data):
|
|
315
319
|
if not filter_str or fnmatch_or_re(pattern=filter_str,
|
|
316
320
|
string=leaf_target):
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
321
|
+
t = os.path.join(os.path.relpath(this_dir, start=base_path), leaf_target)
|
|
322
|
+
if lstrip_path:
|
|
323
|
+
t = t.removeprefix(_path_lprefix)
|
|
324
|
+
targets.add(t)
|
|
320
325
|
|
|
321
326
|
if not targets and error_on_empty_return:
|
|
322
327
|
error(f'get_all_targets: {base_path=} {dirs=} {filter_str=} returned no targets')
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
'''
|
|
4
|
+
Helper pymodule used by eda_deps_bash_completion.bash, extracts valid
|
|
5
|
+
targets from DEPS files
|
|
6
|
+
'''
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
import json
|
|
12
|
+
|
|
13
|
+
import yaml
|
|
14
|
+
import toml
|
|
15
|
+
|
|
16
|
+
from opencos.deps_helpers import get_all_targets
|
|
17
|
+
|
|
18
|
+
PATH_LPREFIX = str(Path('.')) + os.path.sep
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_terminal_columns():
|
|
22
|
+
"""
|
|
23
|
+
Retrieves the number of columns (width) of the terminal window.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
int: The number of columns in the terminal, or a default value (e.g., 80)
|
|
27
|
+
if the terminal size cannot be determined.
|
|
28
|
+
"""
|
|
29
|
+
try:
|
|
30
|
+
size = os.get_terminal_size()
|
|
31
|
+
return size.columns
|
|
32
|
+
except OSError:
|
|
33
|
+
# Handle cases where the terminal size cannot be determined (e.g., not in a TTY)
|
|
34
|
+
return 80 # Default to 80 columns
|
|
35
|
+
else:
|
|
36
|
+
return 80
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def print_columns_manual(data: list, num_columns: int = 4, auto_columns: bool = True) -> None:
|
|
40
|
+
"""Prints a list of strings in columns, manually aligning them."""
|
|
41
|
+
if not data:
|
|
42
|
+
print()
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
_spacing = 2
|
|
46
|
+
|
|
47
|
+
# Calculate maximum width for each column
|
|
48
|
+
max_lengths = [0] * num_columns
|
|
49
|
+
max_item_len = 0
|
|
50
|
+
for i, item in enumerate(data):
|
|
51
|
+
col_index = i % num_columns
|
|
52
|
+
max_lengths[col_index] = max(max_lengths[col_index], len(item))
|
|
53
|
+
max_item_len = max(max_item_len, len(item))
|
|
54
|
+
|
|
55
|
+
if auto_columns and num_columns > 1:
|
|
56
|
+
window_cols = get_terminal_columns()
|
|
57
|
+
max_line_len = 0
|
|
58
|
+
for x in max_lengths:
|
|
59
|
+
max_line_len += x + _spacing
|
|
60
|
+
if max_line_len > window_cols:
|
|
61
|
+
# subtract a column (already >= 2):
|
|
62
|
+
return print_columns_manual(data=data, num_columns=num_columns-1, auto_columns=True)
|
|
63
|
+
if max_line_len + max_item_len + _spacing < window_cols:
|
|
64
|
+
# add 1 more column if we're guaranteed to have room.
|
|
65
|
+
return print_columns_manual(data=data, num_columns=num_columns+1, auto_columns=True)
|
|
66
|
+
# else continue
|
|
67
|
+
|
|
68
|
+
# Print data in columns
|
|
69
|
+
for i, item in enumerate(data):
|
|
70
|
+
col_index = i % num_columns
|
|
71
|
+
print(item.ljust(max_lengths[col_index] + _spacing), end="") # Add padding
|
|
72
|
+
if col_index == num_columns - 1 or i == len(data) - 1:
|
|
73
|
+
print() # New line at the end of a row or end of data
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def run(partial_path: str = '', base_path=str(Path('.'))) -> None:
|
|
77
|
+
'''Returns None, prints DEPS keys into pretty columns, using arg
|
|
78
|
+
|
|
79
|
+
partial_path as a string filter for target completions.
|
|
80
|
+
'''
|
|
81
|
+
partial_target = ''
|
|
82
|
+
if not partial_path or partial_path == str(Path('.')):
|
|
83
|
+
partial_path = PATH_LPREFIX
|
|
84
|
+
if not os.path.exists(partial_path):
|
|
85
|
+
partial_path, partial_target = os.path.split(partial_path)
|
|
86
|
+
if not partial_path:
|
|
87
|
+
partial_path = PATH_LPREFIX
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
keys = get_all_targets(
|
|
91
|
+
dirs=[partial_path],
|
|
92
|
+
base_path=base_path,
|
|
93
|
+
filter_str=partial_target,
|
|
94
|
+
error_on_empty_return=False,
|
|
95
|
+
lstrip_path=True
|
|
96
|
+
)
|
|
97
|
+
except:
|
|
98
|
+
keys = []
|
|
99
|
+
|
|
100
|
+
print_columns_manual(data=keys, num_columns=4, auto_columns=True)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def main() -> None:
|
|
104
|
+
'''Returns None, prints DEPS keys into pretty columns, uses sys.argv[1] for args:
|
|
105
|
+
|
|
106
|
+
sys.args[1] -- optional partial path for target completions
|
|
107
|
+
'''
|
|
108
|
+
|
|
109
|
+
if len(sys.argv) > 1:
|
|
110
|
+
partial_path = sys.argv[1]
|
|
111
|
+
else:
|
|
112
|
+
partial_path = PATH_LPREFIX
|
|
113
|
+
run(partial_path)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if __name__ == "__main__":
|
|
117
|
+
main()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import shutil
|
|
2
3
|
import json
|
|
3
4
|
|
|
4
5
|
from opencos import util
|
|
@@ -75,7 +76,7 @@ def find_sv_included_files_within_file(filename:str,
|
|
|
75
76
|
known_incdir_paths:list,
|
|
76
77
|
warnings:bool=True,
|
|
77
78
|
modify_files_and_save_to_path=None,
|
|
78
|
-
|
|
79
|
+
unmodified_files_copy_to_path=None) -> list:
|
|
79
80
|
'''Given a filename (full path) and a list of known incdir paths, returns
|
|
80
81
|
a list of included files (full path).
|
|
81
82
|
|
|
@@ -83,8 +84,8 @@ def find_sv_included_files_within_file(filename:str,
|
|
|
83
84
|
to strip all path information on the `include "(path)" for example:
|
|
84
85
|
`include "foo.svh" -- no modifications
|
|
85
86
|
`include "../bar.svh" -- is modified to become `include "bar.svh"
|
|
86
|
-
(Optional)
|
|
87
|
-
to
|
|
87
|
+
(Optional) unmodified_files_copy_to_path (str: directory/path) if you wish
|
|
88
|
+
to copy unmodified files to this path.
|
|
88
89
|
'''
|
|
89
90
|
|
|
90
91
|
found_included_files = set()
|
|
@@ -97,7 +98,7 @@ def find_sv_included_files_within_file(filename:str,
|
|
|
97
98
|
|
|
98
99
|
filename_no_path = os.path.split(filename)[1]
|
|
99
100
|
|
|
100
|
-
debug(f'export_helper: {filename=} {modify_files_and_save_to_path=} {
|
|
101
|
+
debug(f'export_helper: {filename=} {modify_files_and_save_to_path=} {unmodified_files_copy_to_path=}')
|
|
101
102
|
|
|
102
103
|
with open(filename) as f:
|
|
103
104
|
|
|
@@ -153,13 +154,13 @@ def find_sv_included_files_within_file(filename:str,
|
|
|
153
154
|
else:
|
|
154
155
|
outf.write(line)
|
|
155
156
|
|
|
156
|
-
#
|
|
157
|
-
if len(modified_lines) == 0 and
|
|
158
|
-
if os.path.isdir(
|
|
159
|
-
dst = os.path.join(
|
|
157
|
+
# Copy unmodified files to some path.
|
|
158
|
+
if len(modified_lines) == 0 and unmodified_files_copy_to_path:
|
|
159
|
+
if os.path.isdir(unmodified_files_copy_to_path):
|
|
160
|
+
dst = os.path.join(unmodified_files_copy_to_path, filename_no_path)
|
|
160
161
|
if not os.path.exists(dst):
|
|
161
|
-
debug(f'export_helper:
|
|
162
|
-
|
|
162
|
+
debug(f'export_helper: Copied unmodified {filename=} to {dst=}')
|
|
163
|
+
shutil.copy(src=filename, dst=dst)
|
|
163
164
|
|
|
164
165
|
|
|
165
166
|
# Back to the list found_included_files that we observed within our filename, we
|
|
@@ -193,7 +194,7 @@ def find_sv_included_files_within_file(filename:str,
|
|
|
193
194
|
def get_list_sv_included_files(all_src_files:list, known_incdir_paths:list, target:str='',
|
|
194
195
|
warnings:bool=True,
|
|
195
196
|
modify_files_and_save_to_path=None,
|
|
196
|
-
|
|
197
|
+
unmodified_files_copy_to_path=None) -> list:
|
|
197
198
|
''' Given a list of all_src_files, and list of known_incdir_paths, returns a list
|
|
198
199
|
of all included files (fullpath). This is recurisve if an included file includes another file.
|
|
199
200
|
|
|
@@ -205,7 +206,7 @@ def get_list_sv_included_files(all_src_files:list, known_incdir_paths:list, targ
|
|
|
205
206
|
`include "foo.svh" -- no modifications
|
|
206
207
|
`include "../bar.svh" -- is modified to become `include "bar.svh"
|
|
207
208
|
Set to None (default) to disable.
|
|
208
|
-
|
|
209
|
+
unmodified_files_copy_to_path -- (str: directory/path) if you wish to copy unmodified
|
|
209
210
|
files to this path. Set to None (default) to disable.
|
|
210
211
|
'''
|
|
211
212
|
|
|
@@ -220,7 +221,7 @@ def get_list_sv_included_files(all_src_files:list, known_incdir_paths:list, targ
|
|
|
220
221
|
known_incdir_paths=known_incdir_paths,
|
|
221
222
|
warnings=warnings,
|
|
222
223
|
modify_files_and_save_to_path=modify_files_and_save_to_path,
|
|
223
|
-
|
|
224
|
+
unmodified_files_copy_to_path=unmodified_files_copy_to_path
|
|
224
225
|
)
|
|
225
226
|
|
|
226
227
|
for f in included_files_list:
|
|
@@ -239,7 +240,7 @@ def get_list_sv_included_files(all_src_files:list, known_incdir_paths:list, targ
|
|
|
239
240
|
known_incdir_paths=known_incdir_paths,
|
|
240
241
|
warnings=warnings,
|
|
241
242
|
modify_files_and_save_to_path=modify_files_and_save_to_path,
|
|
242
|
-
|
|
243
|
+
unmodified_files_copy_to_path=unmodified_files_copy_to_path
|
|
243
244
|
)
|
|
244
245
|
sv_included_files_dict[fname] = True # mark as traversed.
|
|
245
246
|
|
|
@@ -317,7 +318,7 @@ class ExportHelper:
|
|
|
317
318
|
known_incdir_paths=self.cmd_design_obj.incdirs,
|
|
318
319
|
target=self.target,
|
|
319
320
|
modify_files_and_save_to_path=self.out_dir,
|
|
320
|
-
|
|
321
|
+
unmodified_files_copy_to_path=self.out_dir
|
|
321
322
|
)
|
|
322
323
|
|
|
323
324
|
info(f"export_helper: {self.target=} included files {self.included_files=}")
|
|
@@ -325,7 +326,7 @@ class ExportHelper:
|
|
|
325
326
|
for filename in self.cmd_design_obj.files_non_source:
|
|
326
327
|
dst = os.path.join(self.out_dir, os.path.split(filename)[1])
|
|
327
328
|
if not os.path.exists(dst):
|
|
328
|
-
|
|
329
|
+
shutil.copy(src=filename, dst=dst)
|
|
329
330
|
|
|
330
331
|
def create_deps_yml_in_out_dir(self, deps_file_args:list=list()):
|
|
331
332
|
if not self.target:
|
|
@@ -449,11 +450,11 @@ class ExportHelper:
|
|
|
449
450
|
info(f'export_helper: Wrote {dst=}')
|
|
450
451
|
|
|
451
452
|
# If this was from an `export` command, and the self.out_dir != self.args['work-dir'], then
|
|
452
|
-
#
|
|
453
|
+
# copy the export.json to the work-dir:
|
|
453
454
|
if self.out_dir != self.args['work-dir']:
|
|
454
455
|
util.safe_mkdirs(base=self.args['work-dir'], new_dirs=['export'])
|
|
455
456
|
src = os.path.abspath(os.path.join(self.out_dir, 'export.json'))
|
|
456
457
|
dst = os.path.join(self.args['work-dir'], 'export', 'export.json')
|
|
457
458
|
if not os.path.exists(dst):
|
|
458
|
-
|
|
459
|
-
info(f'export_helper:
|
|
459
|
+
shutil.copy(src=filename, dst=dst)
|
|
460
|
+
info(f'export_helper: Copied {src=} to {dst=}')
|
|
@@ -78,6 +78,7 @@ class VerilatorSim(CommandSim, ToolVerilator):
|
|
|
78
78
|
'dump-vcd': False,
|
|
79
79
|
'lint-only': False,
|
|
80
80
|
'cc-mode': False,
|
|
81
|
+
'verilator-coverage-args': [],
|
|
81
82
|
})
|
|
82
83
|
|
|
83
84
|
self.args_help.update({
|
|
@@ -303,9 +304,11 @@ class VerilatorSim(CommandSim, ToolVerilator):
|
|
|
303
304
|
verilated_post_exec_coverage_command_list = [self.verilator_coverage_exe]
|
|
304
305
|
config_coverage_args = self.tool_config.get(
|
|
305
306
|
'coverage-args',
|
|
306
|
-
'--annotate logs/annotated
|
|
307
|
+
'--annotate logs/annotated coverage.dat').split()
|
|
308
|
+
|
|
309
|
+
verilated_post_exec_coverage_command_list += \
|
|
310
|
+
config_coverage_args + self.args['verilator-coverage-args']
|
|
307
311
|
|
|
308
|
-
verilated_post_exec_coverage_command_list += config_coverage_args
|
|
309
312
|
|
|
310
313
|
return [ util.ShellCommandList(verilated_post_exec_coverage_command_list,
|
|
311
314
|
tee_fpath='coverage.log') ] # single entry list
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencos-eda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.36
|
|
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,7 +14,7 @@ opencos/eda_config_defaults.yml
|
|
|
14
14
|
opencos/eda_config_max_verilator_waivers.yml
|
|
15
15
|
opencos/eda_config_reduced.yml
|
|
16
16
|
opencos/eda_deps_bash_completion.bash
|
|
17
|
-
opencos/
|
|
17
|
+
opencos/eda_extract_targets.py
|
|
18
18
|
opencos/eda_tool_helper.py
|
|
19
19
|
opencos/export_helper.py
|
|
20
20
|
opencos/export_json_convert.py
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "opencos-eda"
|
|
5
|
-
version = "0.2.
|
|
5
|
+
version = "0.2.36"
|
|
6
6
|
dependencies = [
|
|
7
7
|
# opencos/eda.py dependencies
|
|
8
8
|
"mergedeep >= 1.3.4",
|
|
@@ -38,7 +38,7 @@ opencos = "opencos"
|
|
|
38
38
|
eda = "opencos.eda:main_cli"
|
|
39
39
|
oc_cli = "opencos.oc_cli:main"
|
|
40
40
|
# For bash completion of DEPS target keys.
|
|
41
|
-
|
|
41
|
+
eda_targets = "opencos.eda_extract_targets:main"
|
|
42
42
|
# For linting DEPS.yml
|
|
43
43
|
eda_deps_schema = "opencos.deps_schema:main"
|
|
44
44
|
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
'''
|
|
4
|
-
Helper pymodule used by eda_deps_bash_completion.bash, extracts valid
|
|
5
|
-
targets from DEPS files
|
|
6
|
-
'''
|
|
7
|
-
|
|
8
|
-
import sys
|
|
9
|
-
import os
|
|
10
|
-
import json
|
|
11
|
-
|
|
12
|
-
import yaml
|
|
13
|
-
import toml
|
|
14
|
-
|
|
15
|
-
from opencos.deps_helpers import get_deps_markup_file
|
|
16
|
-
|
|
17
|
-
def get_markup_table_keys(partial_path='./') -> list:
|
|
18
|
-
'''Returns a list of root level keys for DEPS.[yml|yaml|toml|json]
|
|
19
|
-
|
|
20
|
-
Does not include DEFAULTS.
|
|
21
|
-
'''
|
|
22
|
-
partial_target = ''
|
|
23
|
-
if not partial_path or partial_path == '.':
|
|
24
|
-
partial_path = './'
|
|
25
|
-
|
|
26
|
-
if not os.path.exists(partial_path):
|
|
27
|
-
partial_path, partial_target = os.path.split(partial_path)
|
|
28
|
-
if not partial_path:
|
|
29
|
-
partial_path = './'
|
|
30
|
-
|
|
31
|
-
filepath = get_deps_markup_file(base_path=partial_path)
|
|
32
|
-
if not filepath:
|
|
33
|
-
# Couldn't find a DEPS file, let bash completion handle it (with -W words or -G glob)
|
|
34
|
-
return []
|
|
35
|
-
|
|
36
|
-
data = {}
|
|
37
|
-
_, file_ext = os.path.splitext(filepath)
|
|
38
|
-
try:
|
|
39
|
-
if file_ext in ['', '.yml', 'yaml']:
|
|
40
|
-
with open(filepath, 'r', encoding='utf-8') as f:
|
|
41
|
-
data = yaml.safe_load(f)
|
|
42
|
-
elif file_ext == '.toml':
|
|
43
|
-
data = toml.load(filepath)
|
|
44
|
-
elif file_ext == '.json':
|
|
45
|
-
with open(filepath, 'r', encoding='utf-8') as f:
|
|
46
|
-
data = json.load(f)
|
|
47
|
-
except Exception: # pylint: disable=broad-exception-caught
|
|
48
|
-
return []
|
|
49
|
-
|
|
50
|
-
if not isinstance(data, dict):
|
|
51
|
-
# We found a DEPS file, but it wasn't a table/dict so we can't return root keys
|
|
52
|
-
return []
|
|
53
|
-
|
|
54
|
-
# Try to resolve path/to/target/partial_target_
|
|
55
|
-
# -- prepend path information to found targets in path/to/target/DEPS
|
|
56
|
-
prepend = ''
|
|
57
|
-
if partial_path and partial_path != './':
|
|
58
|
-
prepend = partial_path
|
|
59
|
-
if not partial_path.endswith('/'):
|
|
60
|
-
prepend += '/'
|
|
61
|
-
|
|
62
|
-
# Return the list of keys w/ prepended path information, and don't include
|
|
63
|
-
# uppercase strings like 'DEFAULTS' or 'METADATA'
|
|
64
|
-
return [
|
|
65
|
-
prepend + x for x in list(data.keys()) if x.startswith(partial_target) and not x.isupper()
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def main() -> None:
|
|
70
|
-
'''Returns None, prints DEPS keys space separated, uses sys.argv for a single
|
|
71
|
-
partial path arg (DEPS file to examine)'''
|
|
72
|
-
|
|
73
|
-
if len(sys.argv) > 1:
|
|
74
|
-
partial_path = sys.argv[1]
|
|
75
|
-
else:
|
|
76
|
-
partial_path = './'
|
|
77
|
-
keys = get_markup_table_keys(partial_path)
|
|
78
|
-
print(" ".join(keys))
|
|
79
|
-
|
|
80
|
-
if __name__ == "__main__":
|
|
81
|
-
main()
|
|
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
|