Arlet wrote:
I'm a bit confused about the state of the RDY signal during all of this. Is it being deasserted ? And if so, can you show the timing ? (note that I have no experience/knowledge of wishbone)
RDY is deasserted every other clock cycle b/c wishbone (without more control signals than I have available) requires two full clock cycles per xfer to work properly. I would need this wait state regardless of the issue I describe in subsequent paragraphs, but not the latched DI. See attachment.
Arlet wrote:
User sleary78 opened an issue on github that had to do with RDY, and I think the core has a problem in cases where RDY is being deasserted, and the data bus is invalid. In those cases, the bad data is used to drive the address bus.
https://github.com/Arlet/verilog-6502/issues/3 He closed the issue because he managed to find a workaround, but I still think there's a genuine bug in there.
I'll look into it and see if I can flush that bug out.
EDIT: The user seemed to have a bug similar to mine; he needed a delay element on DI to prevent the combinational connection of DI to AB from accessing a bad address. I needed it to prevent an infinite loop. The chance of needing this delay element
depends on how your address decoding is set up. The core works fine AS LONG AS the only thing it's connected to is a synchronous memory, and presumably synchronous I/O. Unfortunately, my I/O is asynchronous by virtue of asynchronous address decoding, which is the root of the problem. Data is placed on the 6502 core's bus immediately, not waiting for the next clock cycle to drive the bus; additionally the synchronous memory's address decoding mux is deactivated, so it stops driving the bus too early.
It's not really a bug... just a design decision that has potentially unexpected consequences. Oh, and if you need this delay element like I did... yes, the clock speed is effectively halved b/c of the added wait state (my complaint about 2/3's was something unrelated that I managed to solve).