Intel® Quartus® Prime Pro Edition User Guide: Scripting

ID 683432
Date 6/20/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

2.5. Automating Script Execution

You can configure scripts to run automatically at various points during compilation. Use this capability to automatically run scripts that perform custom reporting, make specific assignments, and perform many other tasks.

The following three global assignments control when a script is run automatically:

  • PRE_FLOW_SCRIPT_FILE —before a flow starts
  • POST_MODULE_SCRIPT_FILE —after a module finishes
  • POST_FLOW_SCRIPT_FILE —after a flow finishes

A module is another term for an Intel® Quartus® Prime executable that performs one step in a flow. For example, two modules are Analysis and Synthesis (quartus_syn), and timing analysis (quartus_sta).

A flow is a series of modules that the Intel® Quartus® Prime software runs with predefined options. For example, compiling a design is a flow that typically consists of the following steps (performed by the indicated module):

  1. Analysis and Synthesis (quartus_syn)
  2. Fitter (quartus_fit)
  3. Assembler (quartus_asm)
  4. Timing Analyzer (quartus_sta)

Other flows are described in the help for the execute_flow Tcl command. In addition, many commands in the Processing menu of the Intel® Quartus® Prime GUI correspond to this design flow.

To make an assignment automatically run a script, add an assignment with the following form to the .qsf for your project:

set_global_assignment -name <assignment name> <executable>:<script name>

The Intel® Quartus® Prime software runs the scripts.

<executable> -t <script name> <flow or module name> <project name> <revision name>

The first argument passed in the argv variable (or quartus(args) variable) is the name of the flow or module being executed, depending on the assignment you use. The second argument is the name of the project and the third argument is the name of the revision.

The last process, current project, and current revision are passed to the script by the Intel® Quartus® Prime software and can be accessed by the following commands:
set process  [lindex $quartus(args) 0]
set project  [lindex $quartus(args) 1]
set revision [lindex $quartus(args) 2]

project_open $project -revision $revision

When you use the POST_MODULE_SCRIPT_FILE assignment, the specified script is automatically run after every executable in a flow. You can use a string comparison with the module name (the first argument passed in to the script) to isolate script processing to certain modules.