Second argument of write must have a constant value.

N

Nikola Skoric

Hello there,

I'm rather new to VHDL and find this piece of code perfectly legitimate:

architecture Behavioral of writer is
file FP: TEXT open write_mode is "output.txt";
begin
process (write) is
variable l : line;
variable data : std_logic_vector(63 downto 0);
begin
if (rising_edge(write)) then
data := DATA_in;
write(l,data);
writeline(FP,l);
end if;
end process;

end Behavioral;

But my analyzer disagrees, and says: "Second argument of write must have
a constant value." What should I do to please my analyzer?
 
C

Colin Marquardt

Nikola Skoric said:
I'm rather new to VHDL and find this piece of code perfectly legitimate: [...]
process (write) is

I wouldn't reuse that function name for a signal.

Cheers,
Colin
 
G

ghelbig

I'm guessing that you're using textio:

write(L, VALUE, JUSTIFY, FIELD); -- Write one value to "line" L from
variable VALUE
* Data_type of VALUE can be bit, bit_vector, integer, real,
character, string, or time.
* JUSTIFY is "left" or "right" to justify within the field
* FIELD is the desired field width of the written value


You must convert the value from std_logic_vector to bit_vector before
write will accept it.
 
N

Nikola Skoric

I'm guessing that you're using textio:

write(L, VALUE, JUSTIFY, FIELD); -- Write one value to "line" L from
variable VALUE
* Data_type of VALUE can be bit, bit_vector, integer, real,
character, string, or time.
* JUSTIFY is "left" or "right" to justify within the field
* FIELD is the desired field width of the written value


You must convert the value from std_logic_vector to bit_vector before
write will accept it.

Oh, right. Thanks. Works now.

While we're at it, can you recommend me some kind of VHDL reference? For
instance, this code I've written dumps a series of bits to the file...
and now I'd like to convert that bit_vector to string containing hex
digits. Where do I start seraching for such a function?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top