Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Scope of selected names in context/use clause

Reply
Thread Tools

Scope of selected names in context/use clause

 
 
kennheinrich@sympatico.ca
Guest
Posts: n/a
 
      07-19-2007
A rather pedantic question:

The 2000 LRM, sec 10.4, says that the scope of use clause begins
immediately after the use clause. In the case of a list of selected
names, e.g. the following design unit w/context clause

library std;
use std.all, standard.all;

entity foo...

I would expect that the packages in std (i.e. standard) are not
directly visible until after the semicolon following the use clause,
and hence expect to get an error saying "standard" is undefined. Is
this correct? Emprically, this is at odds with Modelsim's vcom 6.0b,
which allows this.

Thoughts?

- Kenn

Notes: [1] cleverly, the LRM doesn't explicitly say that the scope I
mentioned above is the point at which the names become directly
visible; but it seems to be the reasonable assumption
Notes: [2] even though the implicit context is supposed to contain a
"std.standard.all" use clause, it doesn't say that the identifier
"standard" , denoting a package, is directly visible, hence the
example above is not a special case because I used "std" instead of
"foo".

 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      07-19-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I would expect that the packages in std (i.e. standard) are not
> directly visible until after the semicolon following the use clause,
> and hence expect to get an error saying "standard" is undefined. Is
> this correct? Emprically, this is at odds with Modelsim's vcom 6.0b,
> which allows this.


Modelsim has it right.
The std library does not require a USE statement.

-- Mike Treseler
 
Reply With Quote
 
 
 
 
kennheinrich@sympatico.ca
Guest
Posts: n/a
 
      07-20-2007
On Jul 18, 11:47 pm, Mike Treseler <(E-Mail Removed)> wrote:

> Modelsim has it right.
> The std library does not require a USE statement.
>
> -- Mike Treseler


Thanks. I was asking about a slightly more obscure
point, though. I think my choice of 'std' confused the
issue, since it has special rules -- mea culpa.

Let's say I have library "L" and within that, package "P",
and I want to make the name "P" as well as all names
inside "P" directly visible.

There are a few scenarios:

-- scenario 1
library L;
use L.P.all;
-- here, the symbol "L", and those inside P are visible.
-- but the name "P" itself is not directly visible
-- for example, "use P.all;" will fail

-- scenario 2
library L;
use L.P; -- "P" is now directly visible
use P.all; -- "P" and its contents are directly visible
-- a subsequent "signal x.type1;" will work

-- scenario 3
library L;
use L.P, P.all;
-- I claim that the second use of "P" is not directly
-- visible and should fail.
-- "P" should not become directly visible until after the semicolon

My original question was, is my claim for scenario 3 correct?

- Kenn




 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      07-20-2007
(E-Mail Removed) wrote:

> -- scenario 3
> library L;
> use L.P, P.all;
> -- I claim that the second use of "P" is not directly
> -- visible and should fail.
> -- "P" should not become directly visible until after the semicolon


Obscure indeed.
In other words, I should see an error on line 5
when compiling this package?
------------------------------
library ieee; -- 1 ieee
use ieee.std_logic_1164, -- 2 ieee.std_logic_1164
std_logic_1164.std_ulogic; -- 3.ieee.std_logic_1164.std_ulogic
package my_pkg is -- 4
constant one : std_ulogic := '1'; -- 5. error?
end package my_pkg;
------------------------------

> My original question was, is my claim for scenario 3 correct?


If it is, then all my tools are broken.
It seems to me the parser would expand lines 2 and 3
into two complete USE statements before analysis.
But I'm not gonna open up an LRM tonight.
Jonathan should be around soon.

-- Mike Treseler
 
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
Re: Lexical scope vs. dynamic scope Xah Lee Java 0 02-26-2009 10:08 AM
CSPEC issue: lossing scope (or incorrect scope) in cspec subroutine. balldarrens@gmail.com Perl Misc 0 02-05-2009 08:42 PM
Scope - do I need two identical classes, each with different scope? ann Java 13 09-13-2005 03:07 AM
How do namespace scope and class scope differ? Steven T. Hatton C++ 9 07-19-2005 06:07 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM



Advertisments