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: 
Observer assaad1-
Observer
266 Views
Registered: ‎10-16-2018

file IO

i want to read four files .txt in my testbench.this files have in each line 16 bits .

i have converted image to txt file to be read read in my testbench  but when i simulate , the errors shows:

at 14.000 ps: Error: READ(STD_ULOGIC_VECTOR) Error: Character '
Error at 14.000 ps: Textio read:: called on empty string or lineat 14.000 ps: Error: 

Also when i try to replace read by 

" & L.all & "'"; its show  just the first bits in each line  .how i can  solved this errors

 

0 Kudos
7 Replies
Scholar richardhead
Scholar
235 Views
Registered: ‎08-01-2012

Re: file IO

Not sure what you're doing, but your text file contains a load of 0s. So each line only contains a single bit. If your SLV is 16 bits, it will cause and error as it is expecting 16 bits per line.

0 Kudos
Observer assaad1-
Observer
223 Views
Registered: ‎10-16-2018

Re: file IO

thanks sir for your reply, so what is the solution in your opinion  because i want to read all the lines 16 bits 

0 Kudos
Scholar richardhead
Scholar
207 Views
Registered: ‎08-01-2012

Re: file IO

The easiest method would be to re-create the text file with 16 bits per line.

0 Kudos
Observer assaad1-
Observer
199 Views
Registered: ‎10-16-2018

Re: file IO

but my file contains 16 bits per line? the problem is that i transform image under matlab with the pixels coded in 16 bits and i recorded these binary values in txt file .can you give example of file txt that have 16 bits per lines because i think im confused now .thanks

0 Kudos
Scholar richardhead
Scholar
197 Views
Registered: ‎08-01-2012

Re: file IO

Your text has a single bit per line. Your text file looks like this:

 

0
0
0
0
0
0
0
0

You need 16 bits per line, either as binary:

0000000000000000
0000000000000000
0000101011001010
..... etc

or hex (if you use the hread procedure)

0000
0000
0ACA
.... etc
0 Kudos
Observer assaad1-
Observer
186 Views
Registered: ‎10-16-2018

Re: file IO

thank you for your time , here I confused all the text files are as you say 16 bits per lines, I already import a file W.txt and in the testbench reads only the first bits, its possible there is an error in the file elements a carachtere or something else 

0 Kudos
Scholar richardhead
Scholar
181 Views
Registered: ‎08-01-2012

Re: file IO

@assaad1- 

Your posts are very confusing. W.txt only has 1 bit per line, which is maybe why your testbench only reads in 1 bit. Not 16 bits per line.

Without seeing your code and text file you are using, I can only confirm that what you have posted has only 1 bit per line.

0 Kudos