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, )
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, )
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, )
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, )
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, )