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

📄 ghdllocal.adb

📁 vhdl集成电路设计软件.需要用gcc-4.0.2版本编译.
💻 ADB
📖 第 1 页 / 共 3 页
字号:
   function Decode_Command (Cmd : Command_Remove; Name : String) return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "--remove";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Remove) return String   is      pragma Unreferenced (Cmd);   begin      return "--remove           Remove generated files and library file";   end Get_Short_Help;   procedure Perform_Action (Cmd : in out Command_Remove; Args : Argument_List)   is      use Name_Table;   begin      if Args'Length /= 0 then         Error ("command '--remove' does not accept any argument");         raise Option_Error;      end if;      Perform_Action (Command_Clean (Cmd), Args);      Delete (Image (Libraries.Work_Directory)              & Back_End.Library_To_File_Name (Libraries.Work_Library)              & Nul);   end Perform_Action;   --  Command --disp-standard.   type Command_Disp_Standard is new Command_Lib with null record;   function Decode_Command (Cmd : Command_Disp_Standard; Name : String)                           return Boolean;   function Get_Short_Help (Cmd : Command_Disp_Standard) return String;   procedure Perform_Action (Cmd : in out Command_Disp_Standard;                             Args : Argument_List);   function Decode_Command (Cmd : Command_Disp_Standard; Name : String)                           return Boolean   is      pragma Unreferenced (Cmd);   begin      return Name = "--disp-standard";   end Decode_Command;   function Get_Short_Help (Cmd : Command_Disp_Standard) return String   is      pragma Unreferenced (Cmd);   begin      return "--disp-standard    Disp std.standard in pseudo-vhdl";   end Get_Short_Help;   procedure Perform_Action (Cmd : in out Command_Disp_Standard;                             Args : Argument_List)   is      pragma Unreferenced (Cmd);   begin      if Args'Length /= 0 then         Error ("command '--disp-standard' does not accept any argument");         raise Option_Error;      end if;      Flags.Bootstrap := True;      Libraries.Load_Std_Library;      Disp_Vhdl.Disp_Vhdl (Std_Package.Std_Standard_Unit);   end Perform_Action;   procedure Load_All_Libraries_And_Files   is      use Files_Map;      use Libraries;      use Errorout;      procedure Extract_Library_Clauses (Unit : Iir_Design_Unit)      is         Lib1 : Iir_Library_Declaration;         Ctxt_Item : Iir;      begin         --  Extract library clauses.         Ctxt_Item := Get_Context_Items (Unit);         while Ctxt_Item /= Null_Iir loop            if Get_Kind (Ctxt_Item) = Iir_Kind_Library_Clause then               Lib1 := Get_Library (Get_Identifier (Ctxt_Item),                                    Get_Location (Ctxt_Item));            end if;            Ctxt_Item := Get_Chain (Ctxt_Item);         end loop;      end Extract_Library_Clauses;      Lib : Iir_Library_Declaration;      Fe : Source_File_Entry;      File, Next_File : Iir_Design_File;      Unit, Next_Unit : Iir_Design_Unit;      Design_File : Iir_Design_File;      Old_Work : Iir_Library_Declaration;   begin      Lib := Std_Library;      Lib := Get_Chain (Lib);      Old_Work := Work_Library;      while Lib /= Null_Iir loop         --  Design units are always put in the work library.         Work_Library := Lib;         File := Get_Design_File_Chain (Lib);         while File /= Null_Iir loop            Next_File := Get_Chain (File);            Fe := Load_Source_File (Get_Design_File_Directory (File),                                    Get_Design_File_Filename (File));            if Fe = No_Source_File_Entry then               --  FIXME: should remove all the design file from the library.               null;            elsif Is_Eq (Get_File_Time_Stamp (Fe),                         Get_File_Time_Stamp (File))            then               --  File has not been modified.               --  Extract libraries.               --  Note: we can't parse it only, since we need to keep the               --    date.               Unit := Get_First_Design_Unit (File);               while Unit /= Null_Iir loop                  Load_Parse_Design_Unit (Unit, Null_Iir);                  Extract_Library_Clauses (Unit);                  Unit := Get_Chain (Unit);               end loop;            else               --  File has been modified.               --  Parse it.               Design_File := Load_File (Fe);               --  Exit now in case of parse error.               if Design_File = Null_Iir                 or else Nbr_Errors > 0               then                  raise Compilation_Error;               end if;               Unit := Get_First_Design_Unit (Design_File);               while Unit /= Null_Iir loop                  Extract_Library_Clauses (Unit);                  Next_Unit := Get_Chain (Unit);                  Set_Chain (Unit, Null_Iir);                  Add_Design_Unit_Into_Library (Unit);                  Unit := Next_Unit;               end loop;            end if;            File := Next_File;         end loop;         Lib := Get_Chain (Lib);      end loop;      Work_Library := Old_Work;   end Load_All_Libraries_And_Files;   procedure Check_No_Elab_Flag (Lib : Iir_Library_Declaration)   is      File : Iir_Design_File;      Unit : Iir_Design_Unit;   begin      File := Get_Design_File_Chain (Lib);      while File /= Null_Iir loop         Unit := Get_First_Design_Unit (File);         while Unit /= Null_Iir loop            if Get_Elab_Flag (Unit) then               raise Internal_Error;            end if;            Unit := Get_Chain (Unit);         end loop;         File := Get_Chain (File);      end loop;   end Check_No_Elab_Flag;   function Build_Dependence (Prim : String_Access; Sec : String_Access)     return Iir_List   is      procedure Build_Dependence_List (File : Iir_Design_File; List : Iir_List)      is         El : Iir_Design_File;         Depend_List : Iir_List;      begin         if Get_Elab_Flag (File) then            return;         end if;         Set_Elab_Flag (File, True);         Depend_List := Get_File_Dependence_List (File);         if Depend_List /= Null_Iir_List then            for I in Natural loop               El := Get_Nth_Element (Depend_List, I);               exit when El = Null_Iir;               Build_Dependence_List (El, List);            end loop;         end if;         Append_Element (List, File);      end Build_Dependence_List;      use Configuration;      use Name_Table;      Top : Iir;      Primary_Id : Name_Id;      Secondary_Id : Name_Id;      File : Iir_Design_File;      Unit : Iir;      Files_List : Iir_List;   begin      Check_No_Elab_Flag (Libraries.Work_Library);      Primary_Id := Get_Identifier (Prim.all);      if Sec /= null then         Secondary_Id := Get_Identifier (Sec.all);      else         Secondary_Id := Null_Identifier;      end if;      if True then         Load_All_Libraries_And_Files;      else         --  Re-parse modified files in order configure could find all design         --  units.         declare            use Files_Map;            Fe : Source_File_Entry;            Next_File : Iir_Design_File;            Design_File : Iir_Design_File;         begin            File := Get_Design_File_Chain (Libraries.Work_Library);            while File /= Null_Iir loop               Next_File := Get_Chain (File);               Fe := Load_Source_File (Get_Design_File_Directory (File),                                       Get_Design_File_Filename (File));               if Fe = No_Source_File_Entry then                  --  FIXME: should remove all the design file from                  --  the library.                  null;               else                  if not Is_Eq (Get_File_Time_Stamp (Fe),                                Get_File_Time_Stamp (File))                  then                     --  FILE has been modified.                     Design_File := Libraries.Load_File (Fe);                     if Design_File /= Null_Iir then                        Libraries.Add_Design_File_Into_Library (Design_File);                     end if;                  end if;               end if;               File := Next_File;            end loop;         end;      end if;      Flags.Flag_Elaborate := True;      Flags.Flag_Elaborate_With_Outdated := True;      Flag_Load_All_Design_Units := True;      Flag_Build_File_Dependence := True;      Top := Configure (Primary_Id, Secondary_Id);      if Top = Null_Iir then         --Error ("cannot find primary unit " & Prim.all);         raise Option_Error;      end if;      --  Add unused design units.      declare         N : Natural;      begin         N := Design_Units.First;         while N <= Design_Units.Last loop            Unit := Design_Units.Table (N);            N := N + 1;            File := Get_Design_File (Unit);            if not Get_Elab_Flag (File) then               Set_Elab_Flag (File, True);               Unit := Get_First_Design_Unit (File);               while Unit /= Null_Iir loop                  if not Get_Elab_Flag (Unit) then                     Add_Design_Unit (Unit, Null_Iir);                  end if;                  Unit := Get_Chain (Unit);               end loop;            end if;         end loop;      end;      --  Clear elab flag on design files.      for I in reverse Design_Units.First .. Design_Units.Last loop         Unit := Design_Units.Table (I);         File := Get_Design_File (Unit);         Set_Elab_Flag (File, False);      end loop;      --  Create a list of files, from the last to the first.      Files_List := Create_Iir_List;      for I in Design_Units.First .. Design_Units.Last loop         Unit := Design_Units.Table (I);         File := Get_Design_File (Unit);         Build_Dependence_List (File, Files_List);      end loop;      return Files_List;   end Build_Dependence;   --  Convert NAME to lower cases, unless it is an extended identifier.   function Convert_Name (Name : String_Access) return String_Access   is      use Name_Table;   begin      Name_Length := Name'Length;      Name_Buffer (1 .. Name_Length) := Name.all;      Scan.Convert_Identifier;      return new String'(Name_Buffer (1 .. Name_Length));   end Convert_Name;   procedure Extract_Elab_Unit     (Cmd_Name : String; Args : Argument_List; Next_Arg : out Natural)   is   begin      if Args'Length = 0 then         Error ("command '" & Cmd_Name & "' required an unit name");         raise Option_Error;      end if;      Prim_Name := Convert_Name (Args (Args'First));      Next_Arg := Args'First + 1;      Sec_Name := null;      if Args'Length >= 2 then         declare            Sec : String_Access := Args (Next_Arg);         begin            if Sec (Sec'First) /= '-' then               Sec_Name := Convert_Name (Sec);               Next_Arg := Args'First + 2;            end if;         end;      end if;   end Extract_Elab_Unit;   procedure Register_Commands is   begin      Register_Command (new Command_Import);      Register_Command (new Command_Check_Syntax);      Register_Command (new Command_Dir);      Register_Command (new Command_Find);      Register_Command (new Command_Clean);      Register_Command (new Command_Remove);      Register_Command (new Command_Disp_Standard);   end Register_Commands;end Ghdllocal;

⌨️ 快捷键说明

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