Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Hiding of subprogram designators

Reply
Thread Tools

Hiding of subprogram designators

 
 
David Jones
Guest
Posts: n/a
 
      11-17-2003
From VHDL-93 LRM section 10.3, page 144, lines 143-144:

Within the specification of a subprogram, every declaration with the same
designator as the subprogram is hidden. Where hidden in this manner, a
declaration is visible neither by selection nor directly.

Read one way, a subprogram declaration has the same designator as itself,
therefore it should be hidden within the specification of the subprogram.
As a consequence, it should not be possible to call a subprogram recursively.

Casual experimentation with VHDL Simili indicates that this is not so (i.e.
recursion is possible) and I would be surprised if recursion were not possible.

If I try to overload a subprogram name as a signal, then I'm creating a
homograph, and we already have rules to deal with that. If I try to overload
a subprogram name as another subprogram, that works, and one overloaded
subprogram can even call the other!

Can someone clarify exactly what the spec is trying to prevent and why?
 
Reply With Quote
 
 
 
 
Alan Fitch
Guest
Posts: n/a
 
      11-18-2003
"David Jones" <(E-Mail Removed)> wrote in message
news:XMbub.7149$(E-Mail Removed).. .
> From VHDL-93 LRM section 10.3, page 144, lines 143-144:
>
> Within the specification of a subprogram, every declaration with

the same
> designator as the subprogram is hidden. Where hidden in this

manner, a
> declaration is visible neither by selection nor directly.
>
> Read one way, a subprogram declaration has the same designator as

itself,
> therefore it should be hidden within the specification of the

subprogram.
> As a consequence, it should not be possible to call a subprogram

recursively.
>
> Casual experimentation with VHDL Simili indicates that this is not

so (i.e.
> recursion is possible) and I would be surprised if recursion were

not possible.
>
> If I try to overload a subprogram name as a signal, then I'm

creating a
> homograph, and we already have rules to deal with that. If I try to

overload
> a subprogram name as another subprogram, that works, and one

overloaded
> subprogram can even call the other!
>
> Can someone clarify exactly what the spec is trying to prevent and

why?

Hi David, as usual with the LRM you have to look up every phrase
very carefully. The words "subprogram specification" refer to the
the part of the subprogram from the start of it to the ';' or the 'is'
i.e.

procedure fred (variable A : in std_logic) ;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprogram specification

or

impure function blob (constant A : BOOLEAN) return integer is
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^
variable I : INTEGER;
begin
-- do something impure!

return I

end function;

In other words, all it's saying is that you can't have a parameter
with
the same name as the subprogram, e.g.

procedure fred (variable fred : in std_logic) is


Have a look at section at the syntax summary in Annex A, p221, for
a summary of what a subprogram specification is, or look in chapter
2

kind regards

Alan

P.S. There's no problem with recursion. In fact because declaration
and body can be separated, it's possible to write mutually recursive
procedures if you want to!

--
Alan Fitch
Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project
Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: +44 (0)1425 471223 mail:
http://www.velocityreviews.com/forums/(E-Mail Removed)
Fax: +44 (0)1425 471573 Web:
http://www.doulos.com

The contents of this message may contain personal views which are not
the
views of Doulos Ltd., unless specifically stated.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run s subprogram silently? Marteno Rodia Java 7 05-05-2009 03:07 PM
default value for subprogram parameter John Smith VHDL 10 07-03-2007 08:22 PM
problems with readline function within a subprogram ed.agunos@gmail.com VHDL 1 09-08-2006 10:14 PM
subprogram parameter list =?ISO-8859-1?Q?Sch=FCle_Daniel?= VHDL 3 07-13-2006 01:00 PM
Simulating testbench waveform error: "No feasible entries for subprogram write" Taras_96 VHDL 2 08-03-2005 02:55 AM



Advertisments