Esempio n. 1
0
    def __init__(self, name, properties=None, own_schema=None, type=None):
        super(Enumeration, self).__init__(name=name, properties=properties)
        self._own_schema = own_schema
        self._type=type

        if self._type is not None:
            self._type = BasicType(name=self._type)
Esempio n. 2
0
    def __init__(self, name, properties=None, type=None, offset=None, width=None):
        super(Field, self).__init__(name=name, properties=properties)
        self._type = type
        self._offset = offset
        self._width = width

        if self._type is not None:
            self._type = BasicType(name=self._type, width=self._width)
Esempio n. 3
0
    def __init__(self,
                 name,
                 properties=None,
                 type=None,
                 offset=None,
                 width=None):
        super(Field, self).__init__(name=name, properties=properties)
        self._offset = offset
        self._width = width

        if type is not None:
            if not BasicType.is_basic_type(type):
                self._type_reference = EnumerationReference(type,
                                                            width=self._width)
                self._type = None
                self.insert(self._type_reference)
            else:
                self._type = BasicType(name=type, width=self._width)
Esempio n. 4
0
def _update_field_type_references(root):
    for field in root.iterate(nodes.Field):
        if field.type:
            continue
        reference = field.type_reference
        if isinstance(reference, EnumerationReference):
            field.type = EnumType(name=reference.name,
                                  basic_type=BasicType(
                                      name=reference.node.type.name,
                                      width=reference.width))
            if reference.width and reference.width < reference.node.bits_required:
                raise InvalidEnumWidthError(enumeration_name=reference.name,
                                            width=reference.node.bits_required,
                                            provided_width=reference.width)
Esempio n. 5
0
 def type(self):
     return BasicType(self._properties.type)