On Tue, Oct 20, 2009 at 12:53 AM, Tristan Gingold <[email protected]> wrote:
> Hi,
>
> you'd better to look at how the 'ghdl -s' command is implemented.
> See in ghdllocal.adb the procedure Analyze_Files.
> There are two points:
> * general initialization is performed by the procedure Init (before anything
> else) and procedure Setup_Libraries (before parsing).  This is required.
> * name_table.Get_Identifier is used to convert a string to a Name_Id.
> * As you have found Libraries.Load_File is used to parse a file.

Wow - that was amazingly simple.

It looked like all I really needed to do was:

    -- initialization
    std_names.std_names_initialize;
    libraries.init_pathes;
    flags.bootstrap := true ;

    -- setup libraries
    libraries.add_library_path( "./library/ieee/" ) ;
    libraries.load_std_library;
    libraries.load_work_library;

Before doing the name_table.get_identifier( filename ) followed by the
libraried.load_file( fid ).

> Back_End.Finish_Compilation is called after parsing to finish the work: that
> is semantic analysis and code generation.

If I wanted to skip code generation, and just do the analysis - does
that use the GCC backend aspect or can I get away with just using what
is all in Ada?

Is this step required if I just want to know things about the VHDL -
for example, where entities are declared, instantiated, what scopes
are visible, value and names of constants, etc?

> What may be unusual in GHDL is that 'everything' is an integer: nodes are
> represented by an integer (which indexes a table), identifiers are integers...
> In most other compilers these are pointers.
> Using integers might be slightly slower (because a table has to be indexed),
> but makes nodes smaller (as the integer are always 32 bits), and makes nodes
> easily extendable.
>
> But you don't really need to know that, because you always have to use
> subprograms to read or modify fields.

Thanks for the insight anyway.  I am new to Ada, but you seem to have
setup a nice structure for at least parsing the files and accessing
information about the parsed files.

Brian

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to