cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Akhil_Kodari
Visitor
Visitor
439 Views
Registered: ‎03-02-2021

Run tcl commands in vivado TCL chell using python

Hi,

I'm trying to automate resetting FPGA using python through TCL commands. Started vivado in TCL mode and gave tcl file as source to load bit file. After loading bit file again I want to run tcl file which has commands to reset FPGA. Please address how to do this.

python code snippet:

import os

import tkinter

r=tkinter.Tcl()
os.system('vivado -mode tcl tcl_file.tcl')

r.eval('source reset.tcl')

 

Here I used tkinter module to use tcl shell in python, but this is not working the way it is expected.

 

0 Kudos
4 Replies
jbeckwi
Xilinx Employee
Xilinx Employee
400 Views
Registered: ‎08-30-2011

You need to make sure to specify -source when you call the TCL script.  Without '-source' Vivado is launching in TCL mode but expecting a project with an .xpr file extension.

Jon

0 Kudos
Akhil_Kodari
Visitor
Visitor
383 Views
Registered: ‎03-02-2021

Sorry, that's a typo, my system call has '-source'.

os.system('vivado -mode tcl -source tcl_file.tcl')

 

0 Kudos
richardhead
Scholar
Scholar
375 Views
Registered: ‎08-01-2012

tcl mode is meant as interactive tcl mode. Is there any reason you're not using batch mode?

0 Kudos
Akhil_Kodari
Visitor
Visitor
305 Views
Registered: ‎03-02-2021

When working in batch mode, the Vivado tools exit after running the specified script, but I still need Vivado to run after script execution.

0 Kudos