variables in paramsets

From: Marq Kole <marq.kole_at_.....>
Date: Mon Dec 04 2006 - 01:38:44 PST

All,

I've been trying my hand at paramsets, but I've run across a weird passage in the standard text (LRM 2.2,  section 7.3.1, p. 138, 2nd paragraph) that says:

"Paramset statements may assign values to variables declared in the paramset; the values
need not be constant expressions. However, these variables shall not be used to assign
values to the module’s parameters. Paramset variables may be used to provide output
variables for instances that use the paramset; see Section 7.3.3."

My interpretation is: you can declare variables in the paramset statement, but you are not allowed to use them in a dot module parameter assignment, as that would "assign values to the module’s parameters".
This seems to exclude the use of paramset variables as for instance in the following piece of code:

paramset layoutres resistor;
  parameter real w = 1k from (0:inf);
  parameter real l = 1k from (0:inf);
  parameter real dw = 0 from [0:w);
  parameter real dl = 0 from [0:l);
  parameter real r = 0 from [0:inf);
  parameter real lr = 0;
  parameter real wr = 0;
  parameter real ar = 0;

  real leff, weff, aeff;

  leff = l - 2.0 * dl;
  weff = w - 2.0 * dw;
  aeff = leff*weff;

  .r=r + lr/leff + wr/weff + ar/aeff;

endparamset

Is this indeed what is intended by this paragraph? Of course, these variables are essentially auxillary variables and I can write everything out witout them, but that (1) significantly reduces readability, and (2) requires me to rely on the compiler's ability to optimize these expressions. And (3) for calculations that can not be written in closed form the code will have to move to the module itself. This kind of breaks the analogy with analog functions...

Cheers,
Marq


Marq Kole
Competence Leader Robust Design

Research
NXP Semiconductors
Received on Mon Dec 4 01:38:58 2006

This archive was generated by hypermail 2.1.8 : Mon Dec 04 2006 - 01:39:08 PST