Code: Select all
LUT6( DB[4], DB[5], DB[6], DB[7], SYNC, LUT4(DB[3:0]) )
Code: Select all
LUT6( DB[4], DB[5], DB[6], DB[7], SYNC, LUT4(DB[3:0]) )
Code: Select all
always @(*)
if( sync )
casez( DB )
8'b0000_0000: next = BRK0; // BRK
8'b0010_0000: next = JSR0; // JSR
8'b0100_0000: next = RTI0; // RTI
8'b0110_0000: next = RTS0; // RTS
8'b1000_0000: next = COND; // BRA
8'b???1_0000: next = COND; // other branches
8'b0?10_1000: next = PULL; // PLA/PLP
8'b0?00_1000: next = PUSH; // PHA/PHP
8'b?111_1010: next = PULL; // PLX/PLY
8'b?101_1010: next = PUSH; // PHY/PHX
8'b????_0001: next = IND0; // col 1 (ZP,X)/(ZP),Y
8'b???1_0010: next = IND0; // col 2 odd (ZP)
8'b????_0000: next = IMM0; // anything in col 0 not already done
8'b???0_0010: next = IMM0; // col 2 even (LDX#IMM)
8'b???0_1001: next = IMM0; // col 9 even
8'b???1_1001: next = ABS0; // col 9 odd
8'b????_11??: next = ABS0; // col c,d,e,f
8'b????_01??: next = ZPG0; // col 4,5,6,7
default: next = SYNC; // implied & undocumented
endcase
Code: Select all
always @(*)
case( state )
ABCD: mode = 0;
ABS0: mode = 4;
ABS1: mode = 2;
BRK0: mode = 9;
BRK1: mode = 8;
BRK2: mode = 8;
BRK3: mode = 15;
COND: mode = 7;
DATA: mode = 1;
IDX0: mode = 3;
IDX1: mode = 12;
IDX2: mode = 10;
IMM0: mode = 4;
IND0: mode = 4;
IND1: mode = 2;
JMP0: mode = 4;
JMP1: mode = 2;
JSR0: mode = 9;
JSR1: mode = 8;
JSR2: mode = 1;
PULL: mode = 5;
PUSH: mode = 11;
RDWR: mode = 0;
RTI0: mode = 5;
RTI1: mode = 5;
RTI2: mode = 5;
RTI3: mode = 2;
RTS0: mode = 5;
RTS1: mode = 5;
RTS2: mode = 14;
SYNC: mode = 4;
ZERO: mode = 3;
endcase