|
From: Steven B. <ste...@di...> - 2005-04-22 18:24:26
|
On 22 Apr 2005, at 16:37, Hitoshi Tanaka wrote:
> Dear all,
>
> 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
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.
>
> (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.
There is this comment in the src/frontend/numparam/readme.txt...
The <value> parts are supposed to be default values of the parameters.
However, in the current version of Numparam, they are not used and
each
invocation of the subcircuit must supply the _exact_ number of actual
parameters.
On my version the program dose not freeze. I get...
******
** ngspice-15 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please submit bug-reports to: ngs...@li...
** Creation Date: Thu Apr 21 19:47:35 BST 2005
******
Circuit: numparam test
15: Mismatch: 1 formal but 0 actual params.
15: WY=$;
15: Syntax error: letter [$]
15: Expression err: $
15: Formula() error.
Copies=15 Evals=14 Placeholders=7 Symbols=3 Errors=5
Numparam expansion errors: Run Spice anyway? y/n ?
This slight improvement might, or might not, be due to the fixes that I
yet to submit.
>
> The following example is able to analyze normally.
> numparam test
> .param wx=10u
> .param wy=3
> 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
> **
> 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
Yes, this works fine.
>
> Regards,
> Hitoshi Tanaka
>
I think we need to treat the numparam library is rather crude and
'experimental' at the moment. One of the changes I'm about to submit
implement a switch so it can be turned on/off before a circuit is
loaded. I'll arrange it so it defaults to being off.
For the record I've attached the three circuits as files - they'll be
good as test circuit if we can fix the numparam library
Regards,
Steven
|