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

In both _armSTM() and _armLDM() functions, the handling of the writeBack variable is incorrect. #8

Open
fkuzume opened this issue May 12, 2024 · 0 comments

Comments

@fkuzume
Copy link

fkuzume commented May 12, 2024

I have reviewed the issue you pointed out concerning the writeBack mechanism in the title:_armSTM() and _armLDM() functions. Here's a proper analysis and the proposed solution.

In both the title:_armSTM() and _armLDM() functions, the handling of the writeBack variable is incorrect.

The current code updates the value of register rn when the writeBack flag is not set, which is contrary to the expected behavior. The update should occur when the writeBack flag is set.

Suggested Fix
Modify the code so that the update g.R[rn] = rnval only happens if the writeBack flag is set.
Apply the same logic correction to the _armLDM() function as well.

// Correction inside _armSTM()
writeBack := util.Bit(inst, 21)
if writeBack {
	g.R[rn] = rnval
}

// Correction inside _armLDM() (Assuming similar logic applies)
writeBack := util.Bit(inst, 21)
if writeBack {
	g.R[rn] = rnval
}

This correction ensures that the writeBack flag is handled correctly, aligning the function's behavior with the expected theoretical operation. If similar issues are found elsewhere in the code, I recommend applying the same fix.

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

1 participant