next > ©2001 Harald Bögeholz

Detecting patterns

Counters are better than single bits, but they are still not very good at recognizing simple patterns. In the sequence

T T NT T T NT T T NT . . .

every third branch (the NT ones) is mispredicted. Or, even worse, if we assume the counter is zero at the beginning, every single branch in the following pattern is mispredicted:

T NT T NT T NT T NT T NT . . .