That's exactly the limitation, however the difference between a GAL and a CPLD is that the CPLD can borrow PT from neighbor cells (which are either not connected to an PIN or to a PIN which is used as input) and it can produce intermediate terms and route them internally like in the following excerpt
Code:
D0 = (XXL_61
# (A1 & A2 & A3 & A4));
D1 = ((A0 & A2 & A3 & A1)
# (A0 & A2 & A3 & A4)
# XXL_62
# (A0 & !A2 & A3 & !A4 & !A1));
D2 = ((!A1 & !A2 & A3 & A4)
# XXL_63
# (A1 & A2 & A3 & A4));
!D3 = ((!A3 & !A4 & !A2)
# XXL_64
# (!A3 & !A4 & !A0));
D4 = XXL_65;
D5 = (XXL_66
# XXL_67
# (!A0 & A2 & !A3 & A4));
D6 = XXL_68;
D7 = ((A0 & !A1 & A3 & !A2)
# XXL_69
# (!A0 & A1 & A3 & !A4));
IOEN = (!A7 & A8 & A9 & A10 & A11 & A12 & A13 & A14 & A15);
MEMEN = (XXL_70
# !A13);
RD = (PHI2 & RW);
WR = (!PHI2 & !RW);
XXL_61 = ((A1 & !A2 & !A3 & A4)
# (A1 & A2 & !A3 & !A4)
# (!A1 & A2 & A3 & !A4 & !A0)
# (!A1 & A2 & !A3 & A0)
# (!A1 & !A2 & A3 & A4));
XXL_62 = ((!A0 & A2 & !A4 & A1)
# (!A0 & A3 & !A4 & A1)
# (!A0 & !A2 & A3 & A4 & !A1)
# (A0 & !A2 & !A3 & A4 & !A1)
# (!A0 & A2 & !A3 & A4));
XXL_63 = ((!A2 & A3 & A0 & !A1)
# (A2 & A3 & !A4 & !A0)
# (!A2 & !A3 & A4 & !A0 & A1)
# (A2 & !A3 & !A4 & A0 & A1)
# (A2 & A3 & A4 & A0));
And last but not least, you can in-circuit program the CPLD using a JTAG adapter.
And here is a small example of an all-in-one GLUE logic for an SBC with 128bytes IO and 128kbyte RAM (using a 65SC816 but only decoding A16). It enables the internal ROM table after reset and when writing to an address, in this example 0xFF80, disables the internal table and you are left with a RAM only SBC. IO is placed at 0xFF00..FF7F. Eventually you need to decode the IO addresses to support more devices with an additional IC. But 65xx peripherals have the CS2 which you can map to A4, A5, A6 which would give you three peripheral ICs
Code:
Name SBC Bootloader ;
PartNo A ;
Date 07.12.2019 ;
Revision 01 ;
Designer cbscpe ;
Company privat ;
Assembly none ;
Location CH ;
Device f1504ispplcc44 ;
PROPERTY ATMEL {preassign = KEEP};
PIN = A0;
PIN = A1;
PIN = A2;
PIN = A3;
PIN = A4;
PIN = A5;
PIN = A6;
PIN = A7;
PIN = A8;
PIN = A9;
PIN = A10;
PIN = A11;
PIN = A12;
PIN = A13;
PIN = A14;
PIN = A15;
PIN = A16;
/*
PIN = A16;
PIN = A17;
PIN = A18;
PINNODE = A19;
PINNODE = A20;
PINNODE = A21;
PINNODE = A22;
PINNODE = A23;
*/
PIN = PHI2;
PIN = RW;
PIN = RD;
PIN = WR;
PIN = RESET;
PIN = IOEN;
PIN = MEMEN;
PINNODE = BOOT;
PIN = D0;
PIN = D1;
PIN = D2;
PIN = D3;
PIN = D4;
PIN = D5;
PIN = D6;
PIN = D7;
FIELD DATA = [D7..0];
FIELD ADDR = [A16..0];
TABLE [A4..0] => DATA {
'h'E5 => 'h'A9;
'h'E6 => 'h'03;
'h'E7 => 'h'8D;
'h'E8 => 'h'08;
'h'E9 => 'h'FE;
'h'EA => 'h'A2;
'h'EB => 'h'00;
'h'EC => 'h'AD;
'h'ED => 'h'08;
'h'EE => 'h'FE;
'h'EF => 'h'6A;
'h'F0 => 'h'90;
'h'F1 => 'h'FA;
'h'F2 => 'h'AD;
'h'F3 => 'h'09;
'h'F4 => 'h'FA;
'h'F5 => 'h'C9;
'h'F6 => 'h'EA;
'h'F7 => 'h'F0;
'h'F8 => 'h'07;
'h'F9 => 'h'95;
'h'FA => 'h'00;
'h'FB => 'h'E8;
'h'FC => 'h'D0;
'h'FD => 'h'EE;
'h'FE => 'h'E5;
'h'FF => 'h'FF;
}
A16.l = D0.io;
A16.le = !PHI2;
/*
[A23..16].l = DATA.io;
[A23..16].le = !PHI2;
*/
DATA.oe = PHI2 & RW & ADDR:['h'FFE0..FFFF] & BOOT;
RD = PHI2 & RW;
WR = !PHI2 & !RW;
BOOT.ap = RESET;
BOOT.ar = ADDR:['h'FF80] & PHI2 & !RW;
BOOT.ck = 'b'0;
BOOT.d = 'b'0;
IOEN = ADDR:['h'FF00..FF7F];
MEMEN = ADDR:['h'0000..EFFF]
# ADDR:['h'10000..1FFFF]
# ADDR:['h'FF80..FFFF] & !RW
# ADDR:['h'FF80..FFFF] & RW & !BOOT;
Peter