opencos-eda 0.2.47__py3-none-any.whl → 0.2.49__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/__init__.py +4 -2
- opencos/_version.py +10 -7
- opencos/commands/flist.py +8 -7
- opencos/commands/multi.py +35 -18
- opencos/commands/sweep.py +9 -4
- opencos/commands/waves.py +1 -1
- opencos/deps/__init__.py +0 -0
- opencos/deps/defaults.py +69 -0
- opencos/deps/deps_commands.py +419 -0
- opencos/deps/deps_file.py +326 -0
- opencos/deps/deps_processor.py +670 -0
- opencos/deps_schema.py +7 -8
- opencos/eda.py +92 -67
- opencos/eda_base.py +625 -332
- opencos/eda_config.py +80 -14
- opencos/eda_extract_targets.py +22 -14
- opencos/eda_tool_helper.py +33 -7
- opencos/export_helper.py +166 -86
- opencos/export_json_convert.py +31 -23
- opencos/files.py +2 -1
- opencos/hw/__init__.py +0 -0
- opencos/{oc_cli.py → hw/oc_cli.py} +9 -4
- opencos/names.py +0 -4
- opencos/peakrdl_cleanup.py +13 -7
- opencos/seed.py +19 -11
- opencos/tests/helpers.py +27 -14
- opencos/tests/test_deps_helpers.py +35 -32
- opencos/tests/test_eda.py +47 -41
- opencos/tests/test_eda_elab.py +5 -3
- opencos/tests/test_eda_synth.py +1 -1
- opencos/tests/test_oc_cli.py +1 -1
- opencos/tests/test_tools.py +3 -2
- opencos/tools/iverilog.py +2 -2
- opencos/tools/modelsim_ase.py +2 -2
- opencos/tools/riviera.py +1 -1
- opencos/tools/slang.py +1 -1
- opencos/tools/surelog.py +1 -1
- opencos/tools/verilator.py +1 -1
- opencos/tools/vivado.py +1 -1
- opencos/tools/yosys.py +4 -3
- opencos/util.py +440 -483
- opencos/utils/__init__.py +0 -0
- opencos/utils/markup_helpers.py +98 -0
- opencos/utils/str_helpers.py +111 -0
- opencos/utils/subprocess_helpers.py +108 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/METADATA +1 -1
- opencos_eda-0.2.49.dist-info/RECORD +88 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/entry_points.txt +1 -1
- opencos/deps_helpers.py +0 -1346
- opencos_eda-0.2.47.dist-info/RECORD +0 -79
- /opencos/{pcie.py → hw/pcie.py} +0 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/WHEEL +0 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/licenses/LICENSE +0 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/licenses/LICENSE.spdx +0 -0
- {opencos_eda-0.2.47.dist-info → opencos_eda-0.2.49.dist-info}/top_level.txt +0 -0
opencos/tests/test_eda.py
CHANGED
|
@@ -7,6 +7,12 @@ If you want to run this, consider running from the root of opencos repo:
|
|
|
7
7
|
> python3 -m pytest --verbose opencos/*/*.py
|
|
8
8
|
> python3 -m pytest -rx opencos/*/*.py
|
|
9
9
|
which avoids using any pip installed opencos.eda
|
|
10
|
+
|
|
11
|
+
Throughout this file, if you see:
|
|
12
|
+
assert rc > 1
|
|
13
|
+
It is not a typo. We would prefer all expected errors to be caught and reported by
|
|
14
|
+
eda.py. Python errors tend to return with rc=1, and those are problematic for us
|
|
15
|
+
and should be more gracefully handled.
|
|
10
16
|
'''
|
|
11
17
|
|
|
12
18
|
# pylint: disable=R0801 # (similar lines in 2+ files)
|
|
@@ -18,7 +24,8 @@ from contextlib import redirect_stdout, redirect_stderr
|
|
|
18
24
|
|
|
19
25
|
import pytest
|
|
20
26
|
|
|
21
|
-
from opencos import eda,
|
|
27
|
+
from opencos import eda, eda_tool_helper
|
|
28
|
+
from opencos.utils.markup_helpers import yaml_safe_load
|
|
22
29
|
from opencos.tests import helpers
|
|
23
30
|
from opencos.tests.helpers import eda_wrap, eda_sim_wrap, eda_elab_wrap, \
|
|
24
31
|
Helpers
|
|
@@ -89,7 +96,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
89
96
|
chdir_remove_work_dir('../../lib')
|
|
90
97
|
rc = eda_wrap('synth', '--tool', 'verilator', 'oclib_fifo')
|
|
91
98
|
print(f'{rc=}')
|
|
92
|
-
assert rc
|
|
99
|
+
assert rc > 1
|
|
93
100
|
|
|
94
101
|
|
|
95
102
|
def test_args_sim(self):
|
|
@@ -228,7 +235,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
228
235
|
# want to use the xfail pytest decorator.
|
|
229
236
|
rc = eda_sim_wrap('--xilinx', '--tool', 'verilator', 'oclib_fifo_test')
|
|
230
237
|
print(f'{rc=}')
|
|
231
|
-
assert rc
|
|
238
|
+
assert rc > 1
|
|
232
239
|
|
|
233
240
|
def test_more_plusargs_sim(self):
|
|
234
241
|
'''Test that unprocessed plusargs become sim-plusargs on CLI'''
|
|
@@ -266,7 +273,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
266
273
|
rc = eda.main('multi', 'sim', '--fail-if-no-targets', '--seed=1', '--xilinx', '--tool',
|
|
267
274
|
'verilator', 'oclib_fifo_test')
|
|
268
275
|
print(f'{rc=}')
|
|
269
|
-
assert rc
|
|
276
|
+
assert rc > 1
|
|
270
277
|
|
|
271
278
|
def test_args_multi_sim_no_targets_should_fail(self):
|
|
272
279
|
'''Checks that: eda multi --fail-if-no-targets; will fail if no targets expanded'''
|
|
@@ -275,7 +282,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
275
282
|
rc = eda.main('multi', 'sim', '--fail-if-no-targets', '--seed=1', '--tool', 'verilator',
|
|
276
283
|
'no_targets*')
|
|
277
284
|
print(f'{rc=}')
|
|
278
|
-
assert rc
|
|
285
|
+
assert rc > 1
|
|
279
286
|
|
|
280
287
|
def test_elab_verilator_no_deps_files_involved(self):
|
|
281
288
|
'''Test that inferring the --top from last file in provides files works.'''
|
|
@@ -295,7 +302,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
295
302
|
eda_config_yml_path = os.path.join(
|
|
296
303
|
os.getcwd(), 'eda.work', 'oclib_fifo.elab', 'eda_output_config.yml'
|
|
297
304
|
)
|
|
298
|
-
data =
|
|
305
|
+
data = yaml_safe_load(eda_config_yml_path)
|
|
299
306
|
assert 'args' in data
|
|
300
307
|
assert data['args'].get('top', '') == 'oclib_fifo'
|
|
301
308
|
assert 'config' in data
|
|
@@ -315,7 +322,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
315
322
|
eda_config_yml_path = os.path.join(
|
|
316
323
|
os.getcwd(), 'eda.work', 'oclib_fifo.elab', 'eda_output_config.yml'
|
|
317
324
|
)
|
|
318
|
-
data =
|
|
325
|
+
data = yaml_safe_load(eda_config_yml_path)
|
|
319
326
|
assert 'args' in data
|
|
320
327
|
assert data['args'].get('top', '') == 'oclib_fifo'
|
|
321
328
|
assert 'config' in data
|
|
@@ -333,7 +340,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
333
340
|
cmd_list +=' oclib_assert_pkg.sv oclib_pkg.sv oclib_fifo.sv'.split()
|
|
334
341
|
rc = eda.main(*cmd_list)
|
|
335
342
|
print(f'{rc=}')
|
|
336
|
-
assert rc
|
|
343
|
+
assert rc > 1
|
|
337
344
|
|
|
338
345
|
def test_config_reduced_yml(self):
|
|
339
346
|
'''Test using provided EDA --config-yml=eda_config_reduced.yml, confirm installed w/ pip'''
|
|
@@ -360,7 +367,7 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
360
367
|
assert rc == 0
|
|
361
368
|
eda_config_yml_path = os.path.join(os.getcwd(), 'eda.work', 'oclib_fifo_test.sim',
|
|
362
369
|
'eda_output_config.yml')
|
|
363
|
-
data =
|
|
370
|
+
data = yaml_safe_load(eda_config_yml_path)
|
|
364
371
|
# make sure this config was actually used. We no longer re-add it to args
|
|
365
372
|
# (it won't show up in 'original_args') it will will show up in the config though:
|
|
366
373
|
used_yml_fname = data['config']['config-yml']
|
|
@@ -422,16 +429,15 @@ class TestsRequiresVerilator( # pylint: disable=too-many-public-methods
|
|
|
422
429
|
class TestMissingDepsFileErrorMessages(Helpers):
|
|
423
430
|
'''Test for missing DEPS.yml file, using 'eda export' to avoid tools.'''
|
|
424
431
|
DEFAULT_DIR = os.path.join(THISPATH, 'deps_files', 'no_deps_here', 'empty')
|
|
425
|
-
DEFAULT_LOG = 'eda.log'
|
|
426
432
|
|
|
427
433
|
def test_bad0(self):
|
|
428
434
|
'''Looks for target_bad0, but there is no DEPS file in .'''
|
|
429
435
|
self.chdir()
|
|
430
436
|
rc = self.log_it(command_str='export target_bad0')
|
|
431
|
-
assert rc
|
|
437
|
+
assert rc > 1
|
|
432
438
|
assert self.is_in_log(
|
|
433
|
-
'Trying to resolve command-line target=./target_bad0:
|
|
434
|
-
'
|
|
439
|
+
'Trying to resolve command-line target=./target_bad0:'
|
|
440
|
+
' but path ./ has no DEPS markup file',
|
|
435
441
|
windows_path_support=True
|
|
436
442
|
)
|
|
437
443
|
|
|
@@ -444,7 +450,6 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
444
450
|
linenumber information is printed when available.'''
|
|
445
451
|
|
|
446
452
|
DEFAULT_DIR = os.path.join(THISPATH, 'deps_files', 'error_msgs')
|
|
447
|
-
DEFAULT_LOG = 'eda.log'
|
|
448
453
|
|
|
449
454
|
# files foo.sv, foo2.sv, target_bad0.sv, and target_bad1.sv exist.
|
|
450
455
|
# files missing*.sv and targets missing* do not exist.
|
|
@@ -480,7 +485,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
480
485
|
'''Tests missing file in DEPS target using implicit deps str style'''
|
|
481
486
|
self.chdir()
|
|
482
487
|
rc = self.log_it(command_str='export target_bad0')
|
|
483
|
-
assert rc
|
|
488
|
+
assert rc > 1
|
|
484
489
|
assert self.is_in_log(
|
|
485
490
|
"target=./missing0.sv (file?): called from ./DEPS.yml::target_bad0::line=20,",
|
|
486
491
|
"File=missing0.sv not found in directory=.",
|
|
@@ -491,7 +496,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
491
496
|
'''Tests missing file in DEPS target using implicit deps list style'''
|
|
492
497
|
self.chdir()
|
|
493
498
|
rc = self.log_it(command_str='export target_bad1')
|
|
494
|
-
assert rc
|
|
499
|
+
assert rc > 1
|
|
495
500
|
assert self.is_in_log(
|
|
496
501
|
"target=./missing1.sv (file?): called from ./DEPS.yml::target_bad1::line=24,",
|
|
497
502
|
"File=missing1.sv not found in directory=.",
|
|
@@ -502,7 +507,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
502
507
|
'''Tests missing file in DEPS target using deps as str style'''
|
|
503
508
|
self.chdir()
|
|
504
509
|
rc = self.log_it(command_str='export target_bad2')
|
|
505
|
-
assert rc
|
|
510
|
+
assert rc > 1
|
|
506
511
|
assert self.is_in_log(
|
|
507
512
|
"target=./missing2.sv (file?): called from ./DEPS.yml::target_bad2::line=28,",
|
|
508
513
|
"File=missing2.sv not found in directory=.",
|
|
@@ -513,7 +518,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
513
518
|
'''Tests missing file in DEPS target using deps as list style'''
|
|
514
519
|
self.chdir()
|
|
515
520
|
rc = self.log_it(command_str='export target_bad3')
|
|
516
|
-
assert rc
|
|
521
|
+
assert rc > 1
|
|
517
522
|
assert self.is_in_log(
|
|
518
523
|
"target=./missing3.sv (file?): called from ./DEPS.yml::target_bad3::line=33,",
|
|
519
524
|
"File=missing3.sv not found in directory=.",
|
|
@@ -524,7 +529,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
524
529
|
'''EDA on a bad target (bad target within deps of 'target_bad4'), explicit deps str'''
|
|
525
530
|
self.chdir()
|
|
526
531
|
rc = self.log_it(command_str='export target_bad4')
|
|
527
|
-
assert rc
|
|
532
|
+
assert rc > 1
|
|
528
533
|
assert self.is_in_log(
|
|
529
534
|
"target=./missing_target4: called from ./DEPS.yml::target_bad4::line=39,",
|
|
530
535
|
"Target not found in deps_file=./DEPS.yml",
|
|
@@ -535,7 +540,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
535
540
|
'''EDA on a bad target (bad target within deps of 'target_bad4'), explicit deps list'''
|
|
536
541
|
self.chdir()
|
|
537
542
|
rc = self.log_it(command_str='export target_bad5')
|
|
538
|
-
assert rc
|
|
543
|
+
assert rc > 1
|
|
539
544
|
assert self.is_in_log(
|
|
540
545
|
"target=./missing_target5: called from ./DEPS.yml::target_bad5::line=43,",
|
|
541
546
|
"Target not found in deps_file=./DEPS.yml",
|
|
@@ -546,7 +551,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
546
551
|
'''EDA on a bad target (bad target within deps of 'target_bad4'), deps str'''
|
|
547
552
|
self.chdir()
|
|
548
553
|
rc = self.log_it(command_str='export target_bad6')
|
|
549
|
-
assert rc
|
|
554
|
+
assert rc > 1
|
|
550
555
|
assert self.is_in_log(
|
|
551
556
|
"target=./missing_target6: called from ./DEPS.yml::target_bad6::line=47,",
|
|
552
557
|
"Target not found in deps_file=./DEPS.yml",
|
|
@@ -558,7 +563,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
558
563
|
'''EDA on a bad target (bad target within deps of 'target_bad4'), deps list'''
|
|
559
564
|
self.chdir()
|
|
560
565
|
rc = self.log_it(command_str='export target_bad7')
|
|
561
|
-
assert rc
|
|
566
|
+
assert rc > 1
|
|
562
567
|
assert self.is_in_log(
|
|
563
568
|
"target=./missing_target7: called from ./DEPS.yml::target_bad7::line=52,",
|
|
564
569
|
"Target not found in deps_file=./DEPS.yml",
|
|
@@ -581,7 +586,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
581
586
|
'''EDA calling a non-existent target in DEPS file'''
|
|
582
587
|
self.chdir()
|
|
583
588
|
rc = self.log_it(command_str='export nope_target0')
|
|
584
|
-
assert rc
|
|
589
|
+
assert rc > 1
|
|
585
590
|
assert self.is_in_log(
|
|
586
591
|
"Trying to resolve command-line target=./nope_target0: was not",
|
|
587
592
|
"found in deps_file=./DEPS.yml, possible targets in deps file = ['foo'",
|
|
@@ -592,7 +597,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
592
597
|
'''EDA calling a non-existent target in DEPS file, with file that exists.'''
|
|
593
598
|
self.chdir()
|
|
594
599
|
rc = self.log_it(command_str='export foo.sv nope_target1')
|
|
595
|
-
assert rc
|
|
600
|
+
assert rc > 1
|
|
596
601
|
assert self.is_in_log(
|
|
597
602
|
"Trying to resolve command-line target=./nope_target1: was not",
|
|
598
603
|
"found in deps_file=./DEPS.yml, possible targets in deps file = ['foo'",
|
|
@@ -603,7 +608,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
603
608
|
'''EDA calling a non-existent file w/out DEPS'''
|
|
604
609
|
self.chdir()
|
|
605
610
|
rc = self.log_it(command_str='export nope_file0.sv')
|
|
606
|
-
assert rc
|
|
611
|
+
assert rc > 1
|
|
607
612
|
assert self.is_in_log(
|
|
608
613
|
"Trying to resolve command-line target=./nope_file0.sv",
|
|
609
614
|
"(file?): File=nope_file0.sv not found in directory=.",
|
|
@@ -614,7 +619,7 @@ class TestDepsResolveErrorMessages(Helpers):
|
|
|
614
619
|
'''EDA calling a non-existent file w/out DEPS, and a file that does exist.'''
|
|
615
620
|
self.chdir()
|
|
616
621
|
rc = self.log_it(command_str='export foo2.sv nope_file1.sv')
|
|
617
|
-
assert rc
|
|
622
|
+
assert rc > 1
|
|
618
623
|
assert self.is_in_log(
|
|
619
624
|
"Trying to resolve command-line target=./nope_file1.sv",
|
|
620
625
|
"(file?): File=nope_file1.sv not found in directory=.",
|
|
@@ -682,14 +687,14 @@ class TestDepsReqs:
|
|
|
682
687
|
chdir_remove_work_dir('deps_files/non_sv_reqs')
|
|
683
688
|
cmd_list = 'sim should_fail_foo_test5'.split()
|
|
684
689
|
rc = eda.main(*cmd_list)
|
|
685
|
-
assert rc
|
|
690
|
+
assert rc > 1
|
|
686
691
|
|
|
687
692
|
def test_deps_reqs6(self):
|
|
688
693
|
'''Test that should fail due bad file in deps section (none in reqs)'''
|
|
689
694
|
chdir_remove_work_dir('deps_files/non_sv_reqs')
|
|
690
695
|
cmd_list = 'sim should_fail_foo_test6'.split()
|
|
691
696
|
rc = eda.main(*cmd_list)
|
|
692
|
-
assert rc
|
|
697
|
+
assert rc > 1
|
|
693
698
|
|
|
694
699
|
|
|
695
700
|
@pytest.mark.parametrize("command", ['sim', 'shell'])
|
|
@@ -741,13 +746,15 @@ def test_deps_command_order(command):
|
|
|
741
746
|
work_dir = os.path.join(
|
|
742
747
|
THISPATH, 'deps_files', 'command_order', 'eda.work', f'target_test.{command}'
|
|
743
748
|
)
|
|
749
|
+
# Note that eda will write out the returncode INFO line to tee'd log files, so
|
|
750
|
+
# there is more in the log file than "hi" or "bye".
|
|
744
751
|
with open(os.path.join(work_dir, 'target_echo_hi__shell_0.log'), encoding='utf-8') as f:
|
|
745
|
-
text = ''.join(f.readlines()).strip()
|
|
746
|
-
assert text in ['hi', '"hi"', '\\"hi\\"']
|
|
752
|
+
text = ' '.join(f.readlines()).strip()
|
|
753
|
+
assert any(text.startswith(x) for x in ['hi', '"hi"', '\\"hi\\"'])
|
|
747
754
|
# Added check, one of the targets uses a custom 'tee' file name, instead of the default log.
|
|
748
755
|
with open(os.path.join(work_dir, 'custom_tee_echo_bye.log'), encoding='utf-8') as f:
|
|
749
756
|
text = ''.join(f.readlines()).strip()
|
|
750
|
-
assert text in ['bye', '"bye"', '\\"bye\\"']
|
|
757
|
+
assert any(text.startswith(x) for x in ['bye', '"bye"', '\\"bye\\"'])
|
|
751
758
|
|
|
752
759
|
|
|
753
760
|
@pytest.mark.skipif('verilator' not in tools_loaded, reason="requires verilator")
|
|
@@ -815,32 +822,31 @@ class TestDepsNoFilesTargets(Helpers):
|
|
|
815
822
|
# Using this b/c DEPS.toml has single target.
|
|
816
823
|
chdir_remove_work_dir('./deps_files/test_deps_toml')
|
|
817
824
|
rc = eda_wrap('sim', '--tool', 'verilator', 'target_whoops')
|
|
818
|
-
assert rc
|
|
825
|
+
assert rc > 1
|
|
819
826
|
|
|
820
827
|
def test_eda_sim__no_files_or_targets_shouldfail(self):
|
|
821
828
|
'''This test should fail, there is DEPS.yml (empty, no implicit target), or missing file'''
|
|
822
829
|
chdir_remove_work_dir('./deps_files/no_deps_here')
|
|
823
830
|
rc = eda_wrap('sim', '--tool', 'verilator')
|
|
824
|
-
assert rc
|
|
831
|
+
assert rc > 1
|
|
825
832
|
|
|
826
833
|
def test_eda_sim__no_files_or_targets_with_top_shouldfail(self):
|
|
827
834
|
'''This test should fail, there is DEPS.yml (empty, no implicit target), or missing file'''
|
|
828
835
|
chdir_remove_work_dir('./deps_files/no_deps_here')
|
|
829
836
|
rc = eda_wrap('sim', '--tool', 'verilator', '--top', 'empty_file')
|
|
830
|
-
assert rc
|
|
837
|
+
assert rc > 1
|
|
831
838
|
|
|
832
839
|
|
|
833
840
|
class TestDepsTags(Helpers):
|
|
834
841
|
'''Series of tests for DEPS - target - tags, in ./deps_files/tags_with_tools'''
|
|
835
842
|
DEFAULT_DIR = os.path.join(THISPATH, 'deps_files', 'tags_with_tools')
|
|
836
|
-
DEFAULT_LOG = 'eda.log'
|
|
837
843
|
|
|
838
844
|
@pytest.mark.skipif('verilator' not in tools_loaded, reason="requires verilator")
|
|
839
845
|
def test_tags_with_tools_verilator(self):
|
|
840
846
|
'''test for DEPS target that hits with-tools: verilator, so that
|
|
841
847
|
additional args are applied from the DEPS tag.'''
|
|
842
848
|
self.chdir()
|
|
843
|
-
logfile = 'verilator_eda.log'
|
|
849
|
+
logfile = '.pytest.verilator_eda.log'
|
|
844
850
|
rc = self.log_it('sim --tool verilator target_test', logfile=logfile)
|
|
845
851
|
assert rc == 0
|
|
846
852
|
|
|
@@ -859,7 +865,7 @@ class TestDepsTags(Helpers):
|
|
|
859
865
|
AKA, lets you replace all the Verilator waivers to the DEPS target that only affect
|
|
860
866
|
with-tools: verilator'''
|
|
861
867
|
self.chdir()
|
|
862
|
-
logfile = 'target_with_replace_config_tools_test.log'
|
|
868
|
+
logfile = '.pytest.target_with_replace_config_tools_test.log'
|
|
863
869
|
rc = self.log_it('sim --tool verilator target_with_replace_config_tools_test',
|
|
864
870
|
logfile=logfile)
|
|
865
871
|
assert rc == 0
|
|
@@ -877,7 +883,7 @@ class TestDepsTags(Helpers):
|
|
|
877
883
|
AKA, lets you add Verilator waivers to the DEPS target that only affect
|
|
878
884
|
with-tools: verilator'''
|
|
879
885
|
self.chdir()
|
|
880
|
-
logfile = 'target_with_additive_config_tools_test.log'
|
|
886
|
+
logfile = '.pytest.target_with_additive_config_tools_test.log'
|
|
881
887
|
rc = self.log_it('sim --tool verilator --debug target_with_additive_config_tools_test',
|
|
882
888
|
logfile=logfile)
|
|
883
889
|
assert rc == 0
|
|
@@ -897,7 +903,7 @@ class TestDepsTags(Helpers):
|
|
|
897
903
|
apply the arg --lint-only in the DEPS tag, and instead run the
|
|
898
904
|
full simulation.'''
|
|
899
905
|
self.chdir()
|
|
900
|
-
logfile = 'vivado_eda.log'
|
|
906
|
+
logfile = '.pytest.vivado_eda.log'
|
|
901
907
|
rc = self.log_it('sim --tool vivado target_test', logfile=logfile)
|
|
902
908
|
assert rc == 0
|
|
903
909
|
|
|
@@ -916,7 +922,7 @@ class TestDepsTags(Helpers):
|
|
|
916
922
|
def test_tags_with_tools_add_incdirs(self):
|
|
917
923
|
'''test for DEPS target with tag that adds incdirs'''
|
|
918
924
|
self.chdir()
|
|
919
|
-
logfile = 'target_foo_sv_add_incdirs.log'
|
|
925
|
+
logfile = '.pytest.target_foo_sv_add_incdirs.log'
|
|
920
926
|
rc = self.log_it('elab --tool verilator target_foo_sv_add_incdirs',
|
|
921
927
|
logfile=logfile)
|
|
922
928
|
assert rc == 0
|
|
@@ -931,7 +937,7 @@ class TestDepsTags(Helpers):
|
|
|
931
937
|
def test_tags_with_tools_add_defines(self):
|
|
932
938
|
'''test for DEPS target with tag that adds defines'''
|
|
933
939
|
self.chdir()
|
|
934
|
-
logfile = 'target_foo_sv_add_defines.log'
|
|
940
|
+
logfile = '.pytest.target_foo_sv_add_defines.log'
|
|
935
941
|
rc = self.log_it('elab --tool verilator --debug target_foo_sv_add_defines',
|
|
936
942
|
logfile=logfile)
|
|
937
943
|
assert rc == 0
|
opencos/tests/test_eda_elab.py
CHANGED
|
@@ -80,7 +80,9 @@ def test_elab_tool_cant_run_sim(tool):
|
|
|
80
80
|
rc = 0
|
|
81
81
|
try:
|
|
82
82
|
rc = eda_wrap('sim', '--tool', tool, 'oclib_fifo')
|
|
83
|
+
print(f'{rc=}')
|
|
84
|
+
assert rc > 1
|
|
83
85
|
except NotImplementedError:
|
|
84
|
-
rc =
|
|
85
|
-
|
|
86
|
-
assert rc
|
|
86
|
+
rc = 3
|
|
87
|
+
print(f'{rc=} (forced to 3 for NotImplementedError)')
|
|
88
|
+
assert rc > 1
|
opencos/tests/test_eda_synth.py
CHANGED
opencos/tests/test_oc_cli.py
CHANGED
opencos/tests/test_tools.py
CHANGED
|
@@ -6,12 +6,13 @@ import os
|
|
|
6
6
|
import sys
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
-
from opencos import eda,
|
|
9
|
+
from opencos import eda, eda_tool_helper, eda_base
|
|
10
10
|
|
|
11
11
|
from opencos.tools.verilator import ToolVerilator
|
|
12
12
|
from opencos.tools.vivado import ToolVivado
|
|
13
13
|
from opencos.tests import helpers
|
|
14
14
|
from opencos.tests.helpers import eda_wrap
|
|
15
|
+
from opencos.utils.markup_helpers import yaml_safe_load
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
thispath = os.path.dirname(__file__)
|
|
@@ -129,7 +130,7 @@ def test_vivado_tool_defines():
|
|
|
129
130
|
os.getcwd(), 'eda.work', 'oclib_fifo.elab', 'eda_output_config.yml'
|
|
130
131
|
)
|
|
131
132
|
|
|
132
|
-
data =
|
|
133
|
+
data = yaml_safe_load(eda_config_yml_path)
|
|
133
134
|
assert 'args' in data
|
|
134
135
|
assert data['args'].get('top', '') == 'oclib_fifo'
|
|
135
136
|
assert 'config' in data
|
opencos/tools/iverilog.py
CHANGED
|
@@ -7,9 +7,9 @@ import shutil
|
|
|
7
7
|
import subprocess
|
|
8
8
|
|
|
9
9
|
from opencos import util
|
|
10
|
-
from opencos.util import sanitize_defines_for_sh
|
|
11
10
|
from opencos.eda_base import Tool
|
|
12
11
|
from opencos.commands import CommandSim
|
|
12
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ToolIverilog(Tool):
|
|
@@ -108,7 +108,7 @@ class CommandSimIverilog(CommandSim, ToolIverilog):
|
|
|
108
108
|
]
|
|
109
109
|
)
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
self.write_eda_config_and_args()
|
|
112
112
|
|
|
113
113
|
def compile(self):
|
|
114
114
|
if self.args['stop-before-compile']:
|
opencos/tools/modelsim_ase.py
CHANGED
|
@@ -8,9 +8,9 @@ Contains classes for ToolModelsimAse, CommandSimModelsimAse, CommandElabModelsim
|
|
|
8
8
|
import os
|
|
9
9
|
|
|
10
10
|
from opencos import util
|
|
11
|
-
from opencos.util import sanitize_defines_for_sh
|
|
12
11
|
from opencos.commands import CommandSim
|
|
13
12
|
from opencos.tools.questa import ToolQuesta
|
|
13
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
14
14
|
|
|
15
15
|
class ToolModelsimAse(ToolQuesta):
|
|
16
16
|
'''ToolModelsimAse used by opencos.eda for --tool=modelsim_ase'''
|
|
@@ -77,7 +77,7 @@ class CommandSimModelsimAse(CommandSim, ToolModelsimAse):
|
|
|
77
77
|
command_lists = [['./pre_compile_dep_shell_commands.sh']] + vsim_command_lists
|
|
78
78
|
)
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
self.write_eda_config_and_args()
|
|
81
81
|
|
|
82
82
|
def compile(self):
|
|
83
83
|
if self.args['stop-before-compile']:
|
opencos/tools/riviera.py
CHANGED
|
@@ -11,8 +11,8 @@ import shutil
|
|
|
11
11
|
import subprocess
|
|
12
12
|
|
|
13
13
|
from opencos import util
|
|
14
|
-
from opencos.util import sanitize_defines_for_sh
|
|
15
14
|
from opencos.tools.modelsim_ase import ToolModelsimAse, CommandSimModelsimAse
|
|
15
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
16
16
|
|
|
17
17
|
class ToolRiviera(ToolModelsimAse):
|
|
18
18
|
'''ToolRiviera used by opencos.eda for --tool=riviera'''
|
opencos/tools/slang.py
CHANGED
|
@@ -10,9 +10,9 @@ import shutil
|
|
|
10
10
|
import subprocess
|
|
11
11
|
|
|
12
12
|
from opencos import util
|
|
13
|
-
from opencos.util import sanitize_defines_for_sh
|
|
14
13
|
from opencos.eda_base import Tool
|
|
15
14
|
from opencos.commands import CommandElab
|
|
15
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ToolSlang(Tool):
|
opencos/tools/surelog.py
CHANGED
|
@@ -7,9 +7,9 @@ import shutil
|
|
|
7
7
|
import subprocess
|
|
8
8
|
|
|
9
9
|
from opencos import util
|
|
10
|
-
from opencos.util import sanitize_defines_for_sh
|
|
11
10
|
from opencos.eda_base import Tool
|
|
12
11
|
from opencos.commands import CommandElab
|
|
12
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ToolSurelog(Tool):
|
opencos/tools/verilator.py
CHANGED
|
@@ -10,9 +10,9 @@ import shutil
|
|
|
10
10
|
import subprocess
|
|
11
11
|
|
|
12
12
|
from opencos import util
|
|
13
|
-
from opencos.util import sanitize_defines_for_sh
|
|
14
13
|
from opencos.eda_base import Tool
|
|
15
14
|
from opencos.commands import CommandSim
|
|
15
|
+
from opencos.utils.str_helpers import sanitize_defines_for_sh
|
|
16
16
|
|
|
17
17
|
class ToolVerilator(Tool):
|
|
18
18
|
'''ToolVerilator used by opencos.eda for --tool=verilator'''
|
opencos/tools/vivado.py
CHANGED
|
@@ -182,7 +182,7 @@ class CommandSimVivado(CommandSim, ToolVivado):
|
|
|
182
182
|
['./simulate.sh'],
|
|
183
183
|
])
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
self.write_eda_config_and_args()
|
|
186
186
|
|
|
187
187
|
def compile(self):
|
|
188
188
|
if self.args['stop-before-compile']:
|
opencos/tools/yosys.py
CHANGED
|
@@ -9,9 +9,10 @@ import os
|
|
|
9
9
|
import shutil
|
|
10
10
|
import subprocess
|
|
11
11
|
|
|
12
|
-
from opencos import util
|
|
12
|
+
from opencos import util, eda_config
|
|
13
13
|
from opencos.eda_base import Tool, get_eda_exec
|
|
14
14
|
from opencos.commands import CommandSynth, CommandLec
|
|
15
|
+
from opencos.utils.markup_helpers import yaml_safe_load
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def get_commands_to_run_scriptfiles(
|
|
@@ -543,8 +544,8 @@ class CommandLecYosys(CommandLec, ToolYosys):
|
|
|
543
544
|
'''Returns the top name given the design number that we synthesized'''
|
|
544
545
|
|
|
545
546
|
work_dir = self.synth_work_dirs[design_num]
|
|
546
|
-
output_cfg_fpath = os.path.join(work_dir,
|
|
547
|
-
data =
|
|
547
|
+
output_cfg_fpath = os.path.join(work_dir, eda_config.EDA_OUTPUT_CONFIG_FNAME)
|
|
548
|
+
data = yaml_safe_load(output_cfg_fpath)
|
|
548
549
|
top = data.get('args', {}).get('top', '')
|
|
549
550
|
if not top:
|
|
550
551
|
self.error(f'"top" not found in synth run from {work_dir=} in',
|