Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.vhdl

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2012, 05:24 PM
valtih1978
Guest
 
Posts: n/a
Default What closes the implicitly open file?

A file declaration opens a file implicitly when file open information is
included. Specification does not say when file is closed.
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-25-2012, 03:58 PM
KJ
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

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
Reply With Quote
  #3 (permalink)  
Old 06-25-2012, 04:25 PM
valtih1978
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

> 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?
Reply With Quote
  #4 (permalink)  
Old 06-26-2012, 11:25 AM
KJ
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

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
Reply With Quote
  #5 (permalink)  
Old 06-26-2012, 12:48 PM
Paul Uiterlinden
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

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.
Reply With Quote
  #6 (permalink)  
Old 06-28-2012, 04:36 PM
valtih1978
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

>>> 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?
Reply With Quote
  #7 (permalink)  
Old 06-29-2012, 12:41 AM
KJ
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

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
Reply With Quote
  #8 (permalink)  
Old 06-29-2012, 12:43 AM
Alan Fitch
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

On 28/06/12 17:36, valtih1978 wrote:
>>>> 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?
>


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."

In practical simulators, files without an explicit call to file_close
seem to be closed when simulation quits, but this doesn't seem to be in
the standard.

regards
Alan

--
Alan Fitch


Reply With Quote
  #9 (permalink)  
Old 06-29-2012, 06:22 AM
Enrik Berkhan
Guest
 
Posts: n/a
Default Re: What closes the implicitly open file?

Alan Fitch <apf@invalid.invalid> 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
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 01:03 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.