gthparch/macsim

frontend_c::btb_access function returns wrong value if BTB was disabled

Opened this issue · 0 comments

Hello,
First of all, thank you for the efforts. I have been using Macsim since its early days (2012) as a PhD student and still use it.
I appreciate its cleanness and readability.
Recently, I came across this issue in the branch prediction.
If BTB is disabled, my understanding is that this function in the frontend frontend_c::btb_access should return true. Since the semantics of the return is in fact whether it is a BTB miss (also as a side note for the same reason, I guess the naming of the function might be counter intuitive since it in fact determines whether it is a BTB miss or not).

If this understanding is correct, this line:
if (!*KNOB(KNOB_ENABLE_BTB)) return false;
should be:
if (!*KNOB(KNOB_ENABLE_BTB)) return true;

With the original code, whether BTB is disabled or perfect in fact gives the same result.

Thanks,
Mohamed