VTR Flow Python library

The VTR flow can be imported and implemented as a python library. Below are the descriptions of the useful functions.

VTR flow

Module to run the VTR flow. This module calls other modules that then access the tools like VPR.

vtr.flow.run(architecture_file, circuit_file, power_tech_file=None, include_files=None, start_stage=VtrStage.PARMYS, end_stage=VtrStage.VPR, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('temp'), odin_args=None, parmys_args=None, abc_args=None, vpr_args=None, keep_intermediate_files=True, keep_result_files=True, odin_config=None, yosys_script=None, min_hard_mult_size=3, min_hard_adder_size=1, check_equivalent=False, check_incremental_sta_consistency=False, use_old_abc_script=False, relax_w_factor=1.3, check_route=False, check_place=False, no_second_run=False)

Runs the VTR CAD flow to map the specified circuit_file onto the target architecture_file

Note

Usage: vtr.run(<architecture_file>,<circuit_file>,[OPTIONS])

Parameters:
  • architecture_file – Architecture file to target

  • circuit_file – Circuit to implement

  • power_tech_file – Technology power file. Enables power analysis and runs ace

  • start_stage – Stage of the flow to start at

  • end_stage – Stage of the flow to finish at

  • temp_dir – Directory to run in (created if non-existent)

  • command_runner – A CommandRunner object used to run system commands

  • verbosity – whether to output error description or not

  • odin_args – A dictionary of keyword arguments to pass on to ODIN II

  • abc_args – A dictionary of keyword arguments to pass on to ABC

  • vpr_args – A dictionary of keyword arguments to pass on to VPR

  • keep_intermediate_files – Determines if intermediate files are kept or deleted

  • keep_result_files – Determines if the result files are kept or deleted

  • min_hard_mult_size – Tells PARMYS/ODIN II the minimum multiplier size that should be implemented using hard multiplier (if available)

  • min_hard_adder_size – Tells PARMYS/ODIN II the minimum adder size that should be implemented using hard adder (if available).

  • check_equivalent – Enables Logical Equivalence Checks

  • use_old_abc_script – Enables the use of the old ABC script

  • relax_w_factor – Factor by which to relax minimum channel width for critical path delay routing

  • check_incremental_sta_consistency – Do a second-run of the incremental analysis to compare the result files

  • check_route – Check first placement and routing by enabling VPR analysis

  • check_place – Route existing placement by enabling VPR routing.

  • no_second_run – Don’t run VPR again even if it’s writing out some intermediate files.

Parmys

Module to run Parmys with its various arguments

vtr.parmys.parmys.create_circuits_list(main_circuit, include_files)

Create a list of supported HDL files

vtr.parmys.parmys.init_config_file(odin_config_full_path, circuit_list, architecture_file, output_netlist, memory_addr_width, min_hard_mult_size, min_hard_adder_size)

initializing the raw xml config file

vtr.parmys.parmys.init_script_file(yosys_script_full_path, circuit_list, output_netlist, architecture_file_path, odin_config_full_path)

initializing the raw yosys script file

vtr.parmys.parmys.run(architecture_file, circuit_file, include_files, output_netlist, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), parmys_args='', log_filename='parmys.out', yosys_exec=None, yosys_script=None, min_hard_mult_size=3, min_hard_adder_size=1)

Runs Yosys on the specified architecture file and circuit

Note

Usage: vtr.parmys.run(<architecture_file>,<circuit_file>,<output_netlist>,[OPTIONS])

Parameters:
  • architecture_file – Architecture file to target

  • circuit_file – Circuit file to optimize

  • include_files – list of header files

  • output_netlist – File name to output the resulting circuit to

  • command_runner – A CommandRunner object used to run system commands

  • temp_dir – Directory to run in (created if non-existent)

  • parmys_args – A dictionary of keyword arguments to pass on to Parmys

  • log_filename – File to log result to

  • yosys_exec – Yosys executable to be run

  • yosys_script – The Yosys script file

ODIN II

Module to run ODIN II with its various arguments

vtr.odin.odin.create_circuits_list(main_circuit, include_files)

Create a list of all (.v) and (.vh) files

vtr.odin.odin.init_config_file(odin_config_full_path, circuit_list, architecture_file, output_netlist, odin_parser_arg, memory_addr_width, min_hard_mult_size, min_hard_adder_size)

initializing the raw odin config file

vtr.odin.odin.run(architecture_file, circuit_file, include_files, output_netlist, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), odin_args='--adder_type default', log_filename='odin.out', odin_exec=None, odin_config=None, min_hard_mult_size=3, min_hard_adder_size=1)

Runs ODIN II on the specified architecture file and circuit file

Note

Usage: vtr.odin.run(<architecture_file>,<circuit_file>,<output_netlist>,[OPTIONS])

Parameters:
  • architecture_file – Architecture file to target

  • circuit_file – Circuit file to optimize

  • include_files – list of header files

  • output_netlist – File name to output the resulting circuit to

  • command_runner – A CommandRunner object used to run system commands

  • temp_dir – Directory to run in (created if non-existent)

  • odin_args – A dictionary of keyword arguments to pass on to ODIN II

  • log_filename – File to log result to

  • odin_exec – ODIN II executable to be run

  • odin_config – The ODIN II configuration file

  • min_hard_mult_size – Tells ODIN II the minimum multiplier size that should be implemented using hard multiplier (if available)

  • min_hard_adder_size – Tells ODIN II the minimum adder size that should be implemented using hard adder (if available).

ABC

Module to run ABC with its various options

vtr.abc.abc.run(architecture_file, circuit_file, output_netlist, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), log_filename='abc.out', abc_exec=None, abc_script=None, abc_rc=None, use_old_abc_script=False, abc_args=None, keep_intermediate_files=True)

Runs ABC to optimize specified file.

Note

Usage: vtr.abc.run(<architecture_file>,<circuit_file>,<output_netlist>,[OPTIONS])

Parameters:
  • architecture_file – Architecture file to target

  • circuit_file – Circuit file to optimize

  • output_netlist – File name to output the resulting circuit to

  • command_runner – A CommandRunner object used to run system commands

  • temp_dir – Directory to run in (created if non-existent)

  • log_filename – File to log result to

  • abc_exec – ABC executable to be run

  • abc_script – The script to be run on abc

  • abc_rc – The ABC rc file

  • use_old_abc_script – Enables the use of the old ABC script

  • abc_args – A dictionary of keyword arguments to pass on to ABC

  • keep_intermediate_files – Determines if intermediate files are kept or deleted

vtr.abc.abc.run_lec(reference_netlist, implementation_netlist, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), log_filename='abc.lec.out', abc_exec=None)

Run Logical Equivalence Checking (LEC) between two netlists using ABC

Note

Usage: vtr.abc.run_lec(<reference_netlist>,<implementation_netlist>,[OPTIONS])

Parameters:
  • reference_netlist – The reference netlist to be commpared to

  • implementation_netlist – The implemeted netlist to compare to the reference netlist

  • command_runner – A CommandRunner object used to run system commands

  • temp_dir – Directory to run in (created if non-existent)

  • log_filename – File to log result to

  • abc_exec – ABC executable to be run

ACE

Module to run ACE with its various options

vtr.ace.ace.run(circuit_file, old_netlist, output_netlist, output_activity_file, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), log_filename='ace.out', ace_exec=None, ace_seed=1)

Runs ACE for activity estimation

Note

Usage: vtr.ace.run(<circuit_file>,<output_netlist>,<output_activity_file>,[OPTIONS])

Parameters:
  • circuit_file – Circuit file to optimize

  • old_netlist – netlist to be anylized

  • output_netlist – File name to output the resulting circuit to

  • output_activity_file – The output activity file

  • command_runner – A CommandRunner object used to run system commands

  • temp_dir – Directory to run in (created if non-existent)

  • log_filename – File to log result to

  • ace_exec – ACE executable to be run

  • ace_seed – The ACE seed

VPR

Module to interact with VPR and its various options

vtr.vpr.vpr.cmp_full_vs_incr_sta(architecture, circuit, circuit_name=None, command_runner=<vtr.util.CommandRunner object>, vpr_args=None, temp_dir=PosixPath('.'), vpr_exec=None)

Sanity check that full STA and the incremental STA produce the same *.net, *.place, *.route files as well as identical timing report files

Note

Use: vtr.vpr.cmp_full_vs_incr_sta(<architecture>,<circuit_name>,<circuit>,[OPTIONS])

Parameters:
  • architecture – Architecture file

  • circuit – Input circuit file

  • circuit_name – Name of the circuit file

  • command_runner – CommandRunner object

  • temp_dir – Directory to run in

  • vpr_exec – Path to the VPR executable

  • vpr_args – Extra arguments for VPR

vtr.vpr.vpr.run(architecture, circuit, circuit_name=None, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), log_filename='vpr.out', vpr_exec=None, vpr_args=None)

Runs VPR with the specified configuration

Note

Usage: vtr.vpr.run(<architecture>,<circuit>,[OPTIONS])

Parameters:
  • architecture – Architecture file

  • circuit – Input circuit file

  • circuit_name – Name of the circuit file

  • command_runner – CommandRunner object

  • temp_dir – Directory to run in

  • log_filename – File to log result to

  • vpr_exec – Path to the VPR executable

  • vpr_args – Extra arguments for VPR

vtr.vpr.vpr.run_relax_w(architecture, circuit, circuit_name=None, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), relax_w_factor=1.3, vpr_exec=None, logfile_base='vpr', vpr_args=None)

Runs VPR twice:

1st: To find the minimum channel width

2nd: At relaxed channel width (e.g. for critical path delay)

Note

Use: vtr.vpr.run_relax_w(<architecture_file>,<circuit_file>,[OPTIONS])

Parameters:
  • architecture – Architecture file

  • circuit – Input circuit netlist

  • circuit_name – Name of the circuit file

  • command_runner – CommandRunner object

  • temp_dir – Directory to run in

  • relax_w_factor – Factor by which to relax minimum channel width for critical path delay routing

  • vpr_exec – Path to the VPR executable

  • logfile_base – Base name for log files (e.g. “vpr” produces vpr.out, vpr.crit_path.out)

  • vpr_args – Extra arguments for VPR

vtr.vpr.vpr.run_second_time(architecture, circuit, circuit_name=None, command_runner=<vtr.util.CommandRunner object>, temp_dir=PosixPath('.'), vpr_exec=None, second_run_args=None, rr_graph_ext='.xml')

Run vpr again with additional parameters. This is used to ensure that files generated by VPR can be re-loaded by it

Note

Usage: vtr.vpr.run_second_time(<architecture>,<circuit>,[OPTIONS])

Parameters:
  • architecture – Architecture file

  • circuit – Input circuit file

  • circuit_name – Name of the circuit file

  • command_runner – CommandRunner object

  • temp_dir – Directory to run in

  • log_filename – File to log result to

  • vpr_exec – Path to the VPR executable

  • second_run_args – Extra arguments for VPR