Search code examples
tclxilinxvivado

Handle implementation error with Vivado TCL


I have several implementation (each with a different strategy) and I automate running them in Vivado with the following script:

reset_run synth_1

launch_runs synth_1 -jobs 16
wait_on_runs synth_1

# Run all implementations
launch_runs impl_1 -jobs 16
launch_runs impl_2 -jobs 16
launch_runs impl_3 -jobs 16
launch_runs impl_4 -jobs 16
launch_runs impl_5 -jobs 16
launch_runs impl_6 -jobs 16

However sometimes one of them fails (low memory or bug in the tools, this is known) and I would like to catch it and do something, maybe try running it again or stop the next steps (for instance if implementation has failed I don't want to export the hardware, because it would lead to another error because it can't find the bitstream).

Do you know how can I catch this problem within my tcl script?


Solution

  • I have found a solution, but for some reason the result is not among the first ones when googling for words like "vivado catch run failure" and similar, so I'll post an answer:

    Based on this Answer Record we can do:

    set isAllOk false
    
    set outputOfSynthRun [launch_runs synth_1]
    
    set runStatus [get_property STATUS [get_runs synth_1]
    
    set runProgress [get_property PROGRESS [get_runs synth_1\\]]
    
    if { $outputOfSynthRun == 0 && $runStatus == "XST Complete!" && $runProgress == "100%"} {
    
    set isAllOk true
    
    } else {
    
    set isAllOk false
    
    }