cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
marvinscheinbart
Explorer
Explorer
2,551 Views
Registered: ‎05-09-2014

tcl command line arguments

Jump to solution

All:

 

     I'm writing a post Bitgen TCL script and I've run into a problem.  If I type 'current_run -implementation' on the TCL Console I get impl_8 which is correct.  In my TCL script if I run the command 'set imp_dir [current_run -implementation]' it always comes back with a value of impl_1.  There seems to be a disconnect between the commands run at the TCL Console and the TCL script I'm writting.

 

     How do I get my Post Bitgen TCL script to retrieve the correct implementation.  The TCL script is being run as a tcl.post script from the Project Setting > Bitstream menu.

0 Kudos
1 Solution

Accepted Solutions
marvinscheinbart
Explorer
Explorer
3,051 Views
Registered: ‎05-09-2014

Avrumw:

 

     I understand why thing didn't work the way I wanted.  As mentioned in my previous post, at the end of the implementation phase, my working directory is the directory of my active implementation.  By parsing this directory string I can extract out the implementation name.  This gives me what I want/need.

 

     As far as the number of implementations, each implementation is associated with a person on the project.  IMPL_8 is the top level implementation were all the code comes together for a complete FPGA.  I didn't think very deeply about the best way to do this but it works, I moved on.

 

     Thanks for your help,

 

      Marv

 

View solution in original post

0 Kudos
7 Replies
jmcclusk
Mentor
Mentor
2,549 Views
Registered: ‎02-24-2014

impl_8 may not even be available in the context of your script..   What happens when you run this in the script?

 

puts [get_runs ]      

 

does it succeed it show impl_8 in the list?

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
marvinscheinbart
Explorer
Explorer
2,537 Views
Registered: ‎05-09-2014

jmcclusk:

 

     Thanks for trying to help.

 

     if I type get_runs from the TCL console I get impl_8 as one of the entries printed to the screen.

 

     If I type current_run - implementation from the TCL console I get impl_8.

 

     When my TCL script starts I print the current working directory, it print the path to impl_8.

 

     I used the following commands to get the information you requested.  I got no results back from the get_runs command.  The only text printed was "My valid runs: ".  I assume get_runs returned nothing.

 

            set runs [get_runs]
            set print_runs [concat "My valid runs: $runs"]
            puts $print_runs

 

     Within my TCL script current_runs - implementation always returns impl_1.

 

         Marv

 

    

0 Kudos
prathikm
Moderator
Moderator
2,515 Views
Registered: ‎09-15-2016

Hi @marvinscheinbart,


If current_run -implementation in console returns impl_8 this should mean this is the active run and then set imp_dir [current_run -implementation] in console should return same. The set runs [get_runs] should return all the runs created in project.

Does current_run [get_runs impl_8] give error? Share script and scenario with community if possible for further debug.

 

Regards,
Prathik
-----------------------------------------------------------------------------------------------
Please mark the appropriate post as an answer "Accept as solution" in case it helps to resolve your query.
Give Kudos to a post which you think is helpful and reply oriented.
-----------------------------------------------------------------------------------------------

0 Kudos
avrumw
Guide
Guide
2,508 Views
Registered: ‎01-23-2009

Take a look at this post on the tcl.pre and tcl.post scripts.

 

The "get_runs" command is interacting with the project management environment and database that exists in the foreground Vivado process. When the foreground Vivado process spawns the background non-project Vivado processes that actually run commands (which is where the pre.tcl and post.tcl are run), there is no project manager, and hence these commands don't work...

 

Avrum

marvinscheinbart
Explorer
Explorer
2,487 Views
Registered: ‎05-09-2014

Avrunw

 

      I read the information presented in the post you mentioned and I have the same problem.  My hook script is not attached to a project so commands such as "current_runs -implementation" will not work.  There is a workaround for what I want to do.  At the start of the Bitgen post.tcl  script the location of my current working directory is in my currently active implementation (i.e., impl_8).  I could parse this path and extract the impl_8 part of the path.  This will give me the information I need.

 

     Below I've listed the TCL script I've been trying to get to work.  I've been stuck on getting the name of the currently active implementation.  I've tried multiple ways to try to get the information I want without success.  I'll move on to my workaround unless you have a better idea.

 

     Thanks,

 

        Marv

 

set cur_dir [pwd]
set new_output [concat "My Current Work Directory: $cur_dir"]
puts $new_output

puts "current run is   : [current_run]"

set runs [get_runs]
set print_runs [concat "My valid runs: $runs"]
puts $print_runs

set imp_dir [current_run -implementation]
set new_output [concat "Implementation (TCL): $imp_dir"]
puts $new_output

0 Kudos
avrumw
Guide
Guide
2,476 Views
Registered: ‎01-23-2009

I've tried multiple ways to try to get the information I want without success.

 

As far as I know, nothing will really give you the implementation name - it simply does not exist in the scope of the non-project run where the tcl.pre/tcl.post scripts run.

 

In the scope of the tcl.pre/tcl.post, you are running in non-project mode in a directory set by the script that is generated and launched by the foreground process. That's pretty much it. The directory is the correct directory for executing the script to do the operation, so is the directory that contains the data generated for the run you are working on. If the name of the directory is the same as the name of the run (and it is by default) then that is the "closest" you can get to getting the name of the run.

 

But again, this non-project scope is not the same as your main project scope - the things you can do in it are different; in some ways more powerful, in some ways less so, and in some ways just different. You need to be sure that what you are trying to do in this script

  - can be done - you can't alter the "project management" state of the project - it doesn't exist in this scope

  - is done in a non-project way (not a project way)

  - does not invalidate the run - for example, deleting or modifying any file tracked by the project management capabilities will result in the run being declared "out of date"

 

The only meaningful thing that I have seen be done at the bitgen level is copying the resulting bitfile to one with a different name - potentially one outside the project structure.

 

I also have to ask - why do you have 8 implementations? This is pretty odd...

 

Avrum

marvinscheinbart
Explorer
Explorer
3,052 Views
Registered: ‎05-09-2014

Avrumw:

 

     I understand why thing didn't work the way I wanted.  As mentioned in my previous post, at the end of the implementation phase, my working directory is the directory of my active implementation.  By parsing this directory string I can extract out the implementation name.  This gives me what I want/need.

 

     As far as the number of implementations, each implementation is associated with a person on the project.  IMPL_8 is the top level implementation were all the code comes together for a complete FPGA.  I didn't think very deeply about the best way to do this but it works, I moved on.

 

     Thanks for your help,

 

      Marv

 

View solution in original post

0 Kudos