UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor cartercheng1
Visitor
528 Views
Registered: ‎09-20-2019

Tcl Command to get the current specified top module name

Jump to solution

Hi, I want to know if any Tcl Command can get the current specified top module name Thanks a lot

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
520 Views
Registered: ‎03-16-2017

Re: Tcl Command to get the current specified top module name

Jump to solution

Hi  @cartercheng1 , 

Try this command    report_property -all [get_filesets sources_1]

And check the TOP property's value. 

Regards,
hemangd

Don't forget to give kudos and mark it as accepted solution if your issue gets resolved.
0 Kudos
7 Replies
Moderator
Moderator
521 Views
Registered: ‎03-16-2017

Re: Tcl Command to get the current specified top module name

Jump to solution

Hi  @cartercheng1 , 

Try this command    report_property -all [get_filesets sources_1]

And check the TOP property's value. 

Regards,
hemangd

Don't forget to give kudos and mark it as accepted solution if your issue gets resolved.
0 Kudos
Observer sarman_1998
Observer
392 Views
Registered: ‎05-16-2018

Re: Tcl Command to get the current specified top module name

Jump to solution

For anyone else who finds this, thanks to @hemangd, I ended up with this command.

get_property TOP [get_filesets sources_1]

Thanks,

Eric

Observer sarman_1998
Observer
369 Views
Registered: ‎05-16-2018

Re: Tcl Command to get the current specified top module name

Jump to solution

And then I tried to use this in a tcl.post hook script.....

After some debugging, the TOP property is empty when get_property or report_property are run in the hook script.  I did some googling and am guessing this has something to do with project vs non-project mode but I haven't found a workaround.

@hemangd any suggestions?

0 Kudos
Moderator
Moderator
361 Views
Registered: ‎03-16-2017

Re: Tcl Command to get the current specified top module name

Jump to solution

Hi @sarman_1998

Can you try with tcl.post hook script of opt_design and check?

Regards,
hemangd

Don't forget to give kudos and mark it as accepted solution if your issue gets resolved.
Observer sarman_1998
Observer
350 Views
Registered: ‎05-16-2018

Re: Tcl Command to get the current specified top module name

Jump to solution

Hi @hemangd 

Things are getting stranger!

When I was testing this script i was using the following steps in the vivado GUI

  1. Reset implementation to previous step.  To go back from write_bitstream step.
  2. Change script file.
  3. run Generate Bitstream.

Using those steps, the TOP property was blank when the hook script ran.

However, when i run the full implentation, TOP is defined properly when the script runs, both at opt_design and also at write_bitstream.

Any ideas why the behavior is inconsistant?

Thanks,

   Eric

 

0 Kudos
Highlighted
Historian
Historian
344 Views
Registered: ‎01-23-2009

Re: Tcl Command to get the current specified top module name

Jump to solution

What are you trying to accomplish?

The concept of "filesets" doesn't exist (or at least doesn't consistently exist) at the level of the hook scripts; the filesets are part of the project management system, which only exists in the foreground process; the hook scripts run in the background processes in non-project mode (where the filesets no longer exist). There may be some exception when you run synthesis, since synthesis is a bit different.

But even if it does work in some cases, it is not "legal" and the behavior could change from version to version.

However, I do believe "current_design" does exist at the non-project/hook script level, so

get_property TOP [current_design]

might work...

Avrum

Observer sarman_1998
Observer
334 Views
Registered: ‎05-16-2018

Re: Tcl Command to get the current specified top module name

Jump to solution

Thanks @avrumw 

get_property TOP [current_design]

Works.  

To answer your question I was trying to update the script to write the MCS after bitgen so that I didn't have to modify it with the top module name for each FPGA project.   For anyone interested, this is what I ended up with.

set top_name [get_property TOP [current_design]]
set up_list [list up 0x000000 [format "%s%s" $top_name ".bit" ]]
write_cfgmem  -format mcs -size 16 -interface SPIx4 -loadbit $up_list -force -file $top_name

There is probably a more eligant way to handle the options to -loadbit but my TCL skills are very rusty.

Thanks to @hemangd  also for their help.

Eric

0 Kudos