def split(self, bitindex):
        """Split a promise into two promises at the provided index.

        A common operation in JTAG is reading/writing to a
        register. During the operation, the TMS pin must be low, but
        during the writing of the last bit, the TMS pin must be
        high. Requiring all reads or writes to have full arbitrary
        control over the TMS pin is unrealistic.

        Splitting a promise into two sub promises is a way to mitigate
        this issue. The final read bit is its own subpromise that can
        be associated with a different primitive than the 'rest' of
        the subpromise.

        Returns:
            Two TDOPromise instances: the 'Rest' and the 'Tail'.
            The 'Rest' is the first chunk of the original promise.
            The 'Tail' is a single bit sub promise for the final bit
              in the operation

            If the 'Rest' would have a length of 0, None is returned

        """
        if bitindex < 0:
            raise ValueError("bitindex must be larger or equal to 0.")
        if bitindex > len(self):
            raise ValueError(
                "bitindex larger than the array's size. "
                "Len: %s; bitindex: %s"%(len(self), bitindex))

        if bitindex == 0:
            return None, self
        if bitindex == len(self):
            return self, None

        left = TDOPromise(self._chain, self._bitstart, bitindex,
                          _parent=self)
        #Starts at 0 because offset is for incoming data from
        #associated primitive, not location in parent.
        right = TDOPromise(self._chain, 0, len(self)-bitindex,
                          _parent=self)
        self._components = []
        self._addsub(left, 0)
        self._addsub(right, bitindex)
        return left, right
Split a promise into two promises at the provided index.

        A common operation in JTAG is reading/writing to a
        register. During the operation, the TMS pin must be low, but
        during the writing of the last bit, the TMS pin must be
        high. Requiring all reads or writes to have full arbitrary
        control over the TMS pin is unrealistic.

        Splitting a promise into two sub promises is a way to mitigate
        this issue. The final read bit is its own subpromise that can
        be associated with a different primitive than the 'rest' of
        the subpromise.

        Returns:
            Two TDOPromise instances: the 'Rest' and the 'Tail'.
            The 'Rest' is the first chunk of the original promise.
            The 'Tail' is a single bit sub promise for the final bit
              in the operation

            If the 'Rest' would have a length of 0, None is returned