Loop in procedure not complete

Guest
Hi,

I am trying to monitor the loop index within a procedure in a VHDL
testbench as follows:



procedure test (signal Clock : std_logic;
Times : integer;
signal Data : std_logic_vector(7 downto 0) ) is

variable wait_index : integer;
variable i : integer;
variable j_help : integer;
variable ln : line;
begin

wait_index := Times;

LOOP1_OUT : for i in 0 to 15000 loop
j_help := i;

if (i <= wait_index) then
if i=wait_index then
writeline(OUTPUT,ln);
write(ln,string'("loop "));
write(ln,j_help);
end if;
wait on Clock, Data;
exit LOOP1_OUT when Data="10000100";
end if;

end loop;

end test;

-- Calling procedure within main process
process
begin
test(t_Clock, 50, t_Data);

wait;
end process;

I get no monitoring in Modelsim at all. Why?
("Data" remains "00000000" all the time so that no
loop exit comes into question)

When I comment the inner if-statement out
if (i <= wait_index) then
--if i=wait_index then
writeline(OUTPUT,ln);
write(ln,string'("loop "));
write(ln,j_help);
--end if;
wait on Clock, Data;
exit LOOP1_OUT when Data="10000100";
end if;

I get monitored in Modelsim
loop 0
loop 1
....
loop 49

But loop 50 is missing. Why?

Changings to
writeline(OUTPUT,ln);
write(ln,string'("loop "));
write(ln,i);
do not change anything.

Thank you for your help.

Rgds
André
 
I have found some post on the topic "writeline VHDL"

Write and Writeline are fuctions defined in the STD.TEXTIO >library of
VHDL.

Line is a type def. It is access STRING. i.e it is a pointer
to a STRING.

Fn. Write adds the string specfd. to this Line (in Ur case strbuf).

Writeline Flushes this line onto the file specfd. (in Ur case
output).
\/
And from this the memory leak arises! Is that correct ?
 
Jonathan Bromley a écrit :
On 18 May 2005 09:08:46 -0700, ALuPin@web.de wrote:


Write and Writeline are fuctions defined in the STD.TEXTIO
library of VHDL.

Line is a type def. It is access STRING. i.e it is a pointer
to a STRING.
Fn. Write adds the string specfd. to this Line (in Ur case
strbuf).
Writeline Flushes this line onto the file specfd. (in Ur case
output).
\/
And from this the memory leak arises! Is that correct ?

Not quite.

Typically, a procedure that does text output will build up some
text in a LINE variable using WRITE() and then send it to a
file or the console using WRITELINE(). Each call to
WRITE(L, stuff)
allocates a little more memory, to accommodate the new text.
However, when you eventually do
WRITELINE(output, L)
the memory pointed-to by L is deallocated (returned to free store)
and L is reset to NULL. This is fine. There is no memory leak.
Huu, this is not what the LRM says.

LRM says:
Procedure WRITELINE causes the current line designated by parameter L
to be written to the file and returns with the value of parameter L
designating a null string.

If L designates a null string, it is not reset to NULL.

JD.
 

Welcome to EDABoard.com

Sponsor

Back
Top