hwt/serializer/hwt/serializer.py
def asHdl(cls, obj, ctx: HwtSerializerCtx):
        """
        Convert object to HDL string

        :param obj: object to serialize
        :param ctx: HwtSerializerCtx instance
        """
        if isinstance(obj, RtlSignalBase):
            return cls.SignalItem(obj, ctx)
        elif isinstance(obj, Value):
            return cls.Value(obj, ctx)
        else:
            try:
                serFn = obj.asHwt
            except AttributeError:
                serFn = None
            if serFn is not None:
                return serFn(cls, ctx)

            try:
                serFn = getattr(cls, obj.__class__.__name__)
            except AttributeError:
                serFn = None

            if serFn is not None:
                return serFn(obj, ctx)

            raise SerializerException("Not implemented for %r" % (obj))
def asHdl(cls, obj, ctx: HwtSerializerCtx):
        """
        Convert object to HDL string

        :param obj: object to serialize
        :param ctx: HwtSerializerCtx instance
        """
        if isinstance(obj, RtlSignalBase):
            return cls.SignalItem(obj, ctx)
        elif isinstance(obj, Value):
            return cls.Value(obj, ctx)
        else:
            try:
                serFn = obj.asHwt
            except AttributeError:
                serFn = None
            if serFn is not None:
                return serFn(cls, ctx)

            try:
                serFn = getattr(cls, obj.__class__.__name__)
            except AttributeError:
                serFn = None

            if serFn is not None:
                return serFn(obj, ctx)

            raise SerializerException("Not implemented for %r" % (obj))
Convert object to HDL string

        :param obj: object to serialize
        :param ctx: HwtSerializerCtx instance