@@ -55,7 +55,7 @@ def __init__(
55
55
pad_file = None ,
56
56
additional_files = None ,
57
57
additional_files_list_add = None ,
58
- circuit_constraint_list_add = None
58
+ circuit_constraint_list_add = None ,
59
59
):
60
60
self .task_name = task_name
61
61
self .config_dir = config_dir
@@ -82,9 +82,9 @@ def __init__(
82
82
self .pad_file = pad_file
83
83
self .additional_files = additional_files
84
84
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
+ )
88
88
89
89
90
90
# pylint: enable=too-few-public-methods
@@ -306,9 +306,8 @@ def check_include_fields(config_file, key_values):
306
306
)
307
307
)
308
308
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 :
312
311
"""
313
312
Parse the circuit constraints passed in via the config file.
314
313
Circuit constraints are expected to have the following syntax:
@@ -342,38 +341,39 @@ def parse_circuit_constraint_list(
342
341
# Parse the circuit constraint list
343
342
for circuit_constraint in circuit_constraint_list :
344
343
# 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 } "' )
347
346
circuit_constraint = circuit_constraint [1 :- 1 ]
348
347
# Split the circuit and the constraint
349
- split_constraint_line = circuit_constraint .split (',' )
348
+ split_constraint_line = circuit_constraint .split ("," )
350
349
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 } "' )
352
351
circuit = split_constraint_line [0 ].strip ()
353
352
constraint = split_constraint_line [1 ].strip ()
354
353
# Check that the circuit actually exists.
355
354
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' )
357
356
# Parse the constraint
358
357
split_constraint = constraint .split ("=" )
359
358
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 } "' )
361
360
constr_key = split_constraint [0 ].strip ()
362
361
constr_val = split_constraint [1 ].strip ()
363
362
# Check that the constr_key is valid.
364
363
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 } "' )
366
365
# In the case of arch constraints, make sure this arch exists.
367
366
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' )
369
368
# Make sure this circuit is not already constrained with this constr_arg
370
369
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' )
372
371
# Add the constraint for this circuit
373
372
res_circuit_constraints [circuit ][constr_key ] = constr_val
374
373
375
374
return res_circuit_constraints
376
375
376
+
377
377
def shorten_task_names (configs , common_task_prefix ):
378
378
"""
379
379
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]:
582
582
work_dir = get_work_dir_addr (arch , circuit , noc_traffic )
583
583
584
584
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 )
589
586
if after_run
590
587
else str (
591
588
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):
779
776
780
777
return golden_metrics ["vpr_status" ]
781
778
779
+
782
780
def apply_cmd_line_circuit_constraints (cmd , circuit , config ):
783
781
"""
784
782
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):
793
791
if circuit_vpr_constraints is not None :
794
792
cmd += ["--read_vpr_constraints" , circuit_vpr_constraints ]
795
793
794
+
796
795
def resolve_vtr_source_file (config , filename , base_dir = "" ):
797
796
"""
798
797
Resolves an filename with a base_dir
0 commit comments