Skip to content

Commit 5fe4b9b

Browse files
acomodimkurc-ant
authored andcommitted
vtr_flow: fix python linting
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 4acc6ef commit 5fe4b9b

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

vtr_flow/scripts/python_libs/vtr/flow.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class VtrStage(Enum):
1313
Enum class for the VTR stages\
1414
"""
1515

16-
odin = 1
17-
abc = 2
18-
ace = 3
19-
vpr = 4
16+
ODIN = 1
17+
ABC = 2
18+
ACE = 3
19+
VPR = 4
2020

2121
def __le__(self, other):
2222
if self.__class__ is other.__class__:
@@ -34,8 +34,8 @@ def run(
3434
architecture_file,
3535
circuit_file,
3636
power_tech_file=None,
37-
start_stage=VtrStage.odin,
38-
end_stage=VtrStage.vpr,
37+
start_stage=VtrStage.ODIN,
38+
end_stage=VtrStage.VPR,
3939
command_runner=vtr.CommandRunner(),
4040
temp_dir=Path("./temp"),
4141
odin_args=None,
@@ -175,7 +175,7 @@ def run(
175175
#
176176
# RTL Elaboration & Synthesis
177177
#
178-
if should_run_stage(VtrStage.odin, start_stage, end_stage) and circuit_file.suffixes != ".blif":
178+
if should_run_stage(VtrStage.ODIN, start_stage, end_stage) and circuit_file.suffixes != ".blif":
179179
vtr.odin.run(
180180
architecture_copy,
181181
next_stage_netlist,
@@ -195,7 +195,7 @@ def run(
195195
#
196196
# Logic Optimization & Technology Mapping
197197
#
198-
if should_run_stage(VtrStage.abc, start_stage, end_stage):
198+
if should_run_stage(VtrStage.ABC, start_stage, end_stage):
199199
vtr.abc.run(
200200
architecture_copy,
201201
next_stage_netlist,
@@ -216,7 +216,7 @@ def run(
216216
if power_tech_file:
217217
# The user provided a tech file, so do power analysis
218218

219-
if should_run_stage(VtrStage.ace, start_stage, end_stage):
219+
if should_run_stage(VtrStage.ACE, start_stage, end_stage):
220220
vtr.ace.run(
221221
next_stage_netlist,
222222
old_netlist=post_odin_netlist,
@@ -241,7 +241,7 @@ def run(
241241
#
242242
# Pack/Place/Route
243243
#
244-
if should_run_stage(VtrStage.vpr, start_stage, end_stage):
244+
if should_run_stage(VtrStage.VPR, start_stage, end_stage):
245245
# Copy the input netlist for input to vpr
246246
shutil.copyfile(str(next_stage_netlist), str(pre_vpr_netlist))
247247
route_fixed_w = "route_chan_width" in vpr_args

vtr_flow/scripts/python_libs/vtr/parse_vtr_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,5 +566,5 @@ def find_latest_run_dir(config):
566566

567567

568568
if __name__ == "__main__":
569-
retval = vtr_command_main(sys.argv[1:])
570-
sys.exit(retval)
569+
RETVAL = vtr_command_main(sys.argv[1:])
570+
sys.exit(RETVAL)

vtr_flow/scripts/run_vtr_flow.py

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

2020
BASIC_VERBOSITY = 1
2121

22+
VTR_STAGES = ["odin", "abc", "ace", "vpr"]
23+
2224
# pylint: disable=too-few-public-methods
2325
class VtrStageArgparseAction(argparse.Action):
2426
"""
@@ -27,13 +29,13 @@ class VtrStageArgparseAction(argparse.Action):
2729

2830
def __call__(self, parser, namespace, value, option_string=None):
2931
if value == "odin":
30-
setattr(namespace, self.dest, vtr.VtrStage.odin)
32+
setattr(namespace, self.dest, vtr.VtrStage.ODIN)
3133
elif value == "abc":
32-
setattr(namespace, self.dest, vtr.VtrStage.abc)
34+
setattr(namespace, self.dest, vtr.VtrStage.ABC)
3335
elif value == "vpr":
34-
setattr(namespace, self.dest, vtr.VtrStage.vpr)
36+
setattr(namespace, self.dest, vtr.VtrStage.VPR)
3537
elif value == "lec":
36-
setattr(namespace, self.dest, vtr.VtrStage.lec)
38+
setattr(namespace, self.dest, vtr.VtrStage.LEC)
3739
else:
3840
raise argparse.ArgumentError(self, "Invalid VTR stage '" + value + "'")
3941

@@ -107,8 +109,8 @@ def vtr_command_argparser(prog=None):
107109
parser.add_argument(
108110
"-start",
109111
"-starting_stage",
110-
choices=str(list(vtr.VtrStage)),
111-
default=vtr.VtrStage.odin,
112+
choices=VTR_STAGES,
113+
default=vtr.VtrStage.ODIN,
112114
action=VtrStageArgparseAction,
113115
help="Starting stage of the VTR flow.",
114116
)
@@ -129,8 +131,8 @@ def vtr_command_argparser(prog=None):
129131
parser.add_argument(
130132
"-end",
131133
"-ending_stage",
132-
choices=str(list(vtr.VtrStage)),
133-
default=vtr.VtrStage.vpr,
134+
choices=VTR_STAGES,
135+
default=vtr.VtrStage.VPR,
134136
action=VtrStageArgparseAction,
135137
help="Ending stage of the VTR flow.",
136138
)

0 commit comments

Comments
 (0)