Skip to content

Commit b8fcc16

Browse files
authored
Merge pull request #1429 from byuccl/vtr_script_py_rewrite
Vtr flow script py rewrite
2 parents efdb610 + a804275 commit b8fcc16

File tree

26 files changed

+2989
-30
lines changed

26 files changed

+2989
-30
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ addons:
4444
- libxft-dev
4545
- libxml++2.6-dev
4646
- perl
47-
- python
48-
- python3.6
4947
- python-lxml
5048
- texinfo
5149
- time
@@ -238,9 +236,13 @@ jobs:
238236
- ./.github/travis/cron_build.sh
239237

240238
before_script:
239+
# Switch to python 3.6.3
240+
- pyenv install -f 3.6.3
241+
- pyenv global 3.6.3
242+
241243
- source .github/travis/common.sh
242244
- ./.github/travis/setup.sh
243-
245+
244246
after_script:
245247
- ./.github/travis/setup.sh
246248

dev/tutorial/NewDeveloperTutorial.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ Task #5 - Open the Black Box
8080

8181
1. Using the custom Verilog circuit and architecture created in Task #4,
8282
directly run Odin II on it to generate a blif netlist. You may need to skim the Odin II
83-
readme file and the vtr_flow/scripts/run_vtr_flow.pl.
83+
readme file and the vtr_flow/scripts/run_vtr_flow.py.
8484

8585
2. Using the output netlist of Odin II, run ABC to generate a technology-mapped blif file.
86-
You may need to skim vtr_flow/scripts/run_vtr_flow.pl.
86+
You may need to skim vtr_flow/scripts/run_vtr_flow.py.
8787

8888
3. Using the output of ABC, run VPR to complete the mapping of a user circuit
8989
to a target architecture. You may need to consult the VPR User Manual and skim
90-
You may need to skim vtr_flow/scripts/run_vtr_flow.pl.
90+
You may need to skim vtr_flow/scripts/run_vtr_flow.py.
9191

9292
4. Read the VPR section of the online documentation.
9393

doc/src/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import recommonmark
2323

2424
sys.path.append(".")
25+
sys.path.insert(0, os.path.abspath('../../vtr_flow/scripts/python_libs'))
2526
from markdown_code_symlinks import LinkParser, MarkdownSymlinksDomain
2627

2728
# Cool looking ReadTheDocs theme
@@ -58,13 +59,16 @@
5859
'sphinx.ext.todo',
5960
'sphinx.ext.mathjax',
6061
'sphinx.ext.imgmath',
62+
'sphinx.ext.napoleon',
63+
'sphinx.ext.coverage',
6164
'breathe',
6265
'notfound.extension',
6366
'sphinx_markdown_tables',
6467
'sdcdomain',
6568
'archdomain',
6669
'rrgraphdomain',
67-
'recommonmark'
70+
'recommonmark',
71+
'sphinx.ext.autodoc'
6872
]
6973

7074
if have_sphinxcontrib_bibtex:

doc/src/dev/tutorials/new_developer_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Open the Black Box
5757

5858
At this stage, you have gotten a taste of how an FPGA architect would go about using VTR. As a developer though, you need a much deeper understanding of how this tool works. The purpose of this section is to have you to learn the details of the VTR CAD flow by having you manually do what the scripts do.
5959

60-
Using the custom Verilog circuit and architecture created in the previous step, directly run Odin II on it to generate a blif netlist. You may need to skim the ``ODIN_II/README.rst`` and the ``vtr_flow/scripts/run_vtr_flow.pl``.
60+
Using the custom Verilog circuit and architecture created in the previous step, directly run Odin II on it to generate a blif netlist. You may need to skim the ``ODIN_II/README.rst`` and the ``vtr_flow/scripts/run_vtr_flow.py``.
6161

6262
Using the output netlist of Odin II, run ABC to generate a technology-mapped blif file. You may need to skim the ABC homepage (http://www.eecs.berkeley.edu/~alanmi/abc/).
6363

doc/src/tutorials/flow/basic_flow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The following steps show you to run the VTR design flow to map a sample circuit
4646

4747
Some also contain a ``golden_results.txt`` file that is used by the scripts to check for correctness.
4848

49-
The ``vtr_release/vtr_flow/scripts/run_vtr_flow.pl`` script describes the CAD flow employed in the test.
49+
The ``vtr_release/vtr_flow/scripts/run_vtr_flow.py`` script describes the CAD flow employed in the test.
5050
You can modify the flow by editing this script.
5151

5252
At this point, feel free to run any of the tasks pre-pended with "regression".

doc/src/vtr/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ VTR also includes a set of benchmark designs known to work with the design flow.
4949
parse_vtr_task
5050
parse_config
5151
pass_requirements
52+
python_libs/vtr
5253

5354

5455

doc/src/vtr/power_estimation/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ The easiest way to run the VTR flow is to use the :ref:`run_vtr_flow` script.
3333

3434
In order to perform power estimation, you must add the following options:
3535

36-
* :option:`run_vtr_flow.pl -power`
37-
* :option:`run_vtr_flow.pl -cmos_tech` ``<cmos_tech_properties_file>``
36+
* :option:`run_vtr_flow.py -power`
37+
* :option:`run_vtr_flow.py -cmos_tech` ``<cmos_tech_properties_file>``
3838

3939
The CMOS technology properties file is an XML file that contains relevant process-dependent information needed for power estimation.
4040
XML files for 22nm, 45nm, and 130nm PTM models can be found here::

doc/src/vtr/python_libs/vtr.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _python_libs/vtr:
2+
3+
VTR Flow Python library
4+
-----------------------
5+
The VTR flow can be imported and implemented as a python library. Below are the descriptions of the useful functions.
6+
7+
VTR flow
8+
========
9+
.. automodule:: vtr.flow
10+
:members: run
11+
12+
ODIN II
13+
=======
14+
15+
.. automodule:: vtr.odin.odin
16+
:members:
17+
18+
ABC
19+
===
20+
21+
.. automodule:: vtr.abc.abc
22+
:members: run, run_lec
23+
24+
ACE
25+
===
26+
27+
.. automodule:: vtr.ace.ace
28+
:members:
29+
30+
VPR
31+
===
32+
33+
.. automodule:: vtr.vpr.vpr
34+
:members:
35+
36+
.. toctree::
37+
:maxdepth: 2
38+
:caption: Contents:

doc/src/vtr/run_vtr_flow.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ This script runs the VTR flow for a single benchmark circuit and architecture fi
77

88
The script is located at::
99

10-
$VTR_ROOT/vtr_flow/scripts/run_vtr_flow.pl
10+
$VTR_ROOT/vtr_flow/scripts/run_vtr_flow.py
1111

12-
.. program:: run_vtr_flow.pl
12+
.. program:: run_vtr_flow.py
1313

1414
Basic Usage
1515
~~~~~~~~~~~
1616

17-
At a minimum ``run_vtr_flow.pl`` requires two command-line arguments::
17+
At a minimum ``run_vtr_flow.py`` requires two command-line arguments::
1818

19-
run_vtr_flow.pl <circuit_file> <architecture_file>
19+
run_vtr_flow.py <circuit_file> <architecture_file>
2020

2121
where:
2222

@@ -44,20 +44,20 @@ The script will also produce an output files (\*.out) for each stage, containing
4444
Advanced Usage
4545
~~~~~~~~~~~~~~
4646

47-
Additional *optional* command arguments can also be passed to ``run_vtr_flow.pl``::
47+
Additional *optional* command arguments can also be passed to ``run_vtr_flow.py``::
4848

49-
run_vtr_flow.pl <circuit_file> <architecture_file> [<options>] [<vpr_options>]
49+
run_vtr_flow.py <circuit_file> <architecture_file> [<options>] [<vpr_options>]
5050

5151
where:
5252

53-
* ``<options>`` are additional arguments passed to ``run_vtr_flow.pl`` (described below),
54-
* ``<vpr_options>`` are any arguments not recognized by ``run_vtr_flow.pl``. These will be forwarded to VPR.
53+
* ``<options>`` are additional arguments passed to ``run_vtr_flow.py`` (described below),
54+
* ``<vpr_options>`` are any arguments not recognized by ``run_vtr_flow.py``. These will be forwarded to VPR.
5555

5656
For example::
5757

58-
run_vtr_flow.pl my_circuit.v my_arch.xml -track_memory_usage --pack --place
58+
run_vtr_flow.py my_circuit.v my_arch.xml -track_memory_usage --pack --place
5959

60-
will run the VTR flow to map the circuit ``my_circuit.v`` onto the architecture ``my_arch.xml``; the arguments ``--pack`` and ``--place`` will be passed to VPR (since they are unrecognized arguments to ``run_vtr_flow.pl``).
60+
will run the VTR flow to map the circuit ``my_circuit.v`` onto the architecture ``my_arch.xml``; the arguments ``--pack`` and ``--place`` will be passed to VPR (since they are unrecognized arguments to ``run_vtr_flow.py``).
6161
They will cause VPR to perform only :ref:`packing and placement <general_options>`.
6262

6363
Detailed Command-line Options

doc/src/vtr/running_vtr.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The :ref:`run_vtr_flow` script is provided to execute the VTR flow for a single
2424

2525
.. code-block:: none
2626
27-
$VTR_ROOT/vtr_flow/scripts/run_vtr_flow.pl <circuit_file> <architecture_file>
27+
$VTR_ROOT/vtr_flow/scripts/run_vtr_flow.py <circuit_file> <architecture_file>
2828
2929
It requires two arguments:
3030

@@ -41,7 +41,7 @@ Architecture files can be found under::
4141

4242
The script can also be used to run parts of the VTR flow.
4343

44-
.. seealso:: :ref:`run_vtr_flow` for the detailed command line options of ``run_vtr_flow.pl``.
44+
.. seealso:: :ref:`run_vtr_flow` for the detailed command line options of ``run_vtr_flow.py``.
4545

4646

4747
Running Multiple Benchmarks & Architectures with Tasks

run_reg_test.pl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
my $skip_qor = 0;
6666
my $show_failures = 0;
6767
my $num_cpu = 1;
68+
my $script = "run_vtr_flow.py";
6869
my $long_task_names = 0;
6970

7071
# Parse Input Arguments
@@ -87,6 +88,8 @@
8788
$long_task_names = 1;
8889
} elsif ( $token eq "-j" ) { #-j N
8990
$num_cpu = int(shift(@ARGV));
91+
} elsif ( $token eq "-script" ) {
92+
$script = shift(@ARGV);
9093
} elsif ( $token =~ /^-j(\d+)$/ ) { #-jN
9194
$num_cpu = int($1);
9295
} elsif ($token eq "quick_test") {
@@ -337,10 +340,10 @@ sub run_single_test {
337340

338341
print "\nRunning $test\n";
339342
print "-------------------------------------------------------------------------------\n";
340-
print "scripts/run_vtr_task.pl $run_params \n";
343+
print "scripts/run_vtr_task.pl $run_params -script $script \n";
341344
print "\n";
342345
chdir("$vtr_flow_path");
343-
my $test_status = system("scripts/run_vtr_task.pl $run_params \n");
346+
my $test_status = system("scripts/run_vtr_task.pl $run_params -script $script \n");
344347
chdir("..");
345348

346349
#Perl is obtuse, and requires you to manually shift the return value by 8 bits
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
__init__ for the VTR python module
3+
"""
4+
from .util import (
5+
load_config_lines,
6+
find_vtr_file,
7+
CommandRunner,
8+
print_verbose,
9+
relax_w,
10+
file_replace,
11+
RawDefaultHelpFormatter,
12+
VERBOSITY_CHOICES,
13+
format_elapsed_time,
14+
write_tab_delimitted_csv,
15+
load_list_file,
16+
find_vtr_root,
17+
argparse_str2bool,
18+
get_next_run_dir,
19+
get_latest_run_dir,
20+
verify_file,
21+
)
22+
from .inspect import determine_lut_size, determine_min_w, determine_memory_addr_width
23+
#pylint: disable=reimported
24+
from .abc import run, run_lec
25+
from .vpr import run, run_relax_w, cmp_full_vs_incr_sta, run_second_time
26+
from .odin import run
27+
from .ace import run
28+
from .error import *
29+
from .flow import run, VtrStage
30+
#pylint: enable=reimported
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
__init__ for abc module
3+
"""
4+
from .abc import run, run_lec

0 commit comments

Comments
 (0)