hoglet67 / BeebFpga

48 stars 8 forks source link

T65 DI/DO Loopback Question #17

Closed sharpie7 closed 2 years ago

sharpie7 commented 2 years ago

More a question that an issue:

In the T65 header it says:

--   TAKE CARE you route the DO signal back to the DI signal while R_W_n='0',
--   otherwise some undocumented opcodes won't work correctly.
--   EXAMPLE:
--      CPU : entity work.T65
--          port map (
--              R_W_n   => cpu_rwn_s,
--              [....all other ports....]
--              DI      => cpu_din_s,
--              DO      => cpu_dout_s
--          );
--      cpu_din_s <= cpu_dout_s when cpu_rwn_s='0' else 
--                   [....other sources from peripherals and memories...]

I can't see this in the code. Obviously it works. Am I missing something?

hoglet67 commented 2 years ago

No you're not missing anything.

The only game I know of that uses undocumented opcodes is Zalaga, and that seems to work correctly.

I wasn't going to add this until it proved to be neccessary, as the CPU data bus is one of he critical timing paths.

I was a bit surprised though by this thread: https://stardot.org.uk/forums/viewtopic.php?t=20350

Are you getting those artifacts?

If they occur, and this is the cause, then I have no problem adding this in. The timing is only tight on some of the older Spartan 3 targets which are rarely used now.

hoglet67 commented 2 years ago

Thinking about this some more, all of my implementations use fast asynchronous SRAM external to the FPGA, so this cpu_do -> cpu_di path does actually happen via the pads of the FPGA.

If you are experiencing this "vertical blinds" issue, I'm happy to add this in.

sharpie7 commented 2 years ago

I haven't seen any issue. I am using onboard RAM but I haven't checked if there is any any muxing of the signals in front of that.

I would be inclined to take an "if it aint broke, don't fix it" approach for now, but maybe add a comment next to the big statement that assigns DI to explain what's been done and why.

sharpie7 commented 2 years ago

Actually, I am now seeing the "vertical blind" effect. It isn't visible on the aliens when they are in formation, but when they dive they look like they have vertical stripes, so perhaps this loopback is needed.

hoglet67 commented 2 years ago

OK, happy to do that.

hoglet67 commented 2 years ago

That's fixed now.

You might also want to pull in ba820f07 which fixes an issue with Pharoah's Curse.

All of the other recent work I've been doing as relates to the Papilio Duo build, so is not directly relevant to you.

sharpie7 commented 2 years ago

Thanks. That looks good now!

hoglet67 commented 2 years ago

Do let me know if you find issues with any other games.

(I did a fair amount of testing this week against various "benchmark" games that are known to be tricky for emulators)

sharpie7 commented 2 years ago

Thanks. Will do. I think we've (well you mostly) have already closed most of the bug that fraustrated me on the original MISTer version.

It seems to be a very solid emulation.