Scope of selected names in context/use clause

Guest
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".
 
kennheinrich@sympatico.ca 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
 
On Jul 18, 11:47 pm, Mike Treseler <mike_trese...@comcast.net> 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:p.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
 
kennheinrich@sympatico.ca 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
 

Welcome to EDABoard.com

Sponsor

Back
Top