⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ghdllocal.adb

📁 vhdl集成电路设计软件.需要用gcc-4.0.2版本编译.
💻 ADB
📖 第 1 页 / 共 3 页
字号:
--       end if;   end Perform_Action;   --  Command Find.   type Command_Find is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Find; Name : String) return Boolean;   function Get_Short_Help (Cmd : Command_Find) return String;   procedure Perform_Action (Cmd : in out Command_Find; Args : Argument_List);   function Decode_Command (Cmd : Command_Find; Name : String) return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "-f";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Find) return String   is      pragma Unreferenced (Cmd);   begin      return "-f FILEs           Disp units in FILES";   end Get_Short_Help;   --  Return TRUE is UNIT can be at the apex of a design hierarchy.   function Is_Top_Entity (Unit : Iir) return Boolean   is   begin      if Get_Kind (Unit) /= Iir_Kind_Entity_Declaration then         return False;      end if;      if Get_Port_Chain (Unit) /= Null_Iir then         return False;      end if;      if Get_Generic_Chain (Unit) /= Null_Iir then         return False;      end if;      return True;   end Is_Top_Entity;   --  Disp contents design files FILES.   procedure Perform_Action (Cmd : in out Command_Find; Args : Argument_List)   is      pragma Unreferenced (Cmd);      use Ada.Text_IO;      use Name_Table;      Id : Name_Id;      Design_File : Iir_Design_File;      Unit : Iir;      Lib : Iir;      Flag_Add : Boolean := False;   begin      Flags.Bootstrap := True;      Libraries.Load_Std_Library;      Libraries.Load_Work_Library;      for I in Args'Range loop         Id := Get_Identifier (Args (I).all);         Design_File := Libraries.Load_File (Id);         if Design_File /= Null_Iir then            Unit := Get_First_Design_Unit (Design_File);            while Unit /= Null_Iir loop               Lib := Get_Library_Unit (Unit);               Disp_Library_Unit (Lib);               if Is_Top_Entity (Lib) then                  Put (" **");               end if;               New_Line;               if Flag_Add then                  Libraries.Add_Design_Unit_Into_Library (Unit);               end if;               Unit := Get_Chain (Unit);            end loop;         end if;      end loop;      if Flag_Add then         Libraries.Save_Work_Library;      end if;   end Perform_Action;   --  Command Import.   type Command_Import is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Import; Name : String)                           return Boolean;   function Get_Short_Help (Cmd : Command_Import) return String;   procedure Perform_Action (Cmd : in out Command_Import;                             Args : Argument_List);   function Decode_Command (Cmd : Command_Import; Name : String)                           return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "-i";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Import) return String   is      pragma Unreferenced (Cmd);   begin      return "-i [OPTS] FILEs    Import units of FILEs";   end Get_Short_Help;   procedure Perform_Action (Cmd : in out Command_Import; Args : Argument_List)   is      pragma Unreferenced (Cmd);      use Ada.Text_IO;      Id : Name_Id;      Design_File : Iir_Design_File;      Unit : Iir;      Next_Unit : Iir;      Lib : Iir;   begin      Setup_Libraries (True);      --  Parse all files.      for I in Args'Range loop         Id := Name_Table.Get_Identifier (Args (I).all);         Design_File := Libraries.Load_File (Id);         if Design_File /= Null_Iir then            Unit := Get_First_Design_Unit (Design_File);            while Unit /= Null_Iir loop               if Flag_Verbose then                  Lib := Get_Library_Unit (Unit);                  Disp_Library_Unit (Lib);                  if Is_Top_Entity (Lib) then                     Put (" **");                  end if;                  New_Line;               end if;               Next_Unit := Get_Chain (Unit);               Set_Chain (Unit, Null_Iir);               Libraries.Add_Design_Unit_Into_Library (Unit);               Unit := Next_Unit;            end loop;         end if;      end loop;      --  Analyze all files.      if False then         Design_File := Get_Design_File_Chain (Libraries.Work_Library);         while Design_File /= Null_Iir loop            Unit := Get_First_Design_Unit (Design_File);            while Unit /= Null_Iir loop               case Get_Date (Unit) is                  when Date_Valid                    | Date_Analyzed =>                     null;                  when Date_Parsed =>                     Back_End.Finish_Compilation (Unit, False);                  when others =>                     raise Internal_Error;               end case;               Unit := Get_Chain (Unit);            end loop;            Design_File := Get_Chain (Design_File);         end loop;      end if;      Libraries.Save_Work_Library;   exception      when Errorout.Compilation_Error =>         Error ("importation has failed due to compilation error");   end Perform_Action;   --  Command Check_Syntax.   type Command_Check_Syntax is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Check_Syntax; Name : String)                           return Boolean;   function Get_Short_Help (Cmd : Command_Check_Syntax) return String;   procedure Perform_Action (Cmd : in out Command_Check_Syntax;                             Args : Argument_List);   function Decode_Command (Cmd : Command_Check_Syntax; Name : String)                           return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "-s";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Check_Syntax) return String   is      pragma Unreferenced (Cmd);   begin      return "-s [OPTS] FILEs    Check syntax of FILEs";   end Get_Short_Help;   procedure Analyze_Files (Files : Argument_List; Save_Library : Boolean)   is      use Ada.Text_IO;      Id : Name_Id;      Design_File : Iir_Design_File;      Unit : Iir;      Next_Unit : Iir;   begin      Setup_Libraries (True);      --  Parse all files.      for I in Files'Range loop         Id := Name_Table.Get_Identifier (Files (I).all);         if Flag_Verbose then            Put (Files (I).all);            Put_Line (":");         end if;         Design_File := Libraries.Load_File (Id);         if Design_File /= Null_Iir then            Unit := Get_First_Design_Unit (Design_File);            while Unit /= Null_Iir loop               if Flag_Verbose then                  Put (' ');                  Disp_Library_Unit (Get_Library_Unit (Unit));                  New_Line;               end if;               -- Sem, canon, annotate a design unit.               Back_End.Finish_Compilation (Unit, True);               Next_Unit := Get_Chain (Unit);               if Errorout.Nbr_Errors = 0 then                  Set_Chain (Unit, Null_Iir);                  Libraries.Add_Design_Unit_Into_Library (Unit);               end if;               Unit := Next_Unit;            end loop;            if Errorout.Nbr_Errors > 0 then               raise Errorout.Compilation_Error;            end if;         end if;      end loop;      if Save_Library then         Libraries.Save_Work_Library;      end if;   end Analyze_Files;   procedure Perform_Action (Cmd : in out Command_Check_Syntax;                             Args : Argument_List)   is      pragma Unreferenced (Cmd);   begin      Analyze_Files (Args, False);   end Perform_Action;   --  Command --clean.   type Command_Clean is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Clean; Name : String) return Boolean;   function Get_Short_Help (Cmd : Command_Clean) return String;   procedure Perform_Action (Cmd : in out Command_Clean; Args : Argument_List);   function Decode_Command (Cmd : Command_Clean; Name : String) return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "--clean";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Clean) return String   is      pragma Unreferenced (Cmd);   begin      return "--clean            Remove generated files";   end Get_Short_Help;   procedure Delete (Str : String)   is      use GNAT.OS_Lib;      use Ada.Text_IO;      Status : Boolean;   begin      Delete_File (Str'Address, Status);      if Flag_Verbose and Status then         Put_Line ("delete " & Str (Str'First .. Str'Last - 1));      end if;   end Delete;   procedure Perform_Action (Cmd : in out Command_Clean; Args : Argument_List)   is      pragma Unreferenced (Cmd);      use GNAT.OS_Lib;      use Name_Table;      procedure Delete_Asm_Obj (Str : String) is      begin         Delete (Str & Get_Object_Suffix.all & Nul);         Delete (Str & Asm_Suffix & Nul);      end Delete_Asm_Obj;      procedure Delete_Top_Unit (Str : String) is      begin         --  Delete elaboration file         Delete_Asm_Obj (Image (Libraries.Work_Directory) & Elab_Prefix & Str);         --  Delete file list.         Delete (Image (Libraries.Work_Directory) & Str & List_Suffix & Nul);         --  Delete executable.         Delete (Str & Nul);      end Delete_Top_Unit;      File : Iir_Design_File;      Design_Unit : Iir_Design_Unit;      Lib_Unit : Iir;      Ent_Unit : Iir;      Str : String_Access;   begin      if Args'Length /= 0 then         Error ("command '--clean' does not accept any argument");         raise Option_Error;      end if;      Flags.Bootstrap := True;      --  Load libraries.      Libraries.Load_Std_Library;      Libraries.Load_Work_Library;      File := Get_Design_File_Chain (Libraries.Work_Library);      while File /= Null_Iir loop         --  Delete compiled file.         Str := Append_Suffix (Image (Get_Design_File_Filename (File)), "");         Delete_Asm_Obj (Str.all);         Free (Str);         Design_Unit := Get_First_Design_Unit (File);         while Design_Unit /= Null_Iir loop            Lib_Unit := Get_Library_Unit (Design_Unit);            case Get_Kind (Lib_Unit) is               when Iir_Kind_Entity_Declaration                 | Iir_Kind_Configuration_Declaration =>                  Delete_Top_Unit (Image (Get_Identifier (Lib_Unit)));               when Iir_Kind_Architecture_Declaration =>                  Ent_Unit := Get_Entity (Lib_Unit);                  Delete_Top_Unit (Image (Get_Identifier (Ent_Unit))                                   & '-'                                   & Image (Get_Identifier (Lib_Unit)));               when others =>                  null;            end case;            Design_Unit := Get_Chain (Design_Unit);         end loop;         File := Get_Chain (File);      end loop;   end Perform_Action;   type Command_Remove is new Command_Clean with null record;   function Decode_Command (Cmd : Command_Remove; Name : String)                           return Boolean;   function Get_Short_Help (Cmd : Command_Remove) return String;   procedure Perform_Action (Cmd : in out Command_Remove;                             Args : Argument_List);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -