Hello, LEON Community,
During my work on LEON3, I needed some performance counters to test and verify results. Therefore, I implemented single-cycle accurate performance counters. I attached the performance counter patch to this message as well as an example to how to use them. The
header file in the example should be easily included in any code-base and the macros that read the performance counters are straightforward.
The implementation of the performance counters is a bit heavy; therefore, it might restrain how big your design can be. For me, on a VC707, the design went down from 8 cores to 4 cores. The reason behind this drop is that I implement banks for the performance
counters. These banks can store a "snapshot" of ALL the performance counters. Then, one can read the values one by one. The counters are 64-bits. Therefore, it is pretty hard to overflow these counters.
Supported counters are as follows:
- Time Stamp (TS)
- Instruction Cache Total Misses
- Instruction Cache Total Accesses
- Data Cache Total Misses
- Data Cache Total Accesses
- Branchprediction Total Miss-predicts
- Branchprediction Total Predicts
I have left out one important counter, which is Total Instructions Committed. However, I am planning to add this in the future.
The default setting is that the design has TWO banks. Both Macros, the one that start the performance counters and the one that stop them, actually record a snapshot of the performance counters into one bank OR the other; these snapshots-recording are each
one instruction that takes one cycle. Subsequently, the program starts to fetch the performance counters one by one and perform a subtraction to find the measurements for the code.
The ISA was modified to include special instructions for the performance counter; HOWEVER, no modification is needed for the compiler. If you have the time and you look through the header file, you will see a simple trick that I came-up with to include custom
instructions in the compiled code.
If anyone has any idea/question, please feel free to ask it here so people can contribute/assist.
Posted by: alhawaj <alhawaj-fWAZDB8bsKe+fmr0zi+kZQ@public.gmane.org>