CX4 Accuracy Improvements - #305
Open
AkiteruSDA wants to merge 7 commits into
Open
Conversation
- Extra cycles tick down at 20MHz effective instead of 80MHz - JP takes 3 20MHz cycles if taken, 1 if not taken - SKIP takes 2 20MHz cycles if taken, 1 if not taken
- Set wait cycles based on current opcode, not next - Fix BUSRD never returning to idle when finished
- For OP_JP and OP_WAI, wait in ST_CPU_1 for their respective conditions instead of taking the full instruction loop every time - Adjust bus read delay from 9 to 10
mrehkopf
reviewed
Aug 25, 2026
| if(cpu_wait_subcyc == 2'b11) begin | ||
| cpu_wait_subcyc <= 2'b00; | ||
| cpu_wait <= cpu_wait - 1; | ||
| if(cpu_wait == 8'h01) CPU_STATE <= ST_CPU_0; |
Owner
There was a problem hiding this comment.
With cpu_wait == 8'h00 as set by non-taken branches and SPEED set to normal, doesn't this make the CPU wait for 255 cycles before continuing to ST_CPU_0?
Author
There was a problem hiding this comment.
Thanks for the review! The CPU only ever goes to ST_CPU_4 on taken branches, so I believe that case isn't possible unless there's a mistake in my logic. I wasn't able to see any though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One other thing I had in mind but didn't implement was using WS1 for the bus read delay. I wasn't sure what the best way of implementing that would be because I don't have a full understanding of how the core reads from the bus and how many cycles that really takes, and how you would take that into account when using WS1, so I opted for adjusting the constant. With the other changes, 16 ran too slow compared to original carts, but 10 has very close results in MMX2/3.
Other than CX4-lag heavy sections and wireframe timing being more accurate to the original carts, one of the more significant improvements with these changes is that the X2 intro demo now syncs, whereas before X would end up dying. Here's a video with some quick comparisons: https://www.youtube.com/watch?v=5g1n6vVjAMc
These changes were only tested on a MK2 since that's the only SD2SNES I own.