CHECKING UP ON WinSIM

Topics relating to PALs, CPLDs, FPGAs, and other PLDs used for the support or creation of 65-family processors, both hardware and HDL.
Post Reply
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

CHECKING UP ON WinSIM

Post by BigDumbDinosaur »

WARNING: Long post!  :D

For some time, I’ve been fooling around with programmable logic devices (PLDs), using WinCUPL to write and simulate the logic.  WinCUPL’s occasionally-cantankerous behavior is well known around here; I’ve learned to live with it, but over time, have gotten somewhat suspicious of WinCUPL’s simulator, WinSIM.  Simulation uses data generated when the GAL logic is compiled to produce what WinSIM thinks will happen in-circuit.  It goes without saying that simulation is illusory; crashing a flight simulator isn’t quite as exciting as is doing the same thing in a real aircraft.  :D

With that in mind, I decided to design and build a contraption that can prove that the logic outputs of a GAL agree with the designed logic and what WinSIM displays.  Since the GAL under test would be in a “live” circuit in which inputs may be switched between low and high, it should possible to observe output behavior using a scope or logic analyzer under quasi-dynamic conditions.  Hence there would a possibility of seeing an anomaly that would not be apparent in simulation.

While it is possible to monkey-rig a GAL and some LEDs on a breadboard, a breadboard’s sometimes-flaky connections may introduce problems that will produce false results.  I figured it would be better to build a test gadget that could produce repeatable results, which meant it had to be fault-free in all respects.  So what I’ve done is expand on the monkey-rig concept to produce something that is easy to use, unambiguous in operation...and trustworthy.  :wink:

The test rig I built is designed to test a 22V10, which device has 12 dedicated input pins and 10 dual-purpose pins, the latter which may be programmed as inputs or outputs.  In my application, I am assuming that the dual-purpose pins are all outputs, an assumption that simplified the test rig’s design, as well as contained its cost.  I’m powering the test rig with 5 volts from an old PC power supply, since I always seem to have several laying around.

For convenience, the rig has a ZIF socket for the GAL under test.  I was less concerned with the cost of this socket than I was with its reliability and durability, so I chose quality over cheapness—unsurprisingly, it’s the most expensive single part on the rig.  :shock:  Although the socket is wired to accommodate a 22V10, which has 12 dedicated inputs, a 16V8 or 20V8 could be tested by employing a little Mickey-Mouse-ity with some short jumper wires.

The rig has an array of toggle switches to control the GAL’s inputs, the switches being debounced so they don’t introduce glitches that might mistakenly be seen as something caused by the GAL itself.  Each output on the GAL being tested ultimately drives a red/green pair of LEDs to indicate state, with the usual “red-means-high” arrangement.

As GAL outputs are TTL, I used 74ACT drivers to control the LEDs.  I did not bias the drivers’ inputs high or low, which means if the unit is powered with no GAL in the socket, or if one or more of the GAL’s outputs is floating, the corresponding LEDs will display random states.  A fancier design could be made to detect such a condition and disable the corresponding LEDs, but I didn’t want to go to that much trouble.

Here is a schematic of the unit...

gal_tester.pdf
GAL Test Rig Schematic
(69.3 KiB) Downloaded 148 times

...and here are some photos of the finished product.

GAL Test Rig
GAL Test Rig
GAL Test Rig ZIF Socket
GAL Test Rig ZIF Socket
GAL Test Rig Output State LEDs
GAL Test Rig Output State LEDs
GAL Test Rig Input Switches
GAL Test Rig Input Switches

The switches, from left to right, control the following inputs to the particular GAL that was the test guinea pig:

  • A15, A14, A13, A12, A11, A10, A9, A8, A7, A16, VADR, RWB


The switches are generically numbered 1-12, since their functions will naturally depend on how the GAL under test has been programmed.  In this case, VADR represents the ORing of the 65C816’s VDA and VPA outputs.

After admiring my handiwork, it was time to do some testing.  The guinea pig was the glue logic GAL in POC V1.4—a Microchip (Atmel) ATF22V10C, which has the following memory map:

Code: Select all

$000000-$00BFFF — base RAM
$00C000-$00C3FF — I/O hardware
$00C400-$00CFFF — system RAM
$00D000-$00FFFF — ROM (read-only)
$010000-$01FFFF — extended RAM

I/O Hardware Decoding
—————————————————————
$00C000-$00C07F — SIOA: DUART #1
$00C080-$00C0FF — SIOB: DUART #2
$00C100-$00C17F — SIOQ: vQUART status
$00C180-$00C1FF — RTC:  realtime clock
$00C200-$00C27F — XIOA: expansion ‘A’
$00C280-$00C28F — XIOB: expansion ‘B’
$00C300-$00C37F — XIOC: expansion ‘C’

ROM can be selected only when the MPU’s RWB output is high—a write operation goes nowhere.  The $00C380-$00C3FF address range is not decoded.

During initial testing, I took some voltage measurements for posterity.  VCC under load was 5.04.  The GAL’s unloaded VOH was ~4.2 volts—in this circuit, loading is vanishingly-small, with only the inputs to the CMOS LED drivers and some parasitic capacitance seen as outputs change state.  Curious as to how well the GAL can drive a load, I applied 3.3K to several outputs being driven high, which caused VOH to drop to ~3.7.  Increasing that load to 1K caused VOH to drop to ~3.5.  These results were significantly better than the data sheet specifications.  The GAL’s VOL was typically 0.12 with a 1K ohm load tied to VCC, also better than specified.  In a practical application, a GAL usually won’t see such loading.

What follows are some photos with the guinea pig in the socket, the test rig powered and various input combinations set.  After a period of operation, the GAL got noticeably warm, which is typical of these devices.

GAL Test: No Valid Address
GAL Test: No Valid Address

Above, VADR is false, which means the address bus state is undefined, a condition that occurs during intermediate execution cycles of some 65C816 instructions.  All GAL outputs are in the false state, which is what is expected.

GAL Test: RAM Selected
GAL Test: RAM Selected

Above, VADR is true and the effective address is $0000xx, resulting in RAM being selected.  The GAL’s /WSE (wait-state enable) output is false, since RAM accesses do not require a wait-state.  /WSE is represented by the leftmost red/green LED pair and /RAM is represented by the second-from-the-left pair.

GAL Test: ROM Selected
GAL Test: ROM Selected

Above, VADR is true, RWB is high (read) and the effective address is $00E0xx, resulting in ROM being selected.  /WSE has been driven true, since ROM accesses must be wait-stated.  Had RWB been low (write), /ROM would be false.  /ROM is represented by the third-from-the-left LED pair.

GAL Test: DUART #1 Selected
GAL Test: DUART #1 Selected

Above, VADR is true and the effective address is $00C00x, resulting in /SIOA (DUART #1) being true.  Again, /WSE is true, since I/O must also be wait-stated.  Although RWB is high, it’s a don’t-care if the effective address is selecting anything but ROM.  /SIOA is represented by the rightmost LED pair.

GAL Test: DUART #2 Selected
GAL Test: DUART #2 Selected

Above, VADR is true and the effective address is $00C08x, resulting in /SIOB (DUART #2) being true.  Once more, /WSE is true, and RWB is a don’t-care.  /SIOB is represented by the second-from-the-right LED pair.

While I was fooling around with the test rig, I connect the logic analyzer to see how quickly the GAL responds to input changes.  Here’s one capture:

Logic Analyzer Capture
Logic Analyzer Capture

In the above, the capture was triggered by the low-to-high transition of VADR.  The test rig switches were configured to generate the address $00C00x, which corresponds to a DUART #1 (/SIOA) chip select.  The logic analyzer was configured to sample signal states for a short period of time before VADR went true.  Elapsed time starts at the trigger event.

As can be seen, both /SIOA and /WSE apparently became true only 4 nanoseconds after VADR became true.  I say “apparently” because the logic analyzer’s maximum resolution is 2ns.  The GAL acting as the guinea pig is guaranteed to have 7.5ns pin-to-pin performance, which is possible in this case because all logic is combinatorial and doesn’t use any pins as nodes.  Hence the above capture implies that the logic analyzer is being optimistic about the guinea pig’s performance.  More likely, the switching speed is at least 5ns due to logic analyzer fudging.  Or...it could be 3ns, which is listed as a TPD minimum in the data sheet for simple, combinatorial logic—but seems very unlikely.  Either way, performance when compared to what would be achievable in equivalent discrete logic is excellent.  :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: CHECKING UP ON WinSIM

Post by BigDumbDinosaur »

In the same vein as the above GAL tester, I have a CPLD tester on the “drawing board.”  Functionally, the CPLD tester will be like the GAL tester, but more elaborate due to the greater number of signal pins and the fact that most of them may be programmed as inputs, outputs or bi-directional.  So there are going to be a lot more parts to make it all work.

Also, an array of jumper blocks is going to be needed to configure each signal pin according to its role in the CPLD’s design...input, output, etc.  Doing the PCB layout will be a challenge, since a lot of stuff will have to be crammed onto the board; it would be nice to not end up with a PCB that’s the size of a pizza box.  Also, there is the question of how to physically attach the test CPLD to the tester, since CPLDs are made in a variety of packages.  Having three or four different ZIF socket types on the same PCB seems impractical, since it’s likely most of them will see little use.

How to do all this has been keeping me up at nights.  :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: CHECKING UP ON WinSIM

Post by plasmo »

I have used CPLD fair bit over the years and found it to be reliable and trouble free so a tester had not been necessary. However, if I were to design a CPLD tester, I probably will use a CPLD to test another CPLD. Something similar to the attached picture where every CPLD pins are brought out and accessible to a CPLD-based tester. The tester board and device-under-test board may look very similar with two boards stacked on top of each other, except tester CPLD needs to have more pins to accept test vector inputs and report test results.

As a proof of concept, the board in the picture can serve as both CPLD tester and device-under-test by jumper 4 tester outputs to drive 4 inputs of the device-under-test and set aside two tester pins as serial input and serial output to receive test vectors and transmit test results.
Attachments
DSC_77550923.jpg
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: CHECKING UP ON WinSIM

Post by BigDumbDinosaur »

plasmo wrote:
I have used CPLD fair bit over the years and found it to be reliable and trouble free so a tester had not been necessary.

My concern is not whether the CPLD is reliable, but whether what WinSim reports during simulation of the design will, in fact, occur in a “live” situation.  This is the same rationale as for the genesis of the GAL tester.

The GAL tester proved that my proposed design for POC V1.5 would have had a timing race problem with bank latching.  Such a race is not detectable in simulation, since WinSim doesn’t know anything about internal device timing.  While the race problem would not have prevented operation, it would have produced unreliability at higher Ø2 rates.  That I discovered such a problem is all the more reason to be able to live-test a CPLD outside of the realm of a computer.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply