limiting syntax

From: Geoffrey.Coram <Geoffrey.Coram@analog.com>
Date: Wed May 05 2004 - 06:35:31 PDT

Hi -
There's a minor inefficiency and potential for a
major error due to the way we're specifying the
syntax for limiting, for the case of P-type devices.

In standard C code, you'd get something like
  vgs = TYPE * (v[g] - v[s]);
and then limit Vgs:
  vgs = fetlim(vgs, vgso, vto);
However, in our extensions,
we require the first argument of $limit to be
the branch potential V(g,s), without the TYPE
factor.

One might be tempted to write
  vgs = TYPE * $limit(V(g,s), "fetlim", vto);
but this would be an ERROR!! because V(g,s)
would be a negative number for a PMOS device,
and hence fetlim would not do the right thing.

The correct way to do this, with the current
syntax, is
  if (TYPE==1)
    Vgs = $limit(V(g,s), "fetlim", vto);
  else
    Vgs = $limit(V(s,g), "fetlim", -vto);

This is a little more typing, and compilers would
need to be smart enough to realize that they don't
need to keep state for the other side of the if
branch.

Does anyone feel that the potential for error is
significant enough that we should investigate a
syntax that would allow for $limit to operate on
a constant_expression * V(g,s) ?

-Geoffrey
Received on Wed May 5 06:36:08 2004

This archive was generated by hypermail 2.1.8 : Wed May 05 2004 - 06:36:47 PDT