@staticmethod
def from_field(field: Field) -> 'RGField':
    name = field.name
    assert isinstance(name, str)
    width = field.bits.width()
    assert isinstance(width, int)
    lsb = field.bits.lsb
    assert isinstance(lsb, int)
    reset_value = (field.resval or 0)
    assert isinstance(reset_value, int)
    swaccess = field.swaccess.key
    assert isinstance(swaccess, str)
    return RGField(name, width, lsb, reset_value, swaccess)
@staticmethod
def from_field(field: Field) -> 'RGField':
    name = field.name
    assert isinstance(name, str)
    width = field.bits.width()
    assert isinstance(width, int)
    lsb = field.bits.lsb
    assert isinstance(lsb, int)
    reset_value = (field.resval or 0)
    assert isinstance(reset_value, int)
    swaccess = field.swaccess.key
    assert isinstance(swaccess, str)
    return RGField(name, width, lsb, reset_value, swaccess)