@@ -1151,7 +1151,7 @@ def _yosys_impl(ctx):
11511151 ),
11521152 ]
11531153
1154- orfs_synth = rule (
1154+ _orfs_synth = rule (
11551155 implementation = _yosys_impl ,
11561156 attrs = yosys_attrs () |
11571157 synth_attrs () |
@@ -1172,6 +1172,46 @@ orfs_synth = rule(
11721172 executable = True ,
11731173)
11741174
1175+ def _filter_stage_args (
1176+ stage ,
1177+ ** kwargs ):
1178+ """Filter and prepare the arguments for a specific stage."""
1179+
1180+ def _args (** kwargs ):
1181+ return kwargs
1182+
1183+ arguments = kwargs .pop ("arguments" , {})
1184+ data = kwargs .pop ("data" , [])
1185+ settings = kwargs .pop ("settings" , {})
1186+ extra_configs = kwargs .pop ("extra_configs" , {})
1187+ sources = kwargs .pop ("sources" , {})
1188+ stage_arguments = kwargs .pop ("stage_arguments" , {})
1189+ stage_sources = kwargs .pop ("stage_sources" , {})
1190+ stage_data = kwargs .pop ("stage_data" , {})
1191+
1192+ return _args (
1193+ arguments = get_stage_args (
1194+ stage ,
1195+ arguments = arguments ,
1196+ sources = sources ,
1197+ stage_arguments = stage_arguments ,
1198+ ),
1199+ data = get_sources (stage , stage_sources , sources ) +
1200+ stage_data .get (stage , []) + data ,
1201+ extra_configs = extra_configs .get (stage , []),
1202+ settings = get_stage_args (
1203+ stage ,
1204+ arguments = settings ,
1205+ ),
1206+ ** kwargs
1207+ )
1208+
1209+ def orfs_synth (** kwargs ):
1210+ return _orfs_synth (** _filter_stage_args (
1211+ "synth" ,
1212+ ** kwargs
1213+ ))
1214+
11751215def _make_impl (
11761216 ctx ,
11771217 stage ,
@@ -1704,7 +1744,7 @@ UPDATE_RULES_IMPL = struct(stage = "update_rules", impl = orfs_update_rules)
17041744TEST_STAGE_IMPL = struct (stage = "test" , impl = orfs_test )
17051745
17061746STAGE_IMPLS = [
1707- struct (stage = "synth" , impl = orfs_synth ),
1747+ struct (stage = "synth" , impl = _orfs_synth ),
17081748 struct (stage = "floorplan" , impl = orfs_floorplan ),
17091749 struct (stage = "place" , impl = orfs_place ),
17101750 struct (stage = "cts" , impl = orfs_cts ),
@@ -2084,28 +2124,23 @@ def _orfs_pass(
20842124 synth_step = steps [0 ]
20852125 step_name = _step_name (name , variant , synth_step .stage )
20862126 step_names .append (step_name )
2087- synth_step .impl (
2127+ synth_step .impl (** _filter_stage_args (
2128+ synth_step .stage ,
20882129 name = step_name ,
2089- arguments = get_stage_args (
2090- synth_step .stage ,
2091- stage_arguments ,
2092- arguments ,
2093- sources ,
2094- ),
2095- data = get_sources (synth_step .stage , stage_sources , sources ) +
2096- stage_data .get (synth_step .stage , []),
2130+ stage_arguments = stage_arguments ,
2131+ arguments = arguments ,
2132+ sources = sources ,
20972133 deps = macros ,
2098- extra_configs = extra_configs .get (synth_step .stage , []),
20992134 module_top = top ,
2100- settings = get_stage_args (
2101- synth_step .stage ,
2102- arguments = settings ,
2103- ),
21042135 variant = variant ,
21052136 verilog_files = verilog_files ,
21062137 pdk = pdk ,
2138+ stage_sources = stage_sources ,
2139+ settings = settings ,
2140+ extra_configs = extra_configs ,
2141+ stage_data = stage_data ,
21072142 ** kwargs
2108- )
2143+ ))
21092144 orfs_deps (
21102145 name = "{}_deps" .format (_step_name (name , variant , synth_step .stage )),
21112146 src = _step_name (name , variant , synth_step .stage ),
@@ -2122,19 +2157,19 @@ def _orfs_pass(
21222157 )
21232158 step_name = _step_name (name , stage_variant , step .stage )
21242159 src = previous_stage .get (step .stage , _step_name (name , variant , prev .stage ))
2125- step .impl (
2160+ step .impl (** _filter_stage_args (
2161+ step .stage ,
21262162 name = step_name ,
2163+ stage_arguments = stage_arguments ,
2164+ arguments = arguments ,
2165+ sources = sources ,
2166+ stage_sources = stage_sources ,
2167+ settings = settings ,
2168+ extra_configs = extra_configs ,
21272169 src = src ,
2128- arguments = get_stage_args (step .stage , stage_arguments , arguments , sources ),
2129- data = get_sources (step .stage , stage_sources , sources ) +
2130- stage_data .get (step .stage , []) +
2131- data ,
2132- extra_configs = extra_configs .get (step .stage , []),
21332170 variant = variant ,
2134- settings = get_stage_args (
2135- step .stage ,
2136- arguments = settings ,
2137- ),
2171+ stage_data = stage_data ,
2172+ data = data ,
21382173 ** (
21392174 kwargs |
21402175 _kwargs (
@@ -2143,7 +2178,7 @@ def _orfs_pass(
21432178 ) |
21442179 more_kwargs
21452180 )
2146- )
2181+ ))
21472182 if add_deps :
21482183 orfs_deps (
21492184 name = "{}_deps" .format (step_name ),
0 commit comments