RE: [sv-bc] Issues on anonymous program items

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Tue May 09 2006 - 10:48:25 PDT
Surya,

 

As written, your example is illegal. Currently, packages cannot include
programs.

If you omit the package and declare the programs in $unit then your
example is largely correct:

 

    program; 
        function int F; ... endfunction
    endprogram 


    program;
        function int t2; 
            t2 = t1() ;      // could also use $unit.t1
        endfunction
    endprogram


    program pro;
        function int t3; 
            t3 = t1() ;      // or $unit.t1 or $unit.t2
        endfunction
    endprogram

 

Arturo

 

________________________________

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Surya Pratik Saha
Sent: Monday, May 08, 2006 6:30 AM
To: sv-bc@eda.org; sv-ac@eda.org
Subject: [sv-bc] Issues on anonymous program items

 

Hi, 
In section 16.5 of SV 1800 LRM, it is specified 
"NOTE: Although identifiers declared inside an anonymous program cannot
be referenced outside any program block,attempting to declare another
identifier with the same name outside the anonymous program block will
generate an error.This occurs because the identifier shares the same
name space within the scope of the surrounding package or
compila-tionunit." 

Does it mean the items declared inside anonymous program can be
accessible from another program only. If not, then what is the usage of
those items? 

Is the following case valid? 

package p; 
    program; 
        task t1; 
            int x; 
        endtask 
    endprogram 
    program; 
        task t2; 
            int x; 
            x = t1.x; // Is t1 accessible? 
        endtask 
    endprogram 
endpackage 
program pro; 
    import p::*; 
    task t3; 
        int x; 
        x = t1.x;// Is t1 accessible? 
    endtask 
endprogram 

module top; 
endmodule 

-- 
Regards
Surya.

 
Received on Tue May 9 10:48:36 2006

This archive was generated by hypermail 2.1.8 : Tue May 09 2006 - 10:48:43 PDT