Skip to content

Creating Tcl Scripts

InTime provides Tcl commands for users to optimize designs via scripts.

Getting Started - Project Mode

Here is a sample InTime Tcl script.

# Sample script for InTime Optimization.
# Adjust the run_target, runs_per_round and round variables according to your recipe
flow reset
flow set run_target local
flow set runs_per_round 40
flow set rounds 1
flow set concurrent_runs 10
flow set control_create_bitstreams false
flow load_recipe "hot_start"
flow run_recipe "hot_start"

Run Target for a Server Farm / Grid

If you set up InTime to distribute compilations to a server farm, use "flow set run_target private_cloud" instead.

Assuming you have saved the above as intimeflow.tcl To run InTime in commandline mode, execute the following command:

<InTime installation dir>/intime.sh -mode batch -platform minimal -project <your DCP/QPF/PRJX/Tcl/XPR file> -vendor_toolchain <libero/quartusii/quartuspp/vivado> -vendor_toolchain_version <e.g. 20.1.0/2019.1.0> -s intimeflow.tcl

Explanation:

-mode batch: Run in batch mode
-platform minimal: Run in non-GUI mode
-project: The project to open
-vendor_toolchain: Name of the FPGA tool e.g. vivado
-vendor_toolchain_version: E.g. 2019.1.0
-s <Tcl script>: Tcl script to execute

Getting Started - Non-project mode (Vivado)

Here is a sample project used to demonstrate how to use InTime in non-project mode. The Tcl file is a typical build script which reads in a list of files.

# 
# Synthesis run script generated by Vivado
# 
read_verilog {
  alu.v
  data_mux.v
  ins_decode.v
  ins_rom.v
  io.v
  prgm_cntr.v
  reg_file.v
  spcl_regs.v
  eight_bit_uc.v
}
read_xdc eight_bit_uc.sdc
After that it executes the specified compilation steps. Note that in this case the "top" and "part" variables are specified
synth_design -top eight_bit_uc -part xc7k70tfbg484-2

write_checkpoint -force -noxdef eight_bit_uc_synth.dcp

set rc [catch {
  opt_design 
  write_checkpoint -force eight_bit_uc_opt.dcp
} RESULT]
if {$rc} {
  return -code error $RESULT
}

...
...

To use this build script, save it and treat it like a project file. Assuming you have saved the above project as nonproj.tcl, execute the following command:

<InTime installation dir>/intime.sh -mode batch -platform minimal -project nonproj.tcl -vendor_toolchain vivado -vendor_toolchain_version <e.g. 2020.1.0> -s intimeflow.tcl

Checking Results

After running a recipe using the previous examples, the next step is to check the results. Here are sample InTime Tcl commands that retrieve results in various levels of detail.

To see if there was any error:

flow recipe errors

For a detailed look at the results:

# Clear the active results set
results clear
# Add all results of the completed recipe
foreach recipe_job_id [split [flow recipe job_ids] ,] {
    results add job $recipe_job_id
}

# See a quick summary
results summary
# Get the top 10 results in terms of TNS into a list
set resultsList [results summary top10 -list -all_types -metric wns -id]
# Returns a Tcl list like this: "2:hotstart_001" "1:eight_bit_uc_nonproj" "1:placement_1" "2:placement_1"

# Start examining the best result
strategy set_active hotstart_001 2
# Print the TNS
strategy results -field "TNS"
# Print the WNS
strategy results -field "Worst Setup"
# Print the logic utilization
strategy results -field "Area"

Retrieve all results of the current project

Use "results add all" to load all the results generated for the current project.

For more sample designs and explanation, please refer to our github.

Advanced Scripting

To learn how to automate multiple recipes in InTime, refer to this link.

Tcl Reference

For the full list of Tcl commands, please refer to the Tcl Reference