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: 
Explorer
Explorer
4,243 Views
Registered: ‎11-01-2015

Can Vivado 2016.3 support string for file IO?

Hi all,

Can Vivado 2016.3 support string for file IO just like below?

 

#include <string>

 

int main ()

{

  string fa = "C://a.txt";

  ifstream fa_strm (fa);

 

....

 

}

 

Thanks,

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
4,084 Views
Registered: ‎08-17-2011

Re: Can Vivado 2016.3 support string for file IO?

hi @araongao2015

 

the code you show is used in C TB so you can do whatever you want as long as it's correct code, for example it does compile, does not segfault at runtime etc. this code is note used for C synthesis.

however you cannot use this exact same code for C synthesis.. an RTL IP doesn't cannot do anything with your file "C://a.txt" it doesn't make sense to expect to read a file from a hard drive from an FPGA, as-is.

 

I hope this helps.

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Explorer
Explorer
4,037 Views
Registered: ‎11-01-2015

Re: Can Vivado 2016.3 support string for file IO?

Hi @herver,

 

Thank you. Actually when I try to use it in C++ testbench, it shows an error.

But if I use below code, the testbench can run well.

 

char *fp = "C://a.dat";

 

That's why I guess Vivado 2016.3 does not support string as a valid file type.

 

Thanks,

Regards

0 Kudos