Phase III – Extending the Capabilities
By using the USB commands listed above in combination with the generic ictest.bit bitstream intended for bit-banging 74xx logic, it’s possible to implement a simple IC test bench where you just click pins on and off. And on that note, please peep the screenshot of the super-beta OpenTop testbench software. Give it a click to pop open a fullsize version to get a better look.
Fig 5 – OpenTOP Screenshot
For this section, we’ll discuss our little software tool. It’s in quite a state at the moment. It runs properly, but due to several internal revisions is a veritable goldmine (lead mine?) of unused, outdated, and simply lame subroutines.
It uses libusb, so on windows you’ll have to force the programmer to use the libusb driver. Shouldn’t be that big a deal except switching back and forth between libusb and the vendor-supplied Jungo Windriver is a pain. Once you’ve got the device using the libusb driver, the ORANGE section at top gets a connection to the programmer. Reset is in case you crash something and lose the connection – just give it a kick with Reset and you can reconnect.
This tool started as an entirely text-based way to send USB packets – the YELLOW sections. You can still send and receive single USB packets this way if you want to test some very low-level stuff. These bulk reads and bulk writes are handled discretely with no subroutines used.
Also handled discretly is the bitstream load in RED. Should probably update it to use the newer Read Packet / Write Packet subroutines, but it works for now. Browse around with the directory boxes and double click a bitstream to load it into the device. For most of the example work we’ll discuss here, you’ll want the 7K ICTEST.BIT that is found in the Topwin Blib directory. (C:toptopwinen3Blib)
Next section in GREEN is the scripting stuff. By capturing USB commands into a text file, this scripting section will read that text file and send/receive USB packets, one packet per line. The script file is a normal text file with the extension .TOP. The software strips whitespace and ignores anything after a “;” so you can comment your scripts if you like. Any numeric values in the file preceding a semicolon will be sent via USB. There is one “macro” command – $FF. A line starting with FF actually implements a delay in milliseconds, and is not sent down the USB pipe. A very simple example “startup” script would be a text file such as:
0E 14 00 00 ; Remove VPP from all pins
0E 15 00 00 ; Remove VCCx from all pins
0E 16 00 00 ; Remove GND from all pins
10 00 11 00 12 00 13 00 14 00 0A 15 FF ; Write all ZIF pins low
FF 0A ; Wait 10ms settling time
0E 16 09 00 ; Apply GND to ZIF 9
0E 15 0A 00 ; Apply VCCx to ZIF 10
FF 01; Delay 1mS
At which point you can start doing logic stuff to your hypothetical device. Double clicking a script name runs it once in text mode, which means that each line is read and evaulated one at a time. This becomes important when you enable script looping, as you can change the text file on the fly and have different stuff happen.
Script looping has two modes, text and binary. To run a text-mode loop, enter the number of times you want to loop, check the “Loop Script” box and double click the script name. The counter will decrement down and stop at 0. If your script reads something and you’d like to suppress that output, check “Loop Quiet”. To run a binary mode loop (much faster), only single-click the script name to select a script. Then, check the “Loop Script” box and hit the “Run Binary Loop” button. The counter will begin counting UP, and will loop forever until you uncheck the loop box. In binary mode, the script file is read into an array and is not evaluated each loop. But the operation is much faster, running hundreds or thousands of times per second.
On the bottom right in PURPLE is a script workbook where you can click various buttons in order to have the program spit out the current state of the supplies and pins for easy scripting. It should probably have a way to read/write files but it doesn’t. Maybe next version.
On the bottom left in BLUE is a live testbench where you can click different pins to turn them on/off, as well as configure the VCC, VPP, and GND for the device. This section relies on the vendor-supplied ICTEST.BIT bitstream, so load that before twiddling. You should probably also clear all the VCC, VPP, and GND pins after bitstream load. That’s done with the buttons on the top left of the testbench section.
When Auto Write/RD is checked, any clicks to the data pins automatically update the device and read the new pin states. When Auto-Fill is checked, those pin states are translated to checks. Good for getting initial condition, but after that turn off Autofill or it will drive you mad by turning off your pullups any time the external chip outputs a 0. If you don’t want to auto-update on every click, then uncheck those boxes and use the manual “Read Data, Write Data” buttons to update all your changes in one shot.
Continue to Next Page