Skip to content

Commit e03872d

Browse files
[Format] Cleaned Up Python Format Errors
The formatter was failing on some python files since they were using the Python2 syntax for the print statements instead of the Python3 syntax.
1 parent e16f263 commit e03872d

File tree

8 files changed

+53
-53
lines changed

8 files changed

+53
-53
lines changed

odin_ii/regression_test/tools/ODIN_CONFIG.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,7 @@ def buildChildren(self, child_, nodeName_):
15421542

15431543

15441544
def usage():
1545-
print USAGE_TEXT
1545+
print(USAGE_TEXT)
15461546
sys.exit(1)
15471547

15481548

odin_ii/regression_test/tools/odin_config_maker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def main(argv=None):
2828

2929
# Check our options for input errors
3030
if not options.arch:
31-
print "\tDid not get an architecture file; use odin_config_maker.py -h for help."
31+
print("\tDid not get an architecture file; use odin_config_maker.py -h for help.")
3232
return -1
3333
if options.individual is None and options.directory is None and options.files is None:
34-
print "\tDid not get any input options; use odin_config_maker.py -h for help."
34+
print("\tDid not get any input options; use odin_config_maker.py -h for help.")
3535
return -1
3636
if options.individual is not None and options.directory is not None:
37-
print "\tThe -i and -d options are mutually exclusive; use odin_config_maker.py -h for help."
37+
print("\tThe -i and -d options are mutually exclusive; use odin_config_maker.py -h for help.")
3838
return -1
3939

4040
# Create our Config Files
@@ -54,7 +54,7 @@ def main(argv=None):
5454
)
5555

5656
for file in file_list:
57-
print file[file.rfind("/") + 1 : file.rfind(".v")]
57+
print(file[file.rfind("/") + 1 : file.rfind(".v")])
5858
base = file[file.rfind("/") + 1 : file.rfind(".v")]
5959
create_odin_projects(options, [file], base, path)
6060

@@ -78,7 +78,7 @@ def main(argv=None):
7878

7979
create_odin_projects(options, file_list, base, path)
8080
else:
81-
print "Something Failed!"
81+
print("Something Failed!")
8282
return -1
8383

8484

odin_ii/regression_test/tools/synth_using_odin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
if len(sys.argv) is not 2:
12-
print "usage: " + sys.argv[0] + " <dir>"
12+
print("usage: " + sys.argv[0] + " <dir>")
1313

1414
path = abspath(sys.argv[1]) + "/"
1515
slog = open(path + "ODIN_success.lst", "w")

odin_ii/regression_test/tools/synth_using_quartus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
# print sys.argv
2121
if len(sys.argv) != 2:
22-
print "Take our Verilog benchmarks and synthesize them using QIS (Quartus)"
23-
print "Usage: GenQuartusBlifs.py <Verilog Source Dir>"
22+
print("Take our Verilog benchmarks and synthesize them using QIS (Quartus)")
23+
print("Usage: GenQuartusBlifs.py <Verilog Source Dir>")
2424
sys.exit(0)
2525

2626
projNames = map(odin.trimDotV, filter(odin.isVerilog, os.listdir(sys.argv[1])))
@@ -68,11 +68,11 @@
6868

6969
process = subprocess.Popen(clean, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
7070
(out, err) = process.communicate()
71-
print out + "\n"
71+
print(out + "\n")
7272

7373
process = subprocess.Popen(create, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
7474
(out, err) = process.communicate()
75-
print out + "\n"
75+
print(out + "\n")
7676

7777
process = subprocess.Popen(move, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
7878
(out, err) = process.communicate()

odin_ii/regression_test/tools/synth_using_vl2mv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
if len(sys.argv) is not 2:
13-
print "usage: " + sys.argv[0] + " <dir>"
13+
print("usage: " + sys.argv[0] + " <dir>")
1414

1515
path = abspath(sys.argv[1]) + "/"
1616
os.system('mkdir -p "' + path + 'VL2MV_Blifs/"')

odin_ii/usefull_tools/restore_blackboxed_latches_from_blif_file.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ def main():
4949
# print "DEBUG: RESTORED_BLIF_FILE: {}".format(args.restoredBlifFile)
5050

5151
if args.inplace:
52-
print "Inplace Restortation:"
52+
print("Inplace Restortation:")
5353
elif not args.restoredBlifFile:
54-
print '\n\nERROR: Must Specify Either Inplace Restoration "-i,--inplace" or a file to restore to "-r\--restoredBlifFile"\nExiting...\n'
54+
print('\n\nERROR: Must Specify Either Inplace Restoration "-i,--inplace" or a file to restore to "-r\--restoredBlifFile"\nExiting...\n')
5555
parser.print_help()
5656
return -1
5757

5858
if not os.path.isfile(args.blifFileToRestore):
59-
print '\n\nERROR: BLIF File to Restore "{}" doesn not exist\nExiting...\n'.format(
59+
print('\n\nERROR: BLIF File to Restore "{}" doesn not exist\nExiting...\n'.format(
6060
args.blifFileToRestore
61-
)
61+
))
6262
parser.print_help()
6363
return -1
6464

65-
print "Restoring original inputs, ouptuts, types, controls and init_vals:"
65+
print("Restoring original inputs, ouptuts, types, controls and init_vals:")
6666

6767
if args.inplace:
6868
args.restoredBlifFile = "restored.blif.tmp"
@@ -81,15 +81,15 @@ def main():
8181
line = line.replace(src, target)
8282
outfile.write(line)
8383

84-
print "Removing BlackBoxed Latch Model:"
84+
print("Removing BlackBoxed Latch Model:")
8585

8686
ignore = False
8787
for line in fileinput.input(args.restoredBlifFile, inplace=True):
8888
if not ignore:
8989
if line.startswith(".model bb_latch"):
9090
ignore = True
9191
else:
92-
print line,
92+
print(line),
9393
if ignore and line.isspace():
9494
ignore = False
9595

@@ -98,9 +98,9 @@ def main():
9898
dest_filename = os.path.join(args.blifFileToRestore)
9999
shutil.move(src_filename, dest_filename)
100100

101-
print "BLIF File Restored. See: {}".format(args.blifFileToRestore)
101+
print("BLIF File Restored. See: {}".format(args.blifFileToRestore))
102102
else:
103-
print "BLIF File Restored. See: {}".format(args.restoredBlifFile)
103+
print("BLIF File Restored. See: {}".format(args.restoredBlifFile))
104104

105105
return
106106

vtr_flow/scripts/benchtracker/plotter-offline.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self, axis_name_supmap, xy_name_map, y_raw_list):
120120

121121
def transpose_overlay_axes(self, overlay_axis, y_type="raw"):
122122
if y_type == "gmean" and self.axis_cur_gmean_order == []:
123-
print "**** CANNOT FILTER ON GMEAN YET. AXIS NOT SET ****"
123+
print("**** CANNOT FILTER ON GMEAN YET. AXIS NOT SET ****")
124124
axis_cost_temp = (y_type == "gmean" and [self.axis_gmean_cost] or [self.axis_raw_cost])[0]
125125
axis_cost_temp = {k: (v + (k in overlay_axis)) for (k, v) in axis_cost_temp.items()}
126126
# NOTE: now axis_raw_cost is converted from dict to list of tuples, so that it is ordered by the cost value.
@@ -291,7 +291,7 @@ def plot_generator(self, data_collection, axis_order, overlay_axis, mode, plot_t
291291
plot_type,
292292
)
293293
else:
294-
print err_msg["choose plot to show"]
294+
print(err_msg["choose plot to show"])
295295
plt.show()
296296

297297

@@ -303,48 +303,48 @@ def plot_generator(self, data_collection, axis_order, overlay_axis, mode, plot_t
303303

304304
def db_connector():
305305
tasks = idb.list_tasks()
306-
print "available tasks: "
306+
print("available tasks: ")
307307
for i in range(len(tasks)):
308-
print "[" + str(i) + "]: ", tasks[i]
308+
print("[" + str(i) + "]: ", tasks[i])
309309
task_num = int(raw_input("which task to choose (input the index): "))
310310
available_choice = idb.describe_tasks([tasks[task_num]])
311311
available_name = [k.raw()[0] for k in available_choice]
312312
available_type = [k.raw()[1] for k in available_choice]
313-
print "==========================================================="
314-
print "available choices:"
315-
print "\n".join(i for i in available_choice)
316-
print "==========================================================="
313+
print("===========================================================")
314+
print("available choices:")
315+
print("\n".join(i for i in available_choice))
316+
print("===========================================================")
317317
while 1:
318318
x = raw_input("choose a x axis name: ")
319319
if x in available_name:
320320
break
321-
print err_msg["choose axis"]
321+
print(err_msg["choose axis"])
322322
while 1:
323323
y = raw_input("choose a y axis name: ")
324324
if y in available_name:
325325
break
326-
print err_msg["choose axis"]
326+
print(err_msg["choose axis"])
327327
filt_list = []
328328
filt_name_list = []
329329
cur_choice = None
330-
print "==========================================================="
330+
print("===========================================================")
331331
while 1:
332332
while 1:
333333
cur_choice = raw_input("choose filter name (enter empty string to exit): ")
334334
if (cur_choice in available_name) or (cur_choice == ""):
335335
break
336-
print err_msg["choose axis"]
336+
print(err_msg["choose axis"])
337337
if cur_choice == "":
338338
break
339339
filt_name_list.append(cur_choice)
340340
cur_type = available_type[available_name.index(cur_choice)]
341341
fname = cur_choice
342342
fmethod = filter_method[cur_type]
343343
param_range = idb.describe_param(cur_choice + " " + cur_type, "range", tasks[task_num])
344-
print "available range: ", param_range
344+
print("available range: ", param_range)
345345
frange = None
346346
if len(param_range) == 1:
347-
print "set range to: ", param_range
347+
print("set range to: ", param_range)
348348
frange = param_range
349349
else:
350350
cur_range = raw_input(
@@ -356,15 +356,15 @@ def db_connector():
356356
elif fmethod == "IN" and choice_fields != []:
357357
frange = choice_fields
358358
elif choice_fields == []:
359-
print "set range to: ", param_range
359+
print("set range to: ", param_range)
360360
frange = param_range
361361
else:
362-
print err_msg["choose method"]
362+
print(err_msg["choose method"])
363363
# filt_list.append(idb.Task_filter(fname, fmethod, frange))
364364
filt_list.append(frange[1])
365365
filt_list = [item for sublist in filt_list for item in sublist]
366-
print "------"
367-
print filt_list
366+
print("------")
367+
print(filt_list)
368368
data = idb.retrieve_data(x, y, filt_list, [tasks[task_num]])[1]
369369
return {"data": data, "filt_name_list": filt_name_list, "x": x, "y": y}
370370

@@ -380,15 +380,15 @@ def main():
380380
filt_name_list = ret["filt_name_list"]
381381
data_collection = data_converter(data, ret["x"], ret["y"], filt_name_list)
382382

383-
print "########################################"
384-
print "---- Description: ----\n" + ">>\n" + "VPR benchmark experiment should have 2 types of data: \n" + "parameter: settings in for the experiment (e.g.: fc, wire length, switch block ...)\n" + "metrics: measurements from the VPR output (e.g.: min chan width, critical path delay ...)\n" + ">>\n" + "Data passed into this plotter should have already been classified into 3 axes: \n" + "one [x] axis (chosen from parameter)\n" + "multiple [y] axis (chosen from metrics)\n" + "multiple [filter] axis (all the unchosen parameters)\n" + ">>\n" + "For example, if the experiment has: \n" + "[arch, circuit, wire length, switch block, fc, min chan width, critical path delay, area, total wire length]\n" + "and you choose fc as x axis, [min chan width, critical path delay, area, total wire length] as y axes,\n" + "then filter axes are the unchosen parameters, i.e.: arch, circuit, wire length, switch block. "
385-
print "#########################################"
386-
print "---- Usage ----\n" + ">>\n" + "1. choose overlay axes among the filter axes (overlay axes will become legend in a single plot)\n" + '2. choose whether to whether to calculate the geo mean over the overlay axis ("merge" function)\n' + " (Notice: you can choose as many overlay axes as you like, but when you choose merge, it will only\n" + " calculate the geo mean over the last overlay axis. So for example, if your overlay axes are [fc, circuit],\n" + " the merge will only get geo mean over all the circuits rather that all the (circuit,fc) combination, and \n" + " fc will still be overlaid in the merged plot.)\n" + '3. the data after geo mean calcultion will be referred to as "gmean", and the data before the geo mean will be \n' + ' referred to as "raw", you can switch the overlay axes for both gmean data and raw data, for as many times \n' + ' as you like. But once you "merge" on a new axis, the old gmean data will be replaced by the new one, and further\n' + " operation will be acted on only the new gmean data."
383+
print("########################################")
384+
print("---- Description: ----\n" + ">>\n" + "VPR benchmark experiment should have 2 types of data: \n" + "parameter: settings in for the experiment (e.g.: fc, wire length, switch block ...)\n" + "metrics: measurements from the VPR output (e.g.: min chan width, critical path delay ...)\n" + ">>\n" + "Data passed into this plotter should have already been classified into 3 axes: \n" + "one [x] axis (chosen from parameter)\n" + "multiple [y] axis (chosen from metrics)\n" + "multiple [filter] axis (all the unchosen parameters)\n" + ">>\n" + "For example, if the experiment has: \n" + "[arch, circuit, wire length, switch block, fc, min chan width, critical path delay, area, total wire length]\n" + "and you choose fc as x axis, [min chan width, critical path delay, area, total wire length] as y axes,\n" + "then filter axes are the unchosen parameters, i.e.: arch, circuit, wire length, switch block. ")
385+
print("#########################################")
386+
print("---- Usage ----\n" + ">>\n" + "1. choose overlay axes among the filter axes (overlay axes will become legend in a single plot)\n" + '2. choose whether to whether to calculate the geo mean over the overlay axis ("merge" function)\n' + " (Notice: you can choose as many overlay axes as you like, but when you choose merge, it will only\n" + " calculate the geo mean over the last overlay axis. So for example, if your overlay axes are [fc, circuit],\n" + " the merge will only get geo mean over all the circuits rather that all the (circuit,fc) combination, and \n" + " fc will still be overlaid in the merged plot.)\n" + '3. the data after geo mean calcultion will be referred to as "gmean", and the data before the geo mean will be \n' + ' referred to as "raw", you can switch the overlay axes for both gmean data and raw data, for as many times \n' + ' as you like. But once you "merge" on a new axis, the old gmean data will be replaced by the new one, and further\n' + " operation will be acted on only the new gmean data.")
387387
while 1:
388-
print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
389-
print "available axis to overlay: "
390-
print "for the raw data", data_collection.axis_cur_raw_order
391-
print "for the gmean data", data_collection.axis_cur_gmean_order
388+
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
389+
print("available axis to overlay: ")
390+
print("for the raw data", data_collection.axis_cur_raw_order)
391+
print("for the gmean data", data_collection.axis_cur_gmean_order)
392392
overlay_type = None
393393
overlay_axis = []
394394
if data_collection.y_gmean_list != []:
@@ -399,7 +399,7 @@ def main():
399399
elif overlay_type == "raw":
400400
break
401401
else:
402-
print err_msg["choose overlay type"]
402+
print(err_msg["choose overlay type"])
403403
else:
404404
overlay_type = "raw"
405405
while 1:
@@ -425,7 +425,7 @@ def main():
425425
):
426426
break
427427
else:
428-
print err_msg["overlay axis"]
428+
print(err_msg["overlay axis"])
429429

430430
data_collection.transpose_overlay_axes(overlay_axis, overlay_type)
431431
overlay_merge = 0
@@ -440,7 +440,7 @@ def main():
440440
overlay_merge = 0
441441
break
442442
else:
443-
print err_msg["yes or no"]
443+
print(err_msg["yes or no"])
444444
ui = UI()
445445
if overlay_type == "raw":
446446
axis_left = [k for k in data_collection.axis_cur_raw_order if k not in overlay_axis]
@@ -459,7 +459,7 @@ def main():
459459
elif show_plot_type == "":
460460
break
461461
else:
462-
print err_msg["choose plot to show"]
462+
print(err_msg["choose plot to show"])
463463

464464

465465
if __name__ == "__main__":

vtr_flow/scripts/spice/run_spice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@
9999
stdout, stderr = p.communicate()
100100

101101
if re.search("error", stdout):
102-
print "Error"
102+
print("Error")
103103

104104
else:
105105
m = re.search("^\s*power=\s*(\S*).*$", stdout, re.MULTILINE)
106106
if m:
107-
print m.group(1)
107+
print(m.group(1))
108108

109109

110110
# f = open("~/spice_modeling/" + sys.argv[1] + ".spx")

0 commit comments

Comments
 (0)