예제 #1
0
def GetModeOfNode(node: Iir) -> Mode:
    """Return the mode of a :obj:`node`."""
    if node == Null_Iir:
        raise ValueError("GetModeOfNode: Parameter 'node' must not be 'Null_iir'.")

    try:
        return __MODE_TRANSLATION[nodes.Get_Mode(node)]
    except KeyError:
        raise LibGHDLException("Unknown mode.")
예제 #2
0
 def inner(*args):
     try:
         return functionPointer(*args)
     except OSError as ex:
         errors = [str(ex)]
         raise LibGHDLException(
             "Caught exception when calling '{func}' in libghdl.".
             format(func=subprogramName),
             errors,
         ) from ex
예제 #3
0
def CheckForErrors() -> None:
    errorCount = errorout_memory.Get_Nbr_Messages()
    errors = []
    if errorCount != 0:
        for i in range(errorCount):
            rec = errorout_memory.Get_Error_Record(i + 1)
            # FIXME: needs help from @tgingold
            fileName = ""  # name_table.Get_Name_Ptr(files_map.Get_File_Name(rec.file))
            message = errorout_memory.Get_Error_Message(i + 1)

            errors.append(
                "{file}:{line}:{column}: {msg}".format(file=fileName, line=rec.line, column=rec.offset, msg=message)
            )

        raise DOMException("Error raised in libghdl.") from LibGHDLException("libghdl: Internal error.", errors)
예제 #4
0
파일: NonStandard.py 프로젝트: umarcor/ghdl
    def __ghdl_init(self):
        """Initialization: set options and then load libraries."""
        # Initialize libghdl
        libghdl_finalize()
        libghdl_initialize()

        # Collect error messages in memory
        errorout_memory.Install_Handler()

        libghdl_set_option("--std=08")

        parse.Flag_Parse_Parenthesis.value = True

        # Finish initialization. This will load the standard package.
        if libghdl_analyze_init_status() != 0:
            raise LibGHDLException("Error initializing 'libghdl'.")