@@ -55,7 +55,7 @@ def __init__(
5555 pad_file = None ,
5656 additional_files = None ,
5757 additional_files_list_add = None ,
58- circuit_constraint_list_add = None
58+ circuit_constraint_list_add = None ,
5959 ):
6060 self .task_name = task_name
6161 self .config_dir = config_dir
@@ -82,9 +82,9 @@ def __init__(
8282 self .pad_file = pad_file
8383 self .additional_files = additional_files
8484 self .additional_files_list_add = additional_files_list_add
85- self .circuit_constraints = parse_circuit_constraint_list (circuit_constraint_list_add ,
86- self .circuits ,
87- self . archs )
85+ self .circuit_constraints = parse_circuit_constraint_list (
86+ circuit_constraint_list_add , self .circuits , self . archs
87+ )
8888
8989
9090# pylint: enable=too-few-public-methods
@@ -306,9 +306,8 @@ def check_include_fields(config_file, key_values):
306306 )
307307 )
308308
309- def parse_circuit_constraint_list (
310- circuit_constraint_list , circuits_list , arch_list
311- ) -> dict :
309+
310+ def parse_circuit_constraint_list (circuit_constraint_list , circuits_list , arch_list ) -> dict :
312311 """
313312 Parse the circuit constraints passed in via the config file.
314313 Circuit constraints are expected to have the following syntax:
@@ -342,38 +341,39 @@ def parse_circuit_constraint_list(
342341 # Parse the circuit constraint list
343342 for circuit_constraint in circuit_constraint_list :
344343 # Remove the round brackets.
345- if circuit_constraint [0 ] != '(' or circuit_constraint [- 1 ] != ')' :
346- raise VtrError (f" Circuit constraint syntax error: \ "{ circuit_constraint } \" " )
344+ if circuit_constraint [0 ] != "(" or circuit_constraint [- 1 ] != ")" :
345+ raise VtrError (f' Circuit constraint syntax error: "{ circuit_constraint } "' )
347346 circuit_constraint = circuit_constraint [1 :- 1 ]
348347 # Split the circuit and the constraint
349- split_constraint_line = circuit_constraint .split (',' )
348+ split_constraint_line = circuit_constraint .split ("," )
350349 if len (split_constraint_line ) != 2 :
351- raise VtrError (f" Circuit constraint has too many arguments: \ "{ circuit_constraint } \" " )
350+ raise VtrError (f' Circuit constraint has too many arguments: "{ circuit_constraint } "' )
352351 circuit = split_constraint_line [0 ].strip ()
353352 constraint = split_constraint_line [1 ].strip ()
354353 # Check that the circuit actually exists.
355354 if circuit not in circuits_list :
356- raise VtrError (f" Cannot constrain circuit \ "{ circuit } \ " , circuit has not been added" )
355+ raise VtrError (f' Cannot constrain circuit "{ circuit } ", circuit has not been added' )
357356 # Parse the constraint
358357 split_constraint = constraint .split ("=" )
359358 if len (split_constraint ) != 2 :
360- raise VtrError (f" Circuit constraint syntax error: \ "{ circuit_constraint } \" " )
359+ raise VtrError (f' Circuit constraint syntax error: "{ circuit_constraint } "' )
361360 constr_key = split_constraint [0 ].strip ()
362361 constr_val = split_constraint [1 ].strip ()
363362 # Check that the constr_key is valid.
364363 if constr_key not in circuit_constraint_keys :
365- raise VtrError (f" Invalid constraint \ "{ constr_key } \ " used on circuit \ "{ circuit } \" " )
364+ raise VtrError (f' Invalid constraint "{ constr_key } " used on circuit "{ circuit } "' )
366365 # In the case of arch constraints, make sure this arch exists.
367366 if constr_key == "arch" and constr_val not in arch_list :
368- raise VtrError (f" Cannot constrain arch \ "{ constr_key } \ " , arch has not been added" )
367+ raise VtrError (f' Cannot constrain arch "{ constr_key } ", arch has not been added' )
369368 # Make sure this circuit is not already constrained with this constr_arg
370369 if res_circuit_constraints [circuit ][constr_key ] is not None :
371- raise VtrError (f" Circuit \ "{ circuit } \ " cannot be constrained more than once" )
370+ raise VtrError (f' Circuit "{ circuit } " cannot be constrained more than once' )
372371 # Add the constraint for this circuit
373372 res_circuit_constraints [circuit ][constr_key ] = constr_val
374373
375374 return res_circuit_constraints
376375
376+
377377def shorten_task_names (configs , common_task_prefix ):
378378 """
379379 Shorten the task names of the configs by remove the common task prefix.
@@ -582,10 +582,7 @@ def create_jobs(args, configs, after_run=False) -> List[Job]:
582582 work_dir = get_work_dir_addr (arch , circuit , noc_traffic )
583583
584584 run_dir = (
585- str (
586- Path (get_latest_run_dir (find_task_dir (config , args .alt_tasks_dir )))
587- / work_dir
588- )
585+ str (Path (get_latest_run_dir (find_task_dir (config , args .alt_tasks_dir ))) / work_dir )
589586 if after_run
590587 else str (
591588 Path (get_next_run_dir (find_task_dir (config , args .alt_tasks_dir ))) / work_dir
@@ -779,6 +776,7 @@ def ret_expected_vpr_status(arch, circuit, golden_results, script_params=None):
779776
780777 return golden_metrics ["vpr_status" ]
781778
779+
782780def apply_cmd_line_circuit_constraints (cmd , circuit , config ):
783781 """
784782 Apply the circuit constraints to the command line. If the circuit is not
@@ -793,6 +791,7 @@ def apply_cmd_line_circuit_constraints(cmd, circuit, config):
793791 if circuit_vpr_constraints is not None :
794792 cmd += ["--read_vpr_constraints" , circuit_vpr_constraints ]
795793
794+
796795def resolve_vtr_source_file (config , filename , base_dir = "" ):
797796 """
798797 Resolves an filename with a base_dir
0 commit comments