What closes the implicitly open file?

Discussion in 'VHDL' started by valtih1978, Jun 24, 2012.

  1. valtih1978

    valtih1978 Guest

    A file declaration opens a file implicitly when file open information is
    included. Specification does not say when file is closed.
    valtih1978, Jun 24, 2012
    #1
    1. Advertising

  2. valtih1978

    KJ Guest

    On Sunday, June 24, 2012 1:24:20 PM UTC-4, valtih1978 wrote:
    > A file declaration opens a file implicitly when file open information is
    > included. Specification does not say when file is closed.


    Your statement is true only for the original VHDL 1987 standard. To answer your question, the file is closed when the simulation ends.

    That's why using anything other than VHDL '87 is better. Starting with VHDL '93, you open and close the files explicitly when you want to open and close them.

    Kevin Jennings
    KJ, Jun 25, 2012
    #2
    1. Advertising

  3. valtih1978

    valtih1978 Guest

    > open and close the files explicitly when you want to open and close them.

    And, I can close the implicitly opened file at any time?
    valtih1978, Jun 25, 2012
    #3
  4. valtih1978

    KJ Guest

    On Monday, June 25, 2012 12:25:22 PM UTC-4, valtih1978 wrote:
    > > open and close the files explicitly when you want to open and close them.

    >
    > And, I can close the implicitly opened file at any time?


    When compiling with VHDL '93, there won't be any implicitly opened files. The files won't be open until you explicitly open them.

    Kevin Jennings
    KJ, Jun 26, 2012
    #4
  5. KJ wrote:

    > On Monday, June 25, 2012 12:25:22 PM UTC-4, valtih1978 wrote:
    >> > open and close the files explicitly when you want to open and close
    >> > them.

    >>
    >> And, I can close the implicitly opened file at any time?

    >
    > When compiling with VHDL '93, there won't be any implicitly opened files.
    > The files won't be open until you explicitly open them.


    Still, they can be opened during elaboration (the old fashioned way) if
    declared as follows:

    file fh: text open write_mode is "my_file.txt";

    I guess this could be called "explicitly opening the file".

    --
    Paul Uiterlinden
    www.aimvalley.nl
    e-mail addres: remove the not.
    Paul Uiterlinden, Jun 26, 2012
    #5
  6. valtih1978

    valtih1978 Guest

    >>> And, I can close the implicitly opened file at any time?
    >>
    >> When compiling with VHDL '93, there won't be any implicitly opened files.
    >> The files won't be open until you explicitly open them.

    >
    > Still, they can be opened during elaboration (the old fashioned way) if
    > declared as follows:
    >
    > file fh: text open write_mode is "my_file.txt";
    >
    > I guess this could be called "explicitly opening the file".


    No. FILE_OPEN(f) is explicit when user calls it manually! The
    declaration-specified open information calls this function implicitly. I
    just wonder when the corresponding FILE_CLOSE(f) is or can be called in
    this case?
    valtih1978, Jun 28, 2012
    #6
  7. valtih1978

    KJ Guest

    On Thursday, June 28, 2012 12:36:48 PM UTC-4, valtih1978 wrote:
    > > file fh: text open write_mode is "my_file.txt";
    > >
    > > I guess this could be called "explicitly opening the file".

    >
    > No. FILE_OPEN(f) is explicit when user calls it manually! The
    > declaration-specified open information calls this function implicitly. I
    > just wonder when the corresponding FILE_CLOSE(f) is or can be called in
    > this case?


    Why are you wondering? I answered your question with my first post in the second sentence.

    Kevin Jennings
    KJ, Jun 29, 2012
    #7
  8. Alan Fitch <> wrote:
    > All I can find in 1076-2002 is
    >
    > "If a file object F is associated with an external file, procedure
    > FILE_CLOSE terminates access to the external file associated with F and
    > closes the external file. If F is not associated with an external file,
    > then FILE_CLOSE has no effect. In either case, the file object is no
    > longer open after a call to FILE_CLOSE that associates the file object
    > with the formal parameter F.
    >
    > An implicit call to FILE_CLOSE exists in a subprogram body for every
    > file object declared in the corresponding subprogram declarative part.
    > Each such call associates a unique file object with the formal
    > parameter F and is called whenever the corresponding subprogram
    > completes its execution."


    And, further, it (at least 1076-2008) does not forbid closing a file
    explicitly that has been opened implicitly by declaration, AFAICS.

    Enrik
    Enrik Berkhan, Jun 29, 2012
    #8
    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. Patrick Olurotimi Ige

    Cannot implicitly convert type 'object' to 'bool' Error

    Patrick Olurotimi Ige, Jan 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    12,184
    Patrick Olurotimi Ige
    Jan 25, 2005
  2. Andy Sutorius
    Replies:
    9
    Views:
    20,507
    Kevin Spencer
    Feb 22, 2005
  3. Patrick Olurotimi Ige
    Replies:
    3
    Views:
    8,655
    Patrick Olurotimi Ige
    May 4, 2005
  4. Guenther Sohler
    Replies:
    6
    Views:
    1,039
    anthius
    Oct 7, 2006
  5. John Dalberg
    Replies:
    2
    Views:
    186
    John Dalberg
    Mar 18, 2005
Loading...

Share This Page