hwt/hdl/types/boolVal.py
def fromPy(cls, val, typeObj, vldMask=None):
        """
        :param val: value of python type bool or None
        :param typeObj: instance of HdlType
        :param vldMask: None vldMask is resolved from val,
            if is 0 value is invalidated
            if is 1 value has to be valid
        """
        vld = int(val is not None)
        if not vld:
            assert vldMask is None or vldMask == 0
            val = False
        else:
            if vldMask == 0:
                val = False
                vld = 0
            else:
                val = bool(val)

        return cls(val, typeObj, vld)
def fromPy(cls, val, typeObj, vldMask=None):
        """
        :param val: value of python type bool or None
        :param typeObj: instance of HdlType
        :param vldMask: None vldMask is resolved from val,
            if is 0 value is invalidated
            if is 1 value has to be valid
        """
        vld = int(val is not None)
        if not vld:
            assert vldMask is None or vldMask == 0
            val = False
        else:
            if vldMask == 0:
                val = False
                vld = 0
            else:
                val = bool(val)

        return cls(val, typeObj, vld)
:param val: value of python type bool or None
        :param typeObj: instance of HdlType
        :param vldMask: None vldMask is resolved from val,
            if is 0 value is invalidated
            if is 1 value has to be valid