I've hit possibly the most subtle issue yet; it depends on the combination of:
- RDY being used (this is the most important pre-condition)
- Read-Modify-Write to ZP (e.g. ASL, ROL)
- Decimal Mode (for ASL anyway)
The bug results in the N flag being inconsistent with the result.
In following tests, location &80 is the flags after the ASL, and bit 7 (the N flag) should always match bit 7 of the result (in &81).
First, with decimal mode off: Then, with decimal mode on: I think I'm correctly following your suggested pattern for using RDY with syncronous memory. I also checked your implementation of RDY, and this looks solid to me. Every use of posedge clk is qualified by RDY, and this is the only use of RDY.
This is with the generic version of your core (I haven't tried the spartan6 version for this failure)
Looking at the microcode, there does seem to be an unexpected (to me) difference between &14C and &1CC
Code: Select all
@14C 000_00001_01_000_0111_10011_00_00101100 // ASL, NZC -> @12C
@1CC 100_00001_01_000_0111_10011_00_00011111 // ASL, NZC -> @11F
The microcode for ROL is:
Code: Select all
@152 100_00001_01_000_0111_10011_10_00011111 // ROL, NZC -> @11F
@1D2 100_00001_01_000_0111_10011_10_00011111 // ROL, NZC -> @11F
Should all of these routines finish at &12C/&1AC?
Dave