Ok, I've got a really odd issue
Posted: Mon Apr 28, 2025 3:10 am
This is on my JRC-1 system. 8 MHz, 2 x 1 MB RAM, 512 KB ROM (currently on a memsim emulator)
Basically, I've got an issue where certain memory pages get corrupted in multiple banks.
1. The pages in question are for the same pages as used for the stack and direct page, just not in bank 0.
2. I can move the stack around and watch the page corruption move with it.
3. It only happens to banks on the first RAM chip (banks $00-$07). Banks $08-$0F are unaffected.
4. No other pages in these banks are corrupted.
5. The problem persists even if I swap the 16 MHz crystal for a 4 MHz one.
6. The problem does not move if I swap the RAM chips around.
7. The problem happens early in boot, before interrupts are even on. I've verified this by copying one of the affected pages to a safe spot during boot.
The corrupted bytes look to be related to the bank address. Sometimes the byte becomes the bank address, sometimes it's partial:
The bank address logic is the usual setup with a '573 and a '245:
The memory section is mostly just parallel connections but I'm including it anyway:
The I/O decoding is done mostly in an ATF1504. Here's the Verilog code for it:
There is a small additional bit of logic included in the on-board SPI65 (another ATF1504) that produces RDB and WRB signals by qualifying RWB with PHI2. This was done to save a chip and because the main glue logic 1504 was out of pins.
Everything else about this system is 100% stable for the last 3 years. The fact that it follows the stack and direct page around, and only affects those pages, suggests it's not some general problem with the circuit or the glue logic equations.
Best guess so far (and I'm grasping at straws here) is that some stack/dp instructions have a dead cycle in them that somehow trips up the glue logic. Otherwise I am stumped.
Basically, I've got an issue where certain memory pages get corrupted in multiple banks.
1. The pages in question are for the same pages as used for the stack and direct page, just not in bank 0.
2. I can move the stack around and watch the page corruption move with it.
3. It only happens to banks on the first RAM chip (banks $00-$07). Banks $08-$0F are unaffected.
4. No other pages in these banks are corrupted.
5. The problem persists even if I swap the 16 MHz crystal for a 4 MHz one.
6. The problem does not move if I swap the RAM chips around.
7. The problem happens early in boot, before interrupts are even on. I've verified this by copying one of the affected pages to a safe spot during boot.
The corrupted bytes look to be related to the bank address. Sometimes the byte becomes the bank address, sometimes it's partial:
Code: Select all
* 01/400.4ff
01/0400: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
01/0410: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
01/0420: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
01/0430: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
01/0440: 55 55 55 55 55 55 55 55 55 55 55 55 55 01 55 01 | UUUUUUUUUUUUU?U?
01/0450: 55 01 55 01 55 55 55 55 55 01 55 01 55 55 55 55 | U?U?UUUUU?U?UUUU
01/0460: 55 01 55 01 01 55 01 55 01 01 01 01 01 55 01 01 | U?U??U?U?????U??
01/0470: 01 55 01 01 01 45 01 41 55 01 01 01 01 55 01 01 | ?U???E?AU????U??
01/0480: 61 01 51 01 55 01 55 01 55 55 61 01 61 01 55 01 | a?Q?U?U?UUa?a?U?
01/0490: 55 01 55 01 01 01 01 55 61 55 01 55 01 55 01 55 | U?U????UaU?U?U?U
01/04A0: 01 55 01 01 55 55 55 55 01 55 55 01 55 55 55 55 | ?U??UUUU?UU?UUUU
01/04B0: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
01/04C0: 01 55 01 41 01 01 01 41 01 01 55 01 41 01 01 45 | ?U?A???A??U?A??E
01/04D0: 41 C1 01 01 01 C1 01 01 01 01 01 01 01 41 01 01 | AA???A???????A??
01/04E0: 01 01 01 41 01 41 01 01 01 01 E1 E1 01 01 41 01 | ???A?A????a???A?
01/04F0: 01 01 01 01 55 01 55 01 01 55 01 55 55 55 01 55 | ????U?U??U?UUU?UCode: Select all
* 04/400.4ff
04/0400: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
04/0410: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
04/0420: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
04/0430: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
04/0440: 55 55 55 55 55 55 55 55 55 55 55 55 55 04 55 55 | UUUUUUUUUUUUU?UU
04/0450: 55 55 55 55 55 55 55 55 55 55 04 55 55 55 55 55 | UUUUUUUUUU?UUUUU
04/0460: 55 55 04 55 04 55 04 55 04 55 55 04 04 55 04 04 | UU?U?U?U?UU??U??
04/0470: 55 04 04 04 04 04 55 55 04 04 04 55 04 04 04 04 | U?????UU???U????
04/0480: 04 04 04 04 04 04 04 04 55 04 04 04 54 04 04 64 | ????????U???Td?d
04/0490: 55 04 04 55 04 55 55 55 55 55 55 04 04 04 04 04 | U??U?UUUUUU?????
04/04A0: 55 55 55 55 04 55 55 55 04 55 55 04 04 55 04 55 | UUUU?UUU?UU??U?U
04/04B0: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 | UUUUUUUUUUUUUUUU
04/04C0: 04 54 04 55 55 55 55 55 54 44 55 55 04 55 04 84 | ?T?UUUUUTDUU?U??
04/04D0: 04 84 04 84 55 84 04 A4 84 A4 84 A4 04 04 84 04 | ????U??$?$?$????
04/04E0: 04 04 84 04 84 04 84 A4 64 04 A4 A4 04 04 04 84 | ???????$d?$?????
04/04F0: 04 84 04 55 24 C5 55 55 55 55 04 15 55 55 04 55 | ???U$EUUUU??UU?UCode: Select all
module jigl (
input wire A4,
input wire A5,
input wire A8,
input wire A9,
input wire A10,
input wire A11,
input wire A12,
input wire A13,
input wire A14,
input wire A15,
input wire A16,
input wire A17,
input wire A18,
input wire A19,
input wire A20,
input wire VDA,
input wire VPA,
input wire nRESET,
output wire RESET,
output wire nROMCS,
output wire nRAM1CS,
output wire nRAM2CS,
output wire nVIASEL,
output wire nSPISEL,
output wire nUARTSEL,
output wire nSLOTEN,
output wire nSLOT1SEL,
output wire nSLOT2SEL,
output wire nSLOT3SEL
);
// True if current acess is in bank 0
wire bank0 = ~A20 && ~A19 && ~A18 && ~A17 && ~A16;
// True if current acess is the LOWROM area ($00/F800 - $FFFF)
wire lowrom = bank0 && A15 && A14 && A13 && A12 && A11;
// True if the current acess is in HIGHROM ($10/0000 - $13/FFFF)
wire highrom = A20 && ~A19 && ~A18;
// True if current acess is in RAM
wire ram = ~A20;
wire ram1 = ram && ~A19;
wire ram2 = ram && A19;
// True for accesses in the $00/F000 - $F7FF range
wire io = bank0 && A15 && A14 && A13 && A12 && ~A11 && (VDA || VPA);
// Internal I/O devices
wire intio = io && ~A10 && ~A9 && ~A8;
wire via = intio && ~A5 && ~A4;
wire spi = intio && ~A5 && A4;
wire uart = intio && A5 && ~A4;
// Slots
wire slot1 = io && ~A10 && ~A9 && A8;
wire slot2 = io && ~A10 && A9 && ~A8;
wire slot3 = io && ~A10 && A9 && A8;
wire sloten = slot1 || slot2 || slot3;
// Assign active low output signals
assign RESET = ~nRESET;
assign nROMCS = ~(lowrom || highrom);
assign nRAM1CS = ~(ram1 && ~io && ~lowrom);
assign nRAM2CS = ~ram2;
assign nVIASEL = ~via;
assign nSPISEL = ~spi;
assign nUARTSEL = ~uart;
assign nSLOTEN = ~sloten;
assign nSLOT1SEL = ~slot1;
assign nSLOT2SEL = ~slot2;
assign nSLOT3SEL = ~slot3;
endmoduleEverything else about this system is 100% stable for the last 3 years. The fact that it follows the stack and direct page around, and only affects those pages, suggests it's not some general problem with the circuit or the glue logic equations.
Best guess so far (and I'm grasping at straws here) is that some stack/dp instructions have a dead cycle in them that somehow trips up the glue logic. Otherwise I am stumped.