problems with readline function within a subprogram

Discussion in 'VHDL' started by ed.agunos@gmail.com, Sep 8, 2006.

  1. 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;
     
    , Sep 8, 2006
    #1
    1. Advertising

  2. 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.
     
    Paul Uiterlinden, Sep 8, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Jones

    Hiding of subprogram designators

    David Jones, Nov 17, 2003, in forum: VHDL
    Replies:
    1
    Views:
    603
    Alan Fitch
    Nov 18, 2003
  2. Taras_96
    Replies:
    2
    Views:
    5,017
    Taras_96
    Aug 3, 2005
  3. gavino
    Replies:
    4
    Views:
    569
    gavino
    Sep 20, 2010
  4. Jean-Michel
    Replies:
    0
    Views:
    388
    Jean-Michel
    Dec 22, 2007
  5. Andrew DeFaria
    Replies:
    1
    Views:
    242
    Ben Morrow
    Jan 30, 2008
Loading...

Share This Page