cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tnjames
Observer
Observer
267 Views
Registered: ‎07-08-2013

How to test whether Vivado is running in batch or project mode using TCL?

Jump to solution

We use Vivado in both project or batch modes and in both modes use TCL scripts to automate the process of adding design files and/or running through the build process.  I have a small number of scripts that define reusable procedures and typically a separate script for each library to add all the design files.  In some circumstances, eg, when adding IP cores, I want the behaviour when running in batch mode to be different to when running in project mode.  In principal this seems to be something that should be very straightforward, eg, if { [get_vivado_mode] eq "project" } { do_this} else {do_that } however I cannot find any documented method of determining the current vivado operating mode from within a TCL script/procedure.  Surely this is possible?  I had thought of trying to check whether current_project succeeds or fails however even in batch mode there are several operations that create a project, eg, calling set_part or synth_ip, so this approach isn't reliable.  Any pointers/suggestions welcome.

Thanks in advance.

Tim

0 Kudos
1 Solution

Accepted Solutions
amaccre
Moderator
Moderator
163 Views
Registered: ‎04-24-2013

Hi @tnjames ,

$rdi::mode should return one of following depending on how Vivado was started.

gui
batch
tcl

You can also include it in a custom proc to make it more readable:

proc launch_mode {} {
puts $rdi::mode
}

Best Regards
Aidan

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
amaccre
Moderator
Moderator
164 Views
Registered: ‎04-24-2013

Hi @tnjames ,

$rdi::mode should return one of following depending on how Vivado was started.

gui
batch
tcl

You can also include it in a custom proc to make it more readable:

proc launch_mode {} {
puts $rdi::mode
}

Best Regards
Aidan

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

View solution in original post