|
From: <sd...@cl...> - 2005-04-22 18:55:58
|
Hi Guys --
> > I have tested the function of 'NUMPARAM' and I have got some errors.
> > Following examples have problems.
> >
> > (1) The X line is before '.subckt' line.
> > In this case, 'X1 1 2 3 4 mos' has been transformed to 'X1'.
> > Ngspice outputs "error: unknown subckt: x1".
> >
> > numparam test
> > .param wx=10u
> > .param wy=3
> > **
> > X1 1 2 3 4 mos
> > **
> > vdd 1 3 1
> > vss 3 0 0
> > vgg 2 0 1
> > vbb 4 0 0
> > **
> > .subckt mos 1 2 3 4
> > m1 1 2 3 4 nch w={wx*wy} l=0.5u
> > + ad={wx*wy*1u} as={wx*wy*1u} + pd={(wx*wy+1u)*2} ps={(wx*wy+1u)*2} +
> > nrd={0.01u/wx/wy} nrs={0.01u/wx/wy}
> > .ends mos
> > .dc vdd 0 3 0.01 vgg 0 3 0.5
> > .model nch nmos level=14 vtho=0.5 .end
IIRC, the parser is supposed to make three passes through the
netlist. The first time around it makes a list of all .models which
it finds. The second time around it processes the SPICE cards, and
creates the CKT datastructures. The third time around it resolves all
model references with the list of models creaded during the first
pass. I must look to see if it also lists the .subckts in the first
pass. I believe it should. . . . .
> I have made some small changes to the numparam library that I've not
> yet submitted, but still get the same problem (after fixing the line
> breaks in the above). I'll have a look at this shortly to see if there
> is a easy fix.
>
> For now it seems that .subckt must be before Xxxx lines that call them.
Is this behavior specific to the numparam library, or is it a generic
problem? Please test this. . . . .
> > (2) '.subckt' line has '.params:'. This causes the program freeze.
> >
> > numparam test
> > .param wx=10u
> > vdd 1 3 1
> > vss 3 0 0
> > vgg 2 0 1
> > vbb 4 0 0
> > **
> > .subckt mos 1 2 3 4 params:wy=3
> > m1 1 2 3 4 nch w={wx*wy} l=0.5u
> > + ad={wx*wy*1u} as={wx*wy*1u} + pd={(wx*wy+1u)*2} ps={(wx*wy+1u)*2} +
> > nrd={0.01u/wx/wy} nrs={0.01u/wx/wy}
> > .ends mos
> > **
> > X1 1 2 3 4 mos
> > **
> > .dc vdd 0 3 0.01 vgg 0 3 0.5
> > .model nch nmos level=14 vtho=0.5 .end
>
> This is a limitation of numparam's implementation I think.
Does numparam replace the usual parser calls to process each SPICE
card? If not, the problem is (again) in the parser, which doesn't
expect to see additional stuff at the end of a .model line, I believe.
Stuart
|