Scope of selected names in context/use clause

K

kennheinrich

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

Mike Treseler

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
 
K

kennheinrich

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
 
M

Mike Treseler

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top