On Tue, Oct 20, 2009 at 11:58:10AM -0400, Brian Padalino wrote: > Wow - that was amazingly simple.
Congrats! > It looked like all I really needed to do was: > > -- initialization > std_names.std_names_initialize; > libraries.init_pathes; > flags.bootstrap := true ; You shouldn't set flags.bootstrap. This is required only to compile the std library. May you have set it because you forgot to add the path for the std library ? > -- setup libraries > libraries.add_library_path( "./library/ieee/" ) ; Hint: also do that for std. > 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? No you don't need GCC at all. The 'ghdl' driver can analyze and semantize but it is not linked with GCC. > 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? Note that Load_File only parse the file. It doesn't do semantic analysis: ie it doesn't resolve names or types. You can use the tree after load_file has been called but it won't give you what you want here. You must at least call Sem.Semantic for each unit. And if you do that, you must set back_end.finish_compilation. There is a good reason for that: during semantic analysis, other units may be loaded (think about clauses such as use ieee.std_logic_1164.all). This is done automatically but for each unit loaded, back_end.finish_compilation is called. For a simple example, see in ghdllocal.adb procedure finish_compilation. Once you have done that, you will have a decorated tree in memory. The procedure disp_tree.disp_tree may be useful to display the tree. The root of the tree is libraries.libraries_chain. This is a linked list of all libraries. You may prefer however to use work_library as the root. Read the comments in iirs.ads to get an idea about all the nodes and how to traverse the hierarchy to the entity declarations. > > 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. Thanks, Tristan. _______________________________________________ Ghdl-discuss mailing list [email protected] https://mail.gna.org/listinfo/ghdl-discuss
