cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ronnywebers
Advisor
Advisor
317 Views
Registered: ‎10-10-2014

how to detect wether an IP is already instantiated or not during the creation of a design using tcl?

Jump to solution

I use different tcl (sub)scripts to create a project and bd.

For example I have a subscript that creates/instantiates the Zynq MPSoC IP on the bd, and then applies a saved configuration to it (preset)

I have 2 situations with my scripts:

* situation 1 : there is no / not yet a Zynq UltraScale+ MPSoC IP present in the bd, so the script needs to add the MPSoC IP to the bd (create cell ...), and then apply the preset / configuration

* situation 2 : at the point where my subscript kicks in, there is already a Zynq MPSoC IP present in the bd (and I cannot put 2 of them on the BD of course), so I should not add the IP (skipp the create cell ...), but just apply the MPSoC preset

Q1: how can I detect the presence of the MPSoC IP (or more general, of 'any' IP)?

So in pseudo code something like :

 

if (MPSoC IP) != present_in_bd:
   create_bd_cell -type ip -vlnv xilinx.com:ip:zynq_ultra_ps_e:3.2 zynq_ultra_ps_e_0

config_mpsoc_ip with preset.tcl

 

 

image.png

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
1 Solution

Accepted Solutions
florentw
Moderator
Moderator
287 Views
Registered: ‎11-09-2015

HI @ronnywebers 

As mentioned by @amaccre , I guess one way to go is to use the get_ips command and check the length of the string array returned

Based on the other topic for the config of the ZynqMP:

source ./zynqMP_config.tcl
[...]
if {[llength [get_ips -quiet *zynq_ultra*]] != 1} {
	create_bd_cell -type ip -vlnv xilinx.com:ip:zynq_ultra_ps_e:3.3 zynq_ultra_ps_e_0
}
set_property -dict [concat [apply_preset [get_bd_cells zynq_ultra_ps_e_0]]] [get_bd_cells zynq_ultra_ps_e_0]

Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**

View solution in original post

6 Replies
amaccre
Moderator
Moderator
300 Views
Registered: ‎04-24-2013

Hi @ronnywebers ,

 

Are you looking for the get_ips tcl command that will list the IPs added to a project? If more particularly the IP added to a block design then the get_bd_cells tcl command will list the cells in a block design.

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
------------------------------------------------------------------------------------------------------------------
florentw
Moderator
Moderator
288 Views
Registered: ‎11-09-2015

HI @ronnywebers 

As mentioned by @amaccre , I guess one way to go is to use the get_ips command and check the length of the string array returned

Based on the other topic for the config of the ZynqMP:

source ./zynqMP_config.tcl
[...]
if {[llength [get_ips -quiet *zynq_ultra*]] != 1} {
	create_bd_cell -type ip -vlnv xilinx.com:ip:zynq_ultra_ps_e:3.3 zynq_ultra_ps_e_0
}
set_property -dict [concat [apply_preset [get_bd_cells zynq_ultra_ps_e_0]]] [get_bd_cells zynq_ultra_ps_e_0]

Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**

View solution in original post

ronnywebers
Advisor
Advisor
265 Views
Registered: ‎10-10-2014

Thanks @florentw (and @amaccre ) that's what I'm looking for ... now wondering about 2 more details :

1) in my case the *zynq_ultra* was renamed by another script to 'mpsoc' ... would it be an option to scan for the vlnv 'xilinx.com:ip:zynq_ultra_ps_e'?

2) I should probably check the IP version before applying the preset ... or that's probably tackled if I check against the expected vivado version at the very beginning of my script ...?

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
florentw
Moderator
Moderator
192 Views
Registered: ‎11-09-2015

Hi @ronnywebers 

I would not really recommend you to do scripts too complicated checking every cases. If there is another script which is calling the IP mpsoc then this name should probably be passed to a following script. Because the more you add conditions, the more chances you can make it fail.

With that said, you can get the IPDEF property to get the IP name (and not the instance name). You will be able to do the same for the version if this is needed:

set zynqMP_IP ""

set my_ips [get_ips *]

foreach my_ip $my_ips {
      set ip_def [lindex [split [get_property IPDEF $my_ip] ":"] 2]
      if { $ip_def eq "zynq_ultra_ps_e" } {
         set zynqMP_IP $my_ip
      }
}

if { ${zynqMP_IP} eq "" } {
	set zynqMP_IP [create_bd_cell -type ip -vlnv xilinx.com:ip:zynq_ultra_ps_e:3.3 zynq_ultra_ps_e_0]
}

set_property -dict [concat [apply_preset $zynqMP_IP]] $zynqMP_IP

Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
ronnywebers
Advisor
Advisor
164 Views
Registered: ‎10-10-2014

guess you're right about passing the name from the calling script ... but I learned a lot from the above, useful stuff, so thanks a lot!

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
florentw
Moderator
Moderator
131 Views
Registered: ‎11-09-2015

HI @ronnywebers 

but I learned a lot from the above, useful stuff, so thanks a lot!

That was fun for me to look at as well. But I guess I need to go back to my main activity now haha


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**