Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Problem with TextIO

Reply
Thread Tools

Problem with TextIO

 
 
Rob Keiber
Guest
Posts: n/a
 
      07-07-2008
Hi

I get the following error with the code fragment beneath, can anybody
tell me what is wrong?

Error: Subprogram write is "ambigious"
Error: Type error resolving function call: write.

library IEEE;
use IEEE.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use std.textio.all;
....

process(clk)
variable s : line;
begin
...
write(s,"Test 1 - ");
write(s,"\n");
writeline(output,s);
...

Many thanks,
Rob
 
Reply With Quote
 
 
 
 
Nicolas Matringe
Guest
Posts: n/a
 
      07-07-2008
Rob Keiber a écrit :
> Hi
>
> I get the following error with the code fragment beneath, can anybody
> tell me what is wrong?
>
> Error: Subprogram write is "ambigious"
> Error: Type error resolving function call: write.
>
> library IEEE;
> use IEEE.std_logic_1164.all;
> use ieee.std_logic_unsigned.all;
> use std.textio.all;
> ....
>
> process(clk)
> variable s : line;
> begin
> ...
> write(s,"Test 1 - ");
> write(s,"\n");
> writeline(output,s);
> ...



For some reason (if somebody could explain, it is still unclear to me)
it is not clear what type your litteral constants are.
Try :
write (s, string'("Test 1 - "));

Nicolas
 
Reply With Quote
 
 
 
 
Rob Keiber
Guest
Posts: n/a
 
      07-07-2008
> For some reason (if somebody could explain, it is still unclear to me)
> it is not clear what type your litteral constants are.
> Try :
> write (s, string'("Test 1 - "));


> Nicolas


Thanks Nicolas it works now for the compiling. However, the line

writeline(output,s);

doesnt output anything on the ModelSim Console. is this probably not
working with Modelsim 5.7d or is there another issue?

Cheers,
Rob
 
Reply With Quote
 
Thomas Stanka
Guest
Posts: n/a
 
      07-08-2008
On 7 Jul., 20:46, Rob Keiber <(E-Mail Removed)> wrote:
> I get the following error with the code fragment beneath, can anybody
> tell me what is wrong?


> write(s,"Test 1 - ");


You need to qualify the string to distinguish between string and
vector.

write(s, string'("Test 1 - "));

BTW the writeline command inserts a CR at line end. I don't think VHLD
supports "\n".

regards Thomas
 
Reply With Quote
 
Alain
Guest
Posts: n/a
 
      07-08-2008
Hello,

Try :

....
write(s,string'("Test 1 - "));
write(s,string'("\n"));
....

Regards
 
Reply With Quote
 
ALuPin@web.de
Guest
Posts: n/a
 
      07-08-2008
Are you sure that your process ever gets to the lines

write(s,"Test 1 - ");
write(s,"\n");
writeline(output,s);

?

Maybe some "wait until" condition before is not satisfied.

Use some test signal to proof that ...

Rgds
Andre




 
Reply With Quote
 
Tricky
Guest
Posts: n/a
 
      07-08-2008

> For some reason (if somebody could explain, it is still unclear to me)
> it is not clear what type your litteral constants are.
> Try :
> * *write (s, string'("Test 1 - "));
>
> Nicolas


Basically, the string could be either a bit_vector or a string, and
the compile doesnt know which it is as it does not (and cannot)
evaluate the contents of the string.

> doesnt output anything on the ModelSim Console. is this probably not
> working with Modelsim 5.7d or is there another issue?


In 6.1g (and I assume older versions): When you start a simulation in
modelsim, it gives you the option to write to a file instead of the
console. (Under TEXTIO files, STD_INPUT and STD_OUTPUT). Make sure you
havent set these to something (and hence writing into/out them).

Also, I notice you've got: write(s,"\n");
This does not add a newline character, but is the literals '\' and
'n'. to write a newline character you need to use: write(s, LF); But
the writeline() function already does that for you, so in effect you'd
just be adding an extra blank line.
There is no escape character in VHDL like in C, which makes putting
the " character into a string a pain (please someone correct me if Im
wrong).
 
Reply With Quote
 
Martin Thompson
Guest
Posts: n/a
 
      07-10-2008
Tricky <(E-Mail Removed)> writes:

> There is no escape character in VHDL like in C, which makes putting
> the " character into a string a pain (please someone correct me if Im
> wrong).


Just put double-double quotes in:

report "Look, a "" in my message";

I can't remember where learned that nugget from (but I bet not from
reading the LRM

Cheers,
Martin

--
http://www.velocityreviews.com/forums/(E-Mail Removed)
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.net/electronics.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
std.textio and ieee.std_logic_textio procedure overloading Magne Munkejord VHDL 1 08-23-2006 05:24 PM
vhdl textio and escape sequences Olaf Petzold VHDL 1 11-28-2005 06:22 PM
Vhdl testbench with textio package Teten VHDL 0 09-01-2005 08:43 PM
textio error Pasacco VHDL 3 05-03-2005 08:06 AM
the textio lib and std_logic_textio Pedro Claro VHDL 3 07-28-2003 04:08 PM



Advertisments