Run Quartus II fitter and TimeQuest Timing Analyzer sweeping a list of fitter seed numbers automatically

This Tcl script will help you can to run Quartus II fitter seed sweep without the help of Design Space Explorer. Running fitter seeds sweeping without Design Space Explorer is always a pain in the ass. You have to manually change the seed number, run fitter, run STA and record down the Static Timing Analysis results for comparison later. And if you have 10 seeds to sweep, you will have to re do it again for nine more times.

This is a Quartus II Tcl script that automates it.

Steps

  1. Copy and paste the Tcl code example into a text editor. 
  2. Change the "top" design name according to the Quartus II design name.
  3. Save the text file as Tcl script with ".tcl" as extension.

Example Tcl code

# This tcl is used to sweep seed by running fitter and STA, the timing report will be stored in seed_rpt directory
load_package flow
load_package report
# Specify project name and revision name
set project_name top
set project_revision top
# Set seeds
set seedList {1 2 3 4 5 6 7 8 9 10}
set timetrynum [llength $seedList]
puts "Total compiles: $timetrynum"
project_open -revision $project_revision $project_name
# Specify seed compile report directory
set rptdir seed_rpt
file mkdir $rptdir
set trynum 0
while { $timetrynum > $trynum } {
set current_seed [lindex $seedList $trynum]
set_global_assignment -name SEED $current_seed
# Place & Route
if {[catch {execute_module -tool fit} result]} {
puts "\nResult: $result\n"
puts "ERROR: Quartus II Fitter failed. See the report file.\n"
qexit -error
} else {
puts "\nInfo: Quartus II Fitter was successful.\n"
}
# TimeQuest Timing Analyzer
if {[catch {execute_module -tool sta} result]} {
puts "\nResult: $result\n"
puts "ERROR: TimeQuest Analyzer failed. See the report file.\n"
qexit -error
} else {
puts "\nInfo: TimeQuest Analyzer was successful.\n"
}
# Store compile results
#file copy -force ./$project_revision.fit.rpt $rptdir/seed$current_seed.fit.rpt
#file copy -force ./$project_revision.sta.rpt $rptdir/seed$current_seed.sta.rpt
load_report
set panel {TimeQuest Timing Analyzer||Multicorner Timing Analysis Summary}
set id [get_report_panel_id $panel]
if {$id != -1} {
    write_report_panel -file $rptdir/Multicorner_sta_seed$current_seed.htm -html -id $id
} else {
    puts "Error: report panel could not be found."
}
unload_report
incr trynum
}
project_close

Command line usage

quartus_sh -t script.tcl

Comments

Popular posts from this blog