OK, that one's easy...
There are at least eight different versions of "write".
The version to write a string looks, to the compiler,
exactly the same as the version to write a bit-vector:
write(buf, "1011"); -- String or bit-vector???
Hence the "ambiguous" error message. There are two
possible fixes:
1) Type-qualify the string:
write(buf, string'("My message"));
2) Create a specialised version of "write", with a
different name, to deal with the very common problem
of writing a string message:
procedure WrStr(L: inout line; S: in string) is
begin
write (L, S); -- No ambiguity; S is of string type
end;
Now you can do simply
WrStr(buf, "My message");
and all will be well.
FOOTNOTE for the nitpickier members of c.l.vhdl:
The simple implementation of WrStr, above, is
incomplete. To provide the full facilities of
"write", complete with formatting, you need this
slightly more complex version:
procedure WrStr
( L : inout line
; S : in string
; JUSTIFIED : in SIDE := right
; FIELD : in WIDTH := 0
) is
begin
write(L, S, JUSTIFIED, FIELD);
end;
Of course, thanks to the default arguments you can
still call it like this if you wish:
WrStr(buf, "message");
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)://
www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.