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

Missing RAW for some branches #702

Open
lupino3 opened this issue Aug 28, 2022 · 1 comment
Open

Missing RAW for some branches #702

lupino3 opened this issue Aug 28, 2022 · 1 comment

Comments

@lupino3
Copy link
Member

lupino3 commented Aug 28, 2022

Consider the following

.code
        slt r1, r2, r4
        beqz r1, finish
finish: nop

With forwarding enabled, EduMIPS64 does not show any stalls, because - in the internal implementation - the semaphore for r1 that is locked by slt for writing to it is unlocked before beqz needs to read it.

This is not consistent with the description in Hennessy & Patterson, which says that the ID cycle of the branch will be executed before the EX stage of the ALU instruction (slt).

In terms of implementation, it would be very hard to change the execution order of stages in EduMIPS64 without introducing bugs. I think a practical solution may be to delay unlocking the registers until the end of the cycle execution (the IF stage).

Thanks to Dr. Sergio Santander Jiménez for raising this problem and providing examples and references for me to understand it.

@lupino3
Copy link
Member Author

lupino3 commented Sep 4, 2022

All the calls to decrWriteSemaphore are in this form:

    cpu.getRegisterFP(params.get(FD_FIELD)).decrWriteSemaphore();

In order to have the register unlocked at the end of the current CPU cycle, we need to add a new method to the CPU to schedule the register for unlocking at the end of the cycle.

In short, instructions won't be able to handle unlocking directly. They'll need to defer to the CPU.

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

No branches or pull requests

1 participant