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: 
Contributor
Contributor
8,039 Views
Registered: ‎12-29-2013

$readmemh in IP stops working when IP is used in other IP

Jump to solution

IPs with data files for $readmemh seem to somehow lose that data file when they are embedded in other IPs.

 

Consider the following minimal test case (also supplied as an attached .zip file) with Vivado 2015.3:

http://svn.clifford.at/handicraft/2015/vivado_readmem_ip2

 

The shell script "run.sh" simply runs build.tcl in each of the subdirs in a fresh Vivado process.

 

myip1 is a simple example IP that contains a ROM that is initialized using $readmemh. (The data file needs to use the ".dat" file extension for this to work in a packaged IP, as we have figured out earlier.)

 

myip2 is another IP that simply wraps myip1.

 

mytop1 is a design that is using myip1 directly. This is working. After "run.sh" is completed I see the following line in mytop1/mytop1_prj.runs/myip1_0_synth_1/runme.log:

 

INFO: [Synth 8-3876] $readmem data file 'myip1.dat' is read successfully [/home/clifford/Work/handicraft/2015/vivado_readmem_ip2/mytop1/mytop1_prj.srcs/sources_1/ip/myip1_0/myip1.v:3]

 

 

mytop2 is a design that is identical to mytop1, except that it is using myip2 instead of myip1. In this case the data file is somehow lost (!) and I see the following line in mytop2/mytop2_prj.runs/myip2_0_synth_1/runme.log:

 

CRITICAL WARNING: [Synth 8-4445] could not open $readmem data file 'myip1.dat'; please make sure the file is added to project and has read permission, ignoring [/home/clifford/Work/handicraft/2015/vivado_readmem_ip2/mytop2/mytop2_prj.srcs/sources_1/ip/myip2_0/myip2_prj.srcs/sources_1/ip/myip1_0/myip1.v:3]

How is this supposed to work? Is this a bug or are we doing something wrong here? Is there a documentation that covers advanced aspects of IP packaging such as this one?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
15,373 Views
Registered: ‎12-29-2013

Re: $readmemh in IP stops working when IP is used in other IP

Jump to solution

After discussion with Xilinx support (SR#10337522): It works when the data file is added to the file groups verilog:synthesis and verilog:simulation (file file type 'data' to avoid a warning from ipx::check_integrity). I.e. the following patch fixes the problem:

 

--- myip1/build.tcl	(revision 2191)
+++ myip1/build.tcl	(working copy)
@@ -12,15 +12,14 @@
 
 set grp [ipx::add_file_group -type verilog:simulation {} [ipx::current_core]]
 set_property model_name myip1 $grp
+set_property type data [ipx::add_file myip1.dat $grp]
 ipx::add_file myip1.v $grp
 
 set grp [ipx::add_file_group -type verilog:synthesis {} [ipx::current_core]]
 set_property model_name myip1 $grp
+set_property type data [ipx::add_file myip1.dat $grp]
 ipx::add_file myip1.v $grp
 
-set grp [ipx::add_file_group -type misc {} [ipx::current_core]]
-ipx::add_file myip1.dat $grp
-
 ipx::import_top_level_hdl -top_module_name myip1 -top_level_hdl_file myip1.v [ipx::current_core]
 
 ipx::create_xgui_files [ipx::current_core]
3 Replies
Instructor
Instructor
8,023 Views
Registered: ‎08-14-2007

Re: $readmemh in IP stops working when IP is used in other IP

Jump to solution

If I had to guess, Vivado is looking for myip1.dat in the wrong directory.  Have you tried to place a copy in the myip2 directory?  If that works, then perhaps changing the source to read:

 

  initial $readmemh("../myip1/myip1.dat", rom);

 

would also fix it?

-- Gabor
0 Kudos
Contributor
Contributor
8,015 Views
Registered: ‎12-29-2013

Re: $readmemh in IP stops working when IP is used in other IP

Jump to solution

Thanks for your reply. Unfortunately this does not help:

 

The HDL file that is interpreted by Vivado when synthesizing the IP is not the file in its original location, but a copy somewhere else (a subdir of the project directory). As creator of the IP core I cannot predict where this directory is going to be in relation to the .dat file..

 

 

The problem is that in the final copy of myip1 for mytop2 does not contain the data file anymore:

 

$ tree ./mytop2/mytop2_prj.srcs/sources_1/ip/myip2_0/myip2_prj.srcs/sources_1/ip/myip1_0/
./mytop2/mytop2_prj.srcs/sources_1/ip/myip2_0/myip2_prj.srcs/sources_1/ip/myip1_0/
├── myip1_0.xci
├── myip1_0.xml
├── myip1.v
├── sim
│   └── myip1_0.v
└── synth
    └── myip1_0.v

This is different with the final copy of myip1 in the case of mytop2:

 

$ tree ./mytop1/mytop1_prj.srcs/sources_1/ip/myip1_0/
./mytop1/mytop1_prj.srcs/sources_1/ip/myip1_0/
├── myip1_0.dcp
├── myip1_0_sim_netlist.v
├── myip1_0_sim_netlist.vhdl
├── myip1_0_stub.v
├── myip1_0_stub.vhdl
├── myip1_0.veo
├── myip1_0.vho
├── myip1_0.xci
├── myip1_0.xml
├── myip1.dat
├── myip1.v
├── sim
│   └── myip1_0.v
└── synth
    └── myip1_0.v

When comparing the  myip1_0.xml files from the two cases with each other and with the original myip1/component.xml, you can see that not only the file is ommitted from the directory in the mytop2 case, the entire xilinx_miscfiles_view_fileset fileSet have been removed from the XML IP-XACT compontent description.

0 Kudos
Highlighted
Contributor
Contributor
15,374 Views
Registered: ‎12-29-2013

Re: $readmemh in IP stops working when IP is used in other IP

Jump to solution

After discussion with Xilinx support (SR#10337522): It works when the data file is added to the file groups verilog:synthesis and verilog:simulation (file file type 'data' to avoid a warning from ipx::check_integrity). I.e. the following patch fixes the problem:

 

--- myip1/build.tcl	(revision 2191)
+++ myip1/build.tcl	(working copy)
@@ -12,15 +12,14 @@
 
 set grp [ipx::add_file_group -type verilog:simulation {} [ipx::current_core]]
 set_property model_name myip1 $grp
+set_property type data [ipx::add_file myip1.dat $grp]
 ipx::add_file myip1.v $grp
 
 set grp [ipx::add_file_group -type verilog:synthesis {} [ipx::current_core]]
 set_property model_name myip1 $grp
+set_property type data [ipx::add_file myip1.dat $grp]
 ipx::add_file myip1.v $grp
 
-set grp [ipx::add_file_group -type misc {} [ipx::current_core]]
-ipx::add_file myip1.dat $grp
-
 ipx::import_top_level_hdl -top_module_name myip1 -top_level_hdl_file myip1.v [ipx::current_core]
 
 ipx::create_xgui_files [ipx::current_core]