Sunday, 6 January 2008

Functional Testing of SPICE Simulations

After a second year electronics project, the need to automatically check the function of a large digital circuit arose. The brief was to design an 8-Bit ALU (basic logic, addition and 2's complement functions) with ring oscillator. The circuit then had to be converted to a layout to be manufactured as an integrated chip. The circuit although straightforward to design was difficult to 'route' and the final layout was messy.

SPICE

Thorough functional testing of our circuit was impossible using just the digital waveform view of PSPICE. To be sure of our layout and circuit designs I created a C program to read the simulation file created by PSPICE and check each clock cycle to ensure correct operation. The final program reads the exported PSPICE output .txt file and checks each line one at a time (actually it only checks one line from each clock, since this is all that's necessary). The program converts the analogue values into 1's or 0's before passing the data into a function to check that the output/input combinations are correct. Although the checking function will vary with every circuit to be tested, I publicise this code as an example of how to make testing large digital circuits easy, well easier.

Simulation files from LTSpice and OrCAD's PSPICE can be used, but the top line of the file (which usually contains the signal names) must be deleted first.

The code can be downloaded from the DocDrop folder 'SPICE Program'. DocDrop can be found at the top of the sidebar on this page.

No comments: