diff options
Diffstat (limited to 'pyGHDL/libghdl/libraries.py')
-rw-r--r-- | pyGHDL/libghdl/libraries.py | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/pyGHDL/libghdl/libraries.py b/pyGHDL/libghdl/libraries.py index 5cc110c8f..ef3d8e98d 100644 --- a/pyGHDL/libghdl/libraries.py +++ b/pyGHDL/libghdl/libraries.py @@ -37,32 +37,41 @@ from ctypes import c_int32 from pydecor import export from pyGHDL.libghdl import libghdl +from pyGHDL.libghdl._types import NameId, Iir_Library_Declaration, Iir_Design_Unit, Iir_Design_File, Location_Type +from pyGHDL.libghdl._decorator import BindToLibGHDL -__all__ = ["Library_Location", "Work_Library"] +__all__ = [ + "Library_Location", + "Work_Library" +] -from pyGHDL.libghdl._types import NameId +Library_Location: Location_Type = c_int32.in_dll(libghdl, "libraries__library_location") +""" +A location for library declarations (such as library WORK). Use ``.value`` to +access this variable inside libghdl. +""" - -Library_Location = c_int32.in_dll( - libghdl, "libraries__library_location" -) #: A location for library declarations (such as library WORK). Type ``Location_Type``. Use ``.value`` to access this variable inside libghdl -Work_Library = c_int32.in_dll( - libghdl, "libraries__work_library" -) #: Library declaration for the work library. Note: the identifier of the work_library is ``work_library_name``, which may be different from 'WORK'. Type: ``Iir_Library_Declaration``. Use ``.value`` to access this variable inside libghdl +Work_Library:Iir_Library_Declaration = c_int32.in_dll(libghdl, "libraries__work_library") +""" +Library declaration for the work library. Note: the identifier of the work_library +is ``work_library_name``, which may be different from 'WORK'. Use ``.value`` to +access this variable inside libghdl. +""" @export -def Get_Libraries_Chain(): +@BindToLibGHDL("libraries__get_libraries_chain") +def Get_Libraries_Chain() -> Iir_Library_Declaration: """ - Get the chain of libraries. Can be used only to read (it mustn't be modified). + Get the chain of libraries. Can be used only to read (it mustn't be modified). - :return: Type ``Iir_Library_Declaration`` + :return: undocumented """ - return libghdl.libraries__get_libraries_chain() @export -def Add_Design_Unit_Into_Library(Unit, Keep_Obsolete: bool = False) -> None: +@BindToLibGHDL("libraries__add_design_unit_into_library") +def Add_Design_Unit_Into_Library(Unit: Iir_Design_Unit, Keep_Obsolete: bool) -> None: """ Add or replace an design unit in the work library. DECL must not have a chain (because it may be modified). @@ -71,7 +80,7 @@ def Add_Design_Unit_Into_Library(Unit, Keep_Obsolete: bool = False) -> None: Units are always appended to the design_file. Therefore, the order is kept. - :param Unit: Type: ``Iir_Design_Unit`` + :param Unit: undocumented :param Keep_Obsolete: If :obj:`Keep_Obsolete` is True, obsoleted units are kept in the library. @@ -79,50 +88,49 @@ def Add_Design_Unit_Into_Library(Unit, Keep_Obsolete: bool = False) -> None: in the library and then processed (without that feature, redefined units would disappear). """ - libghdl.libraries__add_design_unit_into_library(Unit, Keep_Obsolete) @export -def Purge_Design_File(Design_File) -> None: +@BindToLibGHDL("libraries__purge_design_file") +def Purge_Design_File(Design_File: Iir_Design_File) -> None: """ - Remove the same file as DESIGN_FILE from work library and all of its units. + Remove the same file as :obj:`Design_File` from work library and all of its units. - :param Design_File: Type: ``Iir_Design_File`` + :param Design_File: undocumented """ - libghdl.libraries__purge_design_file(Design_File) @export -def Find_Entity_For_Component(Name: NameId): +@BindToLibGHDL("libraries__find_entity_for_component") +def Find_Entity_For_Component(Name: NameId) -> Iir_Design_Unit: """ Find an entity whose name is :obj:`Name` in any library. |br| If there is no such entity, return :attr:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir`. |br| If there are several entities, return :attr:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir`; :param Name: Entity name to search for. - :return: Type: ``Iir_Design_Unit`` + :return: undocumented """ - return libghdl.libraries__find_entity_for_component(Name) @export -def Get_Library_No_Create(Ident: NameId): +@BindToLibGHDL("libraries__get_library_no_create") +def Get_Library_No_Create(Ident: NameId) -> Iir_Library_Declaration: """ Get the library named :obj:`Ident`. - :param Ident: Libryr to look for. - :return: Return :attr:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir` if it doesn't exist. Type ``Iir_Library_Declaration`` + :param Ident: Library to look for. + :return: Return :attr:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir` if it doesn't exist. """ - return libghdl.libraries__get_library_no_create(Ident) @export -def Find_Primary_Unit(Library, Name: NameId): +@BindToLibGHDL("libraries__find_primary_unit") +def Find_Primary_Unit(Library: Iir_Library_Declaration, Name: NameId) -> Iir_Design_Unit: """ Just return the design_unit for :obj:`Name`, or ``NULL`` if not found. - :param Library: Library to look in. Type: ``Iir_Library_Declaration`` + :param Library: Library to look in. :param Name: Primary unit to search for. - :return: Type: ``Iir_Design_Unit`` + :return: undocumented """ - return libghdl.libraries__find_primary_unit(Library, Name) |