File tree Expand file tree Collapse file tree 5 files changed +36
-7
lines changed
Expand file tree Collapse file tree 5 files changed +36
-7
lines changed Original file line number Diff line number Diff line change @@ -46,3 +46,17 @@ def pytest_addoption(parser):
4646 auto: choose the best tool based on what is installed
4747 """
4848 )
49+
50+ parser .addoption (
51+ "--synth-part" ,
52+ type = str ,
53+ default = ".*" ,
54+ help = """
55+ A REGEX expression used to filter the part used for the synthesis test.
56+
57+ Useful when the default method for finding a part finds a part which you don't have a
58+ license for.
59+
60+ Defaults to '.*'.
61+ """
62+ )
Original file line number Diff line number Diff line change 1- from typing import List
21import os
2+ from typing import List
33
44import pytest
55
66from .base_testcase import BaseTestCase
77from .synthesizers import get_synthesizer_cls
88
9+
910class SynthTestCase (BaseTestCase ):
1011
1112 def _get_synth_files (self ) -> List [str ]:
@@ -26,7 +27,7 @@ def setUp(self) -> None:
2627 def run_synth (self ) -> None :
2728 name = self .request .config .getoption ("--synth-tool" )
2829 synth_cls = get_synthesizer_cls (name )
29- synth = synth_cls (self )
30+ synth = synth_cls (self , request = self . request )
3031
3132 # cd into the build directory
3233 cwd = os .getcwd ()
Original file line number Diff line number Diff line change 11from typing import TYPE_CHECKING , List
22
3+ import pytest
4+
35if TYPE_CHECKING :
46 from ..synth_testcase import SynthTestCase
57
68class Synthesizer :
79 name = ""
810
11+ #: this gets auto-loaded via the _load_request autouse fixture
12+ request = None # type: pytest.FixtureRequest
13+
14+ @pytest .fixture (autouse = True )
15+ def _load_request (self , request ):
16+ self .request = request
17+
918 @classmethod
1019 def is_installed (cls ) -> bool :
1120 raise NotImplementedError
1221
13- def __init__ (self , testcase : 'SynthTestCase' = None ) -> None :
22+ def __init__ (self , testcase : 'SynthTestCase' = None ,
23+ request : 'pytest.FixtureRequest' = None ) -> None :
1424 self .testcase = testcase
25+ self .request = request
1526
1627 def run (self ) -> None :
1728 raise NotImplementedError
Original file line number Diff line number Diff line change 11import os
2- import subprocess
32import shutil
3+ import subprocess
44
55from .base import Synthesizer
66
7+
78class Vivado (Synthesizer ):
89 name = "vivado"
910
@@ -22,7 +23,7 @@ def run(self) -> None:
2223 "-mode" , "batch" ,
2324 "-log" , "out.log" ,
2425 "-source" , script ,
25- "-tclargs"
26+ "-tclargs" , self . request . config . getoption ( "--synth-part" )
2627 ]
2728 cmd .extend (self .testcase ._get_synth_files ())
2829
Original file line number Diff line number Diff line change 11set this_dir [file dirname [file normalize [info script]]]
2- set files $argv
2+ set files [lrange $argv 1 end]
3+
4+ set part_regex [lindex $argv 0]
35
46
57# Multi-driven
@@ -22,7 +24,7 @@ set_msg_config -id {[Synth 8-295]} -new_severity "ERROR"
2224set_msg_config -severity {CRITICAL WARNING} -new_severity " ERROR"
2325
2426
25- set_part [lindex [get_parts] 0]
27+ set_part [lindex [get_parts -regex $part_regex ] 0]
2628read_verilog -sv $files
2729read_xdc $this_dir /constr.xdc
2830synth_design -top regblock -mode out_of_context
You can’t perform that action at this time.
0 commit comments