Hi guys
I'm still shuffling along with my Blue816 65816 design - almost there, though.
Presently, I'm running tests on my CPLD logic in WinCUPL + WinSim and have run into (hopefully just) a possible simulation snag and was wondering if anyone has encountered this before.
I have two 8 bit latches (used as registers) that I want to use which both read their value from, and write their value to, the data bus. When I try to simulate it I find the the output to the databus is always low. If boil the design down to what is needed to test this, the simulator still has the same issue, but when I write the JED file into an actual ATF1508AS it *seems* to behave correctly, but I'm not entirely trusting of it.
For those familiar with ATF1508AS / WinCUPL / Abel, is the follow the correct way of doing this (I added pin numbers in for the actual device testing) / have you encountered this and know of any possible gotchas previously doing the same? I'm at the stage where I've all but completed the CPLD and am about to fix the pin numbers, so want to be sure of this.
Code:
Name Test;
Partno C;
Date 01/01/2022;
Revision 01;
Designer mjkd;
Company None;
Assembly None;
Location None;
Device f1508ispplcc84;
property atmel {cascade_logic on };
property atmel {fast_inlatch on };
property atmel {foldback_logic on };
property atmel {logic_doubling on };
property atmel {optimize on };
property atmel {output_fast off };
property atmel {pin_keep off };
property atmel {preassign keep };
property atmel {security off };
property atmel {xor_synthesis off };
Pin 2 = iPHI2; /* Fixed pin 2: Main CPU clock (GCLK2) */
Pin 12 = iRWB; /* Fixed pin 12: CPU read/!write */
/* Data bus pin */
Pin 20 = ioD;
/* inputs to indicate which latch to read from or write to */
Pin 21 = OptdataselA;
Pin 22 = OptdataselB;
/* Latches */
Pinnode = LatchA;
Pinnode = LatchB;
/* write to or read from latch A */
LatchA.L = ioD; /* connect latch A to the data pin */
LatchA.LE = iPHI2 & OptdataselA & !iRWB; /* latch data to latch A if latch A selected and we're writing */
LatchA.OE = OptdataselA & iRWB; /* allow latch A output if latch A selected and we're reading */
/* write to or read from latch B */
LatchB.L = ioD; /* connect latch B to the data pin */
LatchB.LE = iPHI2 & OptdataselB & !iRWB; /* latch data to latch B if latch B selected and we're writing */
LatchB.OE = OptdataselB & iRWB; /* allow latch B output if latch B selected and we're reading */
ioD = (LatchA # LatchB); /* connect the data pin to the output of both latches */
ioD.OE = (OptdataselA # OptdataselB) & iRWB; /* enable the data pin output if we're reading and one of the latches is selected */