next >   applet (800 × 600)   (1024 × 768)   (1280 × 1024) ©2001 Harald Bögeholz

Amazing space savings

In the previous scheme, let's assume we use the same number for both parameters a and b, and call it c. I.e., we use c lower order bits of the branch instruction's address and c bits of global history. Ordinarily we would need a table of 22c entries.

But here comes the magic trick: Use c lower bits of the branch instruction's address and XOR them with the c-bit global history. Use this as an index into a table of n-bit counters and voila:

We only need 2c × n bits!

Remember, it's a heuristic! Why can it work? Use the Java applet to see that most regular patterns reference only very few locations in the history table. So the table is used very sparsely, and we can cleverly overay several instances of tables, so to speak.