On Sun, May 01, 2005 at 10:55:18PM +0200, Shahab Sanjari wrote:
Hi,
This one is somehow off topic, actually a general question about SPICE
simulation, but I thought I'd better ask it here.
Is it possible to tell the SPICE, that a voltage source doesn't generate
according to a fix function, but rather reads a file from hard disk
which has data in it? For example an ASCII file that has two columns
separated with tabs or space, one for time and the other for amplitude.
I could then feed this into my custom made filter to check the output.
I don't think there is a direct way to accomplish what you're looking
to do here, but there is a slight variant that I normally use. You
don't specify which SPICE version you are using, so the following idea
might need some tweaking but in general what I do is to create a file
with the voltage time pairs (one per line) and then include this file
in the top level spice netlist. For example, create a file that looks
like this:
+ 0e-9 1
+ 1e-9 1.1
+ 2e-9 2.1
+ 3e-9 3.1
etc...
Then it's easy to script a solution that adds a few lines at the top
and bottom of the file so that it looks like this:
Vsource pos_node neg_node pwl (
+ 0e-9 1
+ 1e-9 1.1
+ 2e-9 2.1
+ 3e-9 3.1
)
I use this in HSPICE, I hope it is supported in ngspice as well but
you might need to tweak this somewhat.
Then simply include this file in the toplevel netlist and you should
be good to go.
HTH
--
Daniel Nilsson