コード例 #1
0
    def parse(cls, constantNode: Iir) -> Union["Constant", "DeferredConstant"]:
        from pyGHDL.dom._Translate import (
            GetSubtypeIndicationFromNode,
            GetExpressionFromNode,
        )

        name = GetNameOfNode(constantNode)
        subtypeIndication = GetSubtypeIndicationFromNode(constantNode, "constant", name)
        defaultValue = nodes.Get_Default_Value(constantNode)
        if defaultValue != nodes.Null_Iir:
            defaultExpression = GetExpressionFromNode(defaultValue)

            return cls(
                constantNode,
                [
                    name,
                ],
                subtypeIndication,
                defaultExpression,
            )
        else:
            return DeferredConstant(
                constantNode,
                [
                    name,
                ],
                subtypeIndication,
            )
コード例 #2
0
ファイル: InterfaceItem.py プロジェクト: umarcor/ghdl
    def parse(cls, genericNode: Iir) -> "GenericConstantInterfaceItem":
        name = GetNameOfNode(genericNode)
        mode = GetModeOfNode(genericNode)
        subtypeIndication = GetSubtypeIndicationFromNode(genericNode, "generic", name)
        default = nodes.Get_Default_Value(genericNode)
        value = GetExpressionFromNode(default) if default else None

        return cls(
            genericNode,
            [
                name,
            ],
            mode,
            subtypeIndication,
            value,
        )
コード例 #3
0
ファイル: InterfaceItem.py プロジェクト: umarcor/ghdl
    def parse(cls, parameterNode: Iir) -> "ParameterSignalInterfaceItem":
        name = GetNameOfNode(parameterNode)
        mode = GetModeOfNode(parameterNode)
        subtypeIndication = GetSubtypeIndicationFromNode(parameterNode, "parameter", name)

        defaultValue = nodes.Get_Default_Value(parameterNode)
        value = GetExpressionFromNode(defaultValue) if defaultValue != nodes.Null_Iir else None

        return cls(
            parameterNode,
            [
                name,
            ],
            mode,
            subtypeIndication,
            value,
        )
コード例 #4
0
    def parse(cls, signalNode: Iir) -> "Signal":
        from pyGHDL.dom._Translate import (
            GetSubtypeIndicationFromNode,
            GetExpressionFromNode,
        )

        name = GetNameOfNode(signalNode)
        subtypeIndication = GetSubtypeIndicationFromNode(signalNode, "signal", name)
        default = nodes.Get_Default_Value(signalNode)
        defaultExpression = GetExpressionFromNode(default) if default else None

        return cls(
            signalNode,
            [
                name,
            ],
            subtypeIndication,
            defaultExpression,
        )
コード例 #5
0
    def parse(cls, variableNode: Iir) -> "Variable":
        from pyGHDL.dom._Translate import (
            GetSubtypeIndicationFromNode,
            GetExpressionFromNode,
        )

        name = GetNameOfNode(variableNode)
        subtypeIndication = GetSubtypeIndicationFromNode(variableNode, "variable", name)
        defaultValue = nodes.Get_Default_Value(variableNode)
        defaultExpression = None
        if defaultValue != nodes.Null_Iir:
            defaultExpression = GetExpressionFromNode(defaultValue)

        return cls(
            variableNode,
            [
                name,
            ],
            subtypeIndication,
            defaultExpression,
        )