Scope of selected names in context/use clause

Discussion in 'VHDL' started by kennheinrich@sympatico.ca, Jul 19, 2007.

  1. 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".
     
    , Jul 19, 2007
    #1
    1. Advertising

  2. 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
     
    Mike Treseler, Jul 19, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 18, 11:47 pm, Mike Treseler <> 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
     
    , Jul 20, 2007
    #3
  4. 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
     
    Mike Treseler, Jul 20, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan
    Replies:
    2
    Views:
    1,481
    Mike Treseler
    Dec 16, 2004
  2. crazyrdx

    use clause

    crazyrdx, Aug 30, 2005, in forum: VHDL
    Replies:
    1
    Views:
    636
  3. Andrew FPGA

    Use clause usage with XST?

    Andrew FPGA, Mar 23, 2006, in forum: VHDL
    Replies:
    1
    Views:
    794
    Rolf Eike Beer
    Mar 27, 2006
  4. =?Utf-8?B?RGFiYmxlcg==?=
    Replies:
    6
    Views:
    13,399
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Apr 4, 2006
  5. feiyang
    Replies:
    1
    Views:
    1,677
    Ajeetha
    Nov 23, 2006
Loading...

Share This Page