pascalkuthe / OpenVAF

An innovative Verilog-A compiler
https://openvaf.semimod.de/
GNU General Public License v3.0
122 stars 19 forks source link

Support multiplicity attribute #11

Open pascalkuthe opened 1 year ago

pascalkuthe commented 1 year ago

OpenVAF currently does not recognize the multiplicity attribute. This attribute has no impact on the actual simulation. It is only used to scale operating variables by $mfactor when reported to the simulator. Relevent excerpt from the Verilog-A LRM:

The multiplicity attribute is used to describe how the value of a parameter or variable should be scaled for reporting. The attribute must be assigned one of the following string values: "multiply", "divide", or "none". If the attribute is specified with the value "multiply", the value for the associated parameter or variable will be multiplied by the value of $mfactor for the instance in any report of operating-point values. If the attribute is specified with the value "divide", the value for the associated parameter or variable will be divided by the value of $mfactor for the instance in any report of operating-point values. If the multiplicity attribute is not specified, or specified with the value "none", then no scaling will be performed. Note that this scaling only applies to oper- ating-point value reports; it does not affect the automatic scaling detailed in 6.3.6.

This should be easy to implement however I assigned low priority as it does not affect simulation results and is only sparsely used in real-world models.

gjcoram commented 2 months ago

The multiplicity attribute should be more widely used in real-world models. In fact, many of the CMC standard models now have macros OPM and OPD: define OPM(nam,uni,des) (* units=uni, desc=des, multiplicity="multiply" *) real nam; define OPD(nam,uni,des) ( units=uni, desc=des, multiplicity="divide" ) real nam;