def METHOD_NAME(self, tms: m.Bit) -> m.Bits[4]:
    self.yield_state = capture
    yield self.yield_state.prev()
    while True:
        if tms == 0:
            while True:
                self.yield_state = shift
                yield self.yield_state.prev()
                if tms != 0:
                    break
        self.yield_state = exit_1
        yield self.yield_state.prev()
        if tms == 0:
            while True:
                self.yield_state = pause
                yield self.yield_state.prev()
                if tms != 0:
                    break
            self.yield_state = exit_2
            yield self.yield_state.prev()
            if tms != 0:
                break
        else:
            break
    self.yield_state = update
    yield self.yield_state.prev()
    return tms