-- VHDL libraries handling. -- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 2, or (at your option) any later -- version. -- -- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Ada.Text_IO; use Ada.Text_IO; with Tables; with GNAT.OS_Lib; with Interfaces.C_Streams; with System; with Errorout; use Errorout; with Scanner; with Iirs_Utils; use Iirs_Utils; with Parse; with Name_Table; use Name_Table; with Str_Table; with Tokens; with Files_Map; with Flags; with Std_Package; with Disp_Tree; with Disp_Vhdl; with Sem; with Post_Sems; with Canon; with Nodes_GC; package body Libraries is -- Chain of known libraries. This is also the top node of all iir node. Libraries_Chain : Iir_Library_Declaration := Null_Iir; Libraries_Chain_Last : Iir_Library_Declaration := Null_Iir; -- A location for any implicit declarations (such as library WORK). Implicit_Location: Location_Type; -- Table of library pathes. package Pathes is new Tables (Table_Index_Type => Integer, Table_Component_Type => Name_Id, Table_Low_Bound => 1, Table_Initial => 4); -- Report an error message. procedure Error_Lib_Msg (Msg : String) is begin Report_Msg (Msgid_Error, Library, No_Location, Msg); end Error_Lib_Msg; procedure Error_Lib_Msg (Msg : String; Arg1 : Earg_Type) is begin Report_Msg (Msgid_Error, Library, No_Location, Msg, (1 => Arg1)); end Error_Lib_Msg; -- Report a warning message. procedure Warning_Lib_Msg (Msg : String; Args : Earg_Arr := No_Eargs) is begin Report_Msg (Msgid_Warning, Library, No_Location, Msg, Args); end Warning_Lib_Msg; -- Initialize pathes table. -- Set the local path. procedure Init_Pathes is begin -- Always look in current directory first. Name_Nil := Get_Identifier (""); Pathes.Append (Name_Nil); Local_Directory := Name_Nil; Work_Directory := Name_Nil; end Init_Pathes; function Path_To_Id (Path : String) return Name_Id is begin if Path (Path'Last) /= GNAT.OS_Lib.Directory_Separator then return Get_Identifier (Path & GNAT.OS_Lib.Directory_Separator); else return Get_Identifier (Path); end if; end Path_To_Id; procedure Add_Library_Path (Path : String) is begin if Path'Length = 0 then return; end if; -- Nice message instead of constraint_error. if Path'Length + 2 >= Nam_Buffer'Length then Error_Lib_Msg ("argument of -P is too long"); return; end if; Pathes.Append (Path_To_Id (Path)); end Add_Library_Path; function Get_Nbr_Pathes return Natural is begin
module absval_ref(input signed [3:0] a, output [3:0] y);
assign y = a[3] ? -a : a;
endmodule