You can easily capture a simulated waveform of any kind and turn it into an ideal signal source for driving a test bench. Advantages to doing this include:
- You can get a much more realistic circuit stimulus than what can be created using the standard ideal or PWL sources;
- Much faster simulation times can be realized by eliminating chunks of "real" circuitry and replacing them with captured signals from the circuitry that was removed. (For example, you could capture a DAC output and use it to drive a filter and/or other circuitry, eliminating the DAC.)
Here's the procedure for doing it:
- Run the simulation to create the transient waveform you're interested in capturing.
- Capture the waveform to the calculator.
- Print out the waveform as text, setting the "start" and "stop" times to provide exactly an integer number of cycles (or even just one cycle) of the desired waveform (assuming it is periodic). Using AWD, use the "printvs" function to do this. For Wavescan, click on the Table button.
- Save the results at a text file. For AWD, In the Results Display window, click Window-->Print, and click the "File" radio button, fill in path for the text file you want to make. Click OK. For Wavescan, click "Save as CSV" to save the file as a .csv (comma delimitted) text file.
- Use a text editor to strip out the header lines from the text file you made. If your time record does not start at zero seconds, use a spreadsheet function (such as Excel) to subtract the starting time from all the times in the file, so it starts with zero seconds. (Otherwise your ideal function will not start till the start time in the file.) If your file is CSV, strip out the commas and replace them with spaces (can do automatically with find/replace in any text editor).
- Insert a vpwlf component (from analogLib) into your circuit. Fill in the complete path to the text file in the "PWL file name" field. Fill in the "Period of the PWL" field with the exact length (in time) of the file.
- When you run the sim, the waveform you captured will be replicated exactly. You can also time scale it if you want using the "Time Scale Factor" field, and amplitude scale it using the "Scale Factor" field, and delay its start using "Delay Time".
It takes a few minutes to do all this, but definitely can be worth it!
- HughOriginally posted in cdnusers.org by Hugh