Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong pointer used for poping btb queue #70

Open
robert-g-liu opened this issue Aug 15, 2023 · 2 comments
Open

wrong pointer used for poping btb queue #70

robert-g-liu opened this issue Aug 15, 2023 · 2 comments

Comments

@robert-g-liu
Copy link

Literally in the btbQueuePointer the comment pointes out The "tailPtr" points the address of a next pushed entry.

BTB used headPtr for pushing entry. See code line below.

    else if (pushBtbQueue) begin
        btbQueue[headPtr].btbWA <= btbWA[INT_ISSUE_WIDTH-1];
        btbQueue[headPtr].btbWV <= btbWV[INT_ISSUE_WIDTH-1];
    end 

Similarly, to pop the queue, tailPtr was used so stale/invalid data was fetched:

    // Pop btb Queue
    if (!empty && !updateBtb) begin
        popBtbQueue = TRUE;
        btbWE[0] = TRUE;
        btbWA[0] = btbQueue[tailPtr].btbWA;
        btbWV[0] = btbQueue[tailPtr].btbWV;
    end 
@robert-g-liu
Copy link
Author

Gshare branch predicator has the same issue. After local fix, improvement on both Num of branch prediction misses and IPC could be seen.

@reo-pon
Copy link
Contributor

reo-pon commented Aug 29, 2023

Thank you for reporting the issue.
What you pointed out is indeed correct.
I have confirmed that the number of branch mispredictions and IPC improved after the fix.

I will push the fix to the repository soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants