-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Is it OK to have a branch prediction counter (the internal counter value that eventually gets output in the format 0 branch_count field) that's less than 32 bits (e.g. to make it possible to hit the maximum value in simulation without simulating billions of branches)? The branch_count field itself would be 32 bits but I just mean that the internal counter is smaller so that the upper bits in the packet cannot be 1.
My inclination is that the answer is yes. If your implementation has a maximum value of N then you'd output a packet with count=N after every N+31 correctly predicted branches and then upon a mispredict, you'd output a final packet with the last few branches. This is just like what happens when N=232-1.
For instance, if N=1023 and you have 5000 correctly predicted branches, you'd output four packets with count=1023 and then a packet with count=753 (which is 5000-4*(1023+31)-31). Or it doesn't even seem like N needs to be a power of two minus 1 so if N=1234 and you have 5000 correctly predicted branches, you'd output three packets with count=1234 and then a packet with count=1174 (which is 5000-3*(1234+31)-31).