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

Prefetch Everywhere #123

Merged
merged 8 commits into from
Apr 20, 2016
Merged

Prefetch Everywhere #123

merged 8 commits into from
Apr 20, 2016

Conversation

larsbrinkhoff
Copy link
Member

@larsbrinkhoff larsbrinkhoff commented Apr 5, 2016

This makes all instructions do one prefetch cycle. So far I have not considered the placement of the prefetch inside the old instructions. The clocked instructions does it right, except some should also have an additional prefetch.

The treatment of instructions using ea_set_prefetch_before_write is not very good. Presumably, EA calculation should fetch words from the prefetch queue, and refill it.

@larsbrinkhoff
Copy link
Member Author

There was one strange thing I stumbled across: prefetch in the old MOVEM. The code calls cpu_prefetch once for each register written. I don't know why, but it doesn't seem right.

The clocked MOVEM gained a new state at the end to do a prefetch. This is in line with the Yacht table.

@stefanberndtsson
Copy link
Member

I think that old MOVEM stuff was just a mistake. Things went a bit quick to stuff cpu_prefetch-lines in there.

@larsbrinkhoff larsbrinkhoff force-pushed the prefetch branch 2 times, most recently from 3203df8 to 1698145 Compare April 6, 2016 12:05
@stefanberndtsson
Copy link
Member

I think we need to find a way to introduce the irc/ir/ird steps of the prefetch (and stop loading yacht-"p":s manually). To make the clocked instructions and a proper generic EA there, the current naive prefetch doesn't really cut it, and trying to make both of them work at once doesn't really seem sensible.

@larsbrinkhoff
Copy link
Member Author

Yes, my next step was to do the full IRC/IR/IRD thing.

This work only applies to the old CPU.

@stefanberndtsson
Copy link
Member

Ahh... Good.. It'll help a lot in clocked stuff :)

@larsbrinkhoff
Copy link
Member Author

I keep forgetting to state why I'm making a change.

The overall purpose of this work is to:

  1. Remove the need for a hard-coded wait state in cpu.c.
  2. Make some instructions pair, so that Level 16 "Full Screen", and TOS-Crew "Rasters" work.

All instructions with a prefetch cycle last will effectively be synchronised with the MMU. That should take care of the first point.

Special attention to the bus accesses in MOVE, ADD, CMP, and Bcc will then ensure those instructions pair as expected.

@larsbrinkhoff
Copy link
Member Author

@stefanberndtsson I added proper prefetch to all clocked instructions.

Due to the use of ASSERT in fetch_instr and cpu_prefetch, we can be sure that the prefetch queue stays balanced at all times.

This step adds prefetch to all instructions used to boot to the Desktop, and
running various programs.
Adds prefetch to untested instructions.
@larsbrinkhoff larsbrinkhoff force-pushed the prefetch branch 2 times, most recently from 36969f7 to b718bef Compare April 20, 2016 07:22
@larsbrinkhoff larsbrinkhoff changed the title WIP: Prefetch Everywhere Prefetch Everywhere Apr 20, 2016
@larsbrinkhoff
Copy link
Member Author

Even though there is still more prefetch work to do, I consider this useful and complete enough to submit for merging.

All instructions now do some prefetching. When running from RAM, this synchronises the CPU with the MMU bus cycles. So wait states can be done properly.

Also, the new clocked instructions can now work with the prefetch queue, and do prefetch bus cycles in the right places.

@larsbrinkhoff
Copy link
Member Author

Level 16 Full Screen Demo now works fully, including the first part with PSG accesses.

BIG Demo still loads.

Phalanx Demo F1 took a hit. Sometimes the lower border switch to low resolution comes too late. Probably related to exception timing.

This was referenced Apr 20, 2016
@stefanberndtsson stefanberndtsson merged commit e7dd266 into nocrew:master Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants