opencos-eda 0.2.45__py3-none-any.whl → 0.2.46__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/deps_helpers.py +15 -12
- opencos/deps_schema.py +3 -0
- opencos/eda_base.py +28 -13
- opencos/eda_config_defaults.yml +1 -0
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/METADATA +1 -1
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/RECORD +11 -11
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/WHEEL +0 -0
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/entry_points.txt +0 -0
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/licenses/LICENSE +0 -0
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/licenses/LICENSE.spdx +0 -0
- {opencos_eda-0.2.45.dist-info → opencos_eda-0.2.46.dist-info}/top_level.txt +0 -0
opencos/deps_helpers.py
CHANGED
|
@@ -68,6 +68,7 @@ class Defaults:
|
|
|
68
68
|
'shell',
|
|
69
69
|
'work-dir-add-srcs', 'work-dir-add-sources',
|
|
70
70
|
'peakrdl',
|
|
71
|
+
'run-from-work-dir',
|
|
71
72
|
'var-subst-args',
|
|
72
73
|
'var-subst-os-env',
|
|
73
74
|
'tee',
|
|
@@ -387,20 +388,20 @@ def path_substitutions_relative_to_work_dir(exec_list : list, info_str : str, ta
|
|
|
387
388
|
|
|
388
389
|
# Look for path substitutions, b/c we later "work" in self.args['work-dir'], but
|
|
389
390
|
# files should be relative to our target_path.
|
|
390
|
-
for
|
|
391
|
+
for i,word in enumerate(exec_list):
|
|
391
392
|
m = re.search(r'(\.+\/+[^"\;\:\|\<\>\*]*)$', word)
|
|
392
393
|
if m:
|
|
393
394
|
# ./, ../, file=./../whatever It might be a filepath.
|
|
394
395
|
# [^"\;\:\|\<\>\*] is looking for non-path like characters, so we dont' have a trailing
|
|
395
396
|
# " : ; < > |
|
|
396
|
-
# try and see if this file exists. Note that files in the self.args['work-dir'] don't
|
|
397
|
+
# try and see if this file or dir exists. Note that files in the self.args['work-dir'] don't
|
|
397
398
|
# need this, and we can't assume dir levels in the work-dir.
|
|
398
399
|
try:
|
|
399
400
|
try_path = os.path.abspath(os.path.join(os.path.abspath(target_path), m.group(1)))
|
|
400
|
-
if os.path.isfile(try_path):
|
|
401
|
+
if os.path.isfile(try_path) or os.path.isdir(try_path):
|
|
401
402
|
# make the substitution
|
|
402
|
-
exec_list[
|
|
403
|
-
debug(f'path substitution {info_str=} {target_path=}: replaced - {word=} is now ={exec_list[
|
|
403
|
+
exec_list[i] = word.replace(m.group(1), try_path)
|
|
404
|
+
debug(f'path substitution {info_str=} {target_path=}: replaced - {word=} is now ={exec_list[i]}')
|
|
404
405
|
except:
|
|
405
406
|
pass
|
|
406
407
|
|
|
@@ -1064,6 +1065,7 @@ def parse_deps_shell_str(line : str, target_path : str, target_node : str, enabl
|
|
|
1064
1065
|
|
|
1065
1066
|
d = {'target_path': os.path.abspath(target_path),
|
|
1066
1067
|
'target_node': target_node,
|
|
1068
|
+
'run_from_work_dir': True,
|
|
1067
1069
|
'exec_list': exec_list,
|
|
1068
1070
|
}
|
|
1069
1071
|
return d
|
|
@@ -1137,12 +1139,12 @@ def parse_deps_peakrdl(line : str, target_path : str, target_node : str, enable
|
|
|
1137
1139
|
|
|
1138
1140
|
sv_files = list()
|
|
1139
1141
|
top = ''
|
|
1140
|
-
for
|
|
1142
|
+
for i,str_value in enumerate(args_list):
|
|
1141
1143
|
if '--top=' in str_value:
|
|
1142
1144
|
_, top = str_value.split('=')
|
|
1143
1145
|
elif '--top' in str_value:
|
|
1144
|
-
if
|
|
1145
|
-
top = args_list[
|
|
1146
|
+
if i + 1 < len(args_list):
|
|
1147
|
+
top = args_list[i + 1]
|
|
1146
1148
|
|
|
1147
1149
|
for str_item in args_list:
|
|
1148
1150
|
if str_item[-4:] == '.rdl':
|
|
@@ -1235,14 +1237,14 @@ def deps_commands_handler(config: dict, eda_args: dict,
|
|
|
1235
1237
|
var_subst_dict = eda_args
|
|
1236
1238
|
|
|
1237
1239
|
tee_fpath = command.get('tee', None)
|
|
1240
|
+
run_from_work_dir = command.get('run-from-work-dir', True) # for shell, default True
|
|
1238
1241
|
|
|
1239
1242
|
for key,item in command.items():
|
|
1240
1243
|
|
|
1241
1244
|
# skip the var-subst-* keys, since these types are bools
|
|
1242
|
-
if key.startswith('var-subst')
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if key.startswith('tee'):
|
|
1245
|
+
if key.startswith('var-subst') or \
|
|
1246
|
+
key.startswith('tee') or \
|
|
1247
|
+
key.startswith('run-from-work-dir'):
|
|
1246
1248
|
continue
|
|
1247
1249
|
|
|
1248
1250
|
# Optional variable substituion in commands
|
|
@@ -1262,6 +1264,7 @@ def deps_commands_handler(config: dict, eda_args: dict,
|
|
|
1262
1264
|
# list item in ret_dict['exec_list'], and make it a util.ShellCommandList.
|
|
1263
1265
|
if tee_fpath:
|
|
1264
1266
|
ret_dict['exec_list'] = ShellCommandList(ret_dict['exec_list'], tee_fpath=tee_fpath)
|
|
1267
|
+
ret_dict['run_from_work_dir'] = run_from_work_dir
|
|
1265
1268
|
assert ret_dict, f'shell command failed in {dep=} {target_node=} in {deps_file=}'
|
|
1266
1269
|
shell_commands_list.append(ret_dict) # process this later, append to our to-be-returned tuple
|
|
1267
1270
|
|
opencos/deps_schema.py
CHANGED
|
@@ -69,6 +69,8 @@ my_target_name:
|
|
|
69
69
|
- shell: <---- string for shell command to be run
|
|
70
70
|
var-subst-args: <---- bool, perform var substitution using args
|
|
71
71
|
var-subst-os-env: <---- bool, perform var substitution using os.environ
|
|
72
|
+
run-from-work-dir: <---- bool, default True, if False runs from target dir
|
|
73
|
+
instead of work-dir.
|
|
72
74
|
tee: <---- string, filename to write logs to
|
|
73
75
|
- work-dir-add-sources: <---- work-dir-add-sources, optional list (or string)
|
|
74
76
|
- some_file_gen_from_sh.sv <---- string filename that we created with sh command
|
|
@@ -150,6 +152,7 @@ DEPS_COMMANDS_LIST = [
|
|
|
150
152
|
Optional('shell'): str,
|
|
151
153
|
Optional('var-subst-args'): bool,
|
|
152
154
|
Optional('var-subst-os-env'): bool,
|
|
155
|
+
Optional('run-from-work-dir'): bool,
|
|
153
156
|
Optional('tee'): Or(str, type(None)),
|
|
154
157
|
},
|
|
155
158
|
{
|
opencos/eda_base.py
CHANGED
|
@@ -716,8 +716,9 @@ class CommandDesign(Command):
|
|
|
716
716
|
|
|
717
717
|
log_fnames_count = {} # count per target_node.
|
|
718
718
|
|
|
719
|
-
for
|
|
719
|
+
for i, d in enumerate(self.dep_shell_commands):
|
|
720
720
|
clist = util.ShellCommandList(d['exec_list'])
|
|
721
|
+
run_from_work_dir = d['run_from_work_dir'] # default True
|
|
721
722
|
log = clist.tee_fpath
|
|
722
723
|
target_node = d["target_node"]
|
|
723
724
|
if clist.tee_fpath is None:
|
|
@@ -729,24 +730,38 @@ class CommandDesign(Command):
|
|
|
729
730
|
all_cmds_lists += [
|
|
730
731
|
[], # blank line
|
|
731
732
|
# comment, where it came from, log to {node}__shell_{lognum}.log (or tee name from DEPS.yml)
|
|
732
|
-
[f'# command {
|
|
733
|
-
# actual command (list or util.ShellCommandList)
|
|
734
|
-
clist,
|
|
733
|
+
[f'# command {i}: target: {d["target_path"]} : {target_node} --> {log}'],
|
|
735
734
|
]
|
|
735
|
+
if not run_from_work_dir:
|
|
736
|
+
all_cmds_lists.append([f'cd {d["target_path"]}'])
|
|
737
|
+
|
|
738
|
+
# actual command (list or util.ShellCommandList)
|
|
739
|
+
all_cmds_lists.append(clist)
|
|
740
|
+
|
|
741
|
+
if not run_from_work_dir:
|
|
742
|
+
all_cmds_lists.append([f'cd {os.path.abspath(self.args["work-dir"])}'])
|
|
743
|
+
|
|
736
744
|
d['exec_list'] = clist # update to tee_fpath is set.
|
|
737
745
|
|
|
738
746
|
util.write_shell_command_file(dirpath=self.args['work-dir'], filename='pre_compile_dep_shell_commands.sh',
|
|
739
747
|
command_lists=all_cmds_lists)
|
|
740
748
|
|
|
741
|
-
for
|
|
742
|
-
util.info(f'run_dep_shell_commands {
|
|
749
|
+
for i,d in enumerate(self.dep_shell_commands):
|
|
750
|
+
util.info(f'run_dep_shell_commands {i=}: {d=}')
|
|
743
751
|
clist = util.ShellCommandList(d['exec_list'])
|
|
752
|
+
tee_fpath=clist.tee_fpath
|
|
753
|
+
if d['run_from_work_dir']:
|
|
754
|
+
run_from_dir = self.args['work-dir']
|
|
755
|
+
else:
|
|
756
|
+
# Run from the target's directory (not the `eda` caller $PWD)
|
|
757
|
+
run_from_dir = d["target_path"]
|
|
758
|
+
tee_fpath = os.path.abspath(os.path.join(self.args['work-dir'], tee_fpath))
|
|
744
759
|
# NOTE(drew): shell=True subprocess call, can disable with self.config
|
|
745
760
|
if sys.platform.startswith('win'):
|
|
746
761
|
# for Windows, we run shell=True otherwise most built-in cmd.exe calls won't work.
|
|
747
|
-
self.exec(
|
|
762
|
+
self.exec(run_from_dir, clist, tee_fpath=tee_fpath, shell=True)
|
|
748
763
|
else:
|
|
749
|
-
self.exec(
|
|
764
|
+
self.exec(run_from_dir, clist, tee_fpath=tee_fpath,
|
|
750
765
|
shell=self.config.get('deps_subprocess_shell', False))
|
|
751
766
|
|
|
752
767
|
def update_file_lists_for_work_dir(self):
|
|
@@ -766,10 +781,10 @@ class CommandDesign(Command):
|
|
|
766
781
|
my_file_lists_list = [self.files_v, self.files_sv, self.files_vhd, self.files_cpp,
|
|
767
782
|
self.files_sdc]
|
|
768
783
|
for my_file_list in my_file_lists_list:
|
|
769
|
-
for
|
|
784
|
+
for i,value in enumerate(my_file_list):
|
|
770
785
|
if value and type(value) is str and value.startswith(self._work_dir_add_srcs_path_string):
|
|
771
786
|
new_value = os.path.join(work_dir_abspath, value[_work_dir_add_srcs_path_string_len :])
|
|
772
|
-
my_file_list[
|
|
787
|
+
my_file_list[i] = new_value
|
|
773
788
|
util.debug(f"file lists: replaced {value} with {new_value}")
|
|
774
789
|
|
|
775
790
|
def update_non_source_files_in_work_dir(self):
|
|
@@ -1575,10 +1590,10 @@ class CommandParallel(Command):
|
|
|
1575
1590
|
else:
|
|
1576
1591
|
util.info(f"Parallel: <No jobs found>")
|
|
1577
1592
|
# Make sure all jobs have a set status:
|
|
1578
|
-
for
|
|
1593
|
+
for i,rc in enumerate(self.jobs_status):
|
|
1579
1594
|
if rc is None or type(rc) != int:
|
|
1580
|
-
self.error(f'job {
|
|
1581
|
-
jobs_status[
|
|
1595
|
+
self.error(f'job {i=} {rc=} did not return a proper return code')
|
|
1596
|
+
jobs_status[i] = 1
|
|
1582
1597
|
|
|
1583
1598
|
# if self.status > 0, then keep it non-zero, else set it if we still have running jobs.
|
|
1584
1599
|
if self.status == 0:
|
opencos/eda_config_defaults.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencos-eda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.46
|
|
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
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
opencos/__init__.py,sha256=ZQ7aOCbP0jkIMYGdVrb-mkZX3rnvaK8epBkmp506tXU,85
|
|
2
2
|
opencos/_version.py,sha256=qN7iBoOv-v4tEZz-Pu9sVUJwefshJOsgdaddn8HcHio,510
|
|
3
3
|
opencos/_waves_pkg.sv,sha256=1lbhQOVGc3t_R8czYjP40hssP0I3FlZOpHTkI7yKFbI,1251
|
|
4
|
-
opencos/deps_helpers.py,sha256=
|
|
5
|
-
opencos/deps_schema.py,sha256
|
|
4
|
+
opencos/deps_helpers.py,sha256=Q49Su7cJdkcjC9PufE2EtveHYAuENe2F-Prpmlz7tcI,57245
|
|
5
|
+
opencos/deps_schema.py,sha256=-zXzU_l0mv8abaOgBcxmRiyIelZ9jOUBXI8ahf3ymBU,14860
|
|
6
6
|
opencos/eda.py,sha256=Ky_Uc47TU1N6lRs06eatdpAvtgoSh0iXO0BxhSfEuk0,19420
|
|
7
|
-
opencos/eda_base.py,sha256=
|
|
7
|
+
opencos/eda_base.py,sha256=utUTieQMv0RC2Mz5n8b7rtneKjSFI3YcgCiJON0T7Ws,84410
|
|
8
8
|
opencos/eda_config.py,sha256=8wwX4PTZ5rmxWogrVxxqAY6adQFPxTsFkkTYbo6H4vU,8853
|
|
9
|
-
opencos/eda_config_defaults.yml,sha256=
|
|
9
|
+
opencos/eda_config_defaults.yml,sha256=AteZbwRJ6wviinks47-e5TX0DoU0culJfBw6L3xYOOA,11535
|
|
10
10
|
opencos/eda_config_max_verilator_waivers.yml,sha256=lTAU4IOEbUWVlPzuer1YYhIyxpPINeA4EJqcRIT-Ymk,840
|
|
11
11
|
opencos/eda_config_reduced.yml,sha256=cQ9jY4J7EvAbeHTiP6bvpDSVJAYiitjLZPSxxLKIEbk,1440
|
|
12
12
|
opencos/eda_deps_bash_completion.bash,sha256=jMkQKY82HBgOnQeMdA1hMrXguRFtB52SMBxUemKovL4,1958
|
|
@@ -70,10 +70,10 @@ opencos/tools/tabbycad_yosys.py,sha256=2LePPgYXBVdsy7YcffPIWN-I0B7queLQ_f_pme2SC
|
|
|
70
70
|
opencos/tools/verilator.py,sha256=dWnoO8FUvjdMyFmuTjHvC_XYI_zwjApJApYy7iYubf0,18398
|
|
71
71
|
opencos/tools/vivado.py,sha256=_GVqKNIZt9CZeiXS5yZCWTFrhD3BKjcQfzhhxR1qLQM,40017
|
|
72
72
|
opencos/tools/yosys.py,sha256=FV43RcejyFir4B24WRShnzUoppJMK0sDDNkSlIX8Vew,25579
|
|
73
|
-
opencos_eda-0.2.
|
|
74
|
-
opencos_eda-0.2.
|
|
75
|
-
opencos_eda-0.2.
|
|
76
|
-
opencos_eda-0.2.
|
|
77
|
-
opencos_eda-0.2.
|
|
78
|
-
opencos_eda-0.2.
|
|
79
|
-
opencos_eda-0.2.
|
|
73
|
+
opencos_eda-0.2.46.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
74
|
+
opencos_eda-0.2.46.dist-info/licenses/LICENSE.spdx,sha256=8gn1610RMP6eFgT3Hm6q9VKXt0RvdTItL_oxMo72jII,189
|
|
75
|
+
opencos_eda-0.2.46.dist-info/METADATA,sha256=po0uwX8zxK4LmDW80yfBySMF1T2VwUifZPRgcsHB9f4,604
|
|
76
|
+
opencos_eda-0.2.46.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
77
|
+
opencos_eda-0.2.46.dist-info/entry_points.txt,sha256=V8OE1lySAFcFQpDNJuVxVZteeSmDH-joLMhGvrxrvmg,164
|
|
78
|
+
opencos_eda-0.2.46.dist-info/top_level.txt,sha256=J4JDP-LpRyJqPNeh9bSjx6yrLz2Mk0h6un6YLmtqql4,8
|
|
79
|
+
opencos_eda-0.2.46.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|