I think I have taken into account what advice has been posted in this thread and attempted to write my WinCUPL file so to not have any double-negative or inverted logic. I want all chip selects to be active-low. My cupl code is based on my understanding that the command
RAM = Address:[000x..BFFx] will set the variable RAM to a logical 1 if the current address falls in the range 0000 - BFFF. I want the RAM CS to be zero if this is the case, so use the "!" prefix to negate to a 0.
48K RAM, 16K ROM.
It compiles with zero errors or warnings. Here it is for comment...
Code:
Device p22v10;
/* Pin Map
--------
CLK |1 24| Vcc
RW |2 23| WEB
A15 |3 22| OEB
A14 |4 21| RAM_CSB
A13 |5 20| ROM_CSB
A12 |6 19| IO_0_CSB
A11 |7 18| IO_1_CSB
A10 |8 17| IO_2_CSB
A9 |9 16| IO_3_CSB
A8 |10 15| A4
A7 |11 14| A5
Gnd |12 13| A6
--------
*/
/*
=======================================
Inputs: All are signals from the 65C02
=======================================
*/
Pin 1 = CLK;
Pin 2 = RW;
Pin [3..11] = [A15..7];
Pin [13..15] = [A6..4];
/*
=================================================
Outputs: define outputs - all are positive logic
=================================================
*/
Pin 23 = WEB; /* to RAM and ROM chips */
Pin 22 = OEB; /* to RAM and ROM chips */
Pin 21 = RAM_CSB; /* to RAM /CS pin */
Pin 20 = ROM_CSB; /* to ROM /CS pin */
Pin 19 = IO_0_CSB; /* to IO_0 CS pin */
Pin 18 = IO_1_CSB; /* to IO_1 CS pin */
Pin 17 = IO_2_CSB; /* to IO_2 CS pin */
Pin 16 = IO_3_CSB; /* to IO_3 CS pin */
/*
===============
Local variables
===============
*/
FIELD Address = [A15..4];
RAM = Address:[000x..BFFx];
ROM0 = Address:[C00x..FDFx];
IO_0 = Address:[FE0x..FE0x];
IO_1 = Address:[FE1x..FE1x];
IO_2 = Address:[FE2x..FE2x];
IO_3 = Address:[FE3x..FE3x];
ROM1 = Address:[FF0x..FFFx];
/*
===============
Logic equations
===============
*/
WEB = !(CLK & !RW);
OEB = !(CLK & RW);
RAM_CSB = !RAM;
ROM_CSB = !(ROM0 # ROM1);
IO_0_CSB = !IO_0;
IO_1_CSB = !IO_1;
IO_2_CSB = !IO_2;
IO_3_CSB = !IO_3;
Dave.