problems with readline function within a subprogram

Guest
All,

I am having problems with the readline function within a subprogram.

Check out the following processes. In the first process
"proc_wo_subprogram", everything works correctly. The next line from
the file is read and the pointer is assigned to "data_line" and I can
access the object that "data_line" points to. But in the second process
"proc_w_subrprogram", I can't access the object and I don't really
understand why. Can any one explain?

proc_wo_subprogram : process
variable stat : file_open_status;
file data_file : text;
variable data_line : line;
begin
file_open(stat, data_file, "test_data.dat", read_mode);
readline(data_file, data_line);
file_close(data_file);
wait;
end process;

proc_w_subprogram : process

procedure go is
variable stat : file_open_status;
file data_file : text;
variable data_line : line;
begin
file_open(stat, data_file, "test_data.dat", read_mode);
readline(data_file, data_line);
file_close(data_file);
end procedure;

begin
go;
wait;
end process;
 
ed.agunos@gmail.com wrote:

All,

I am having problems with the readline function within a subprogram.

Check out the following processes. In the first process
"proc_wo_subprogram", everything works correctly. The next line from
the file is read and the pointer is assigned to "data_line" and I
can access the object that "data_line" points to. But in the second
process "proc_w_subrprogram", I can't access the object and I don't
really understand why. Can any one explain?

proc_wo_subprogram : process
variable stat : file_open_status;
file data_file : text;
variable data_line : line;
begin
file_open(stat, data_file, "test_data.dat", read_mode);
readline(data_file, data_line);
file_close(data_file);
wait;
end process;

proc_w_subprogram : process

procedure go is
variable stat : file_open_status;
file data_file : text;
variable data_line : line;
begin
file_open(stat, data_file, "test_data.dat", read_mode);
readline(data_file, data_line);
file_close(data_file);
end procedure;

begin
go;
wait;
end process;
I don't get it. What do you mean with "can't access". Are there any
error messages?

Of course you realize the variables of the procedure cannot be
accessed in the proc_w_subprogram process, don't you? The variables
are local to the procedure.

--
Paul.
 

Welcome to EDABoard.com

Sponsor

Back
Top