Qucs / ADMS

ADMS is a code generator for the Verilog-AMS language
GNU General Public License v3.0
94 stars 31 forks source link

Propagate probe and variable dependencies into analog function output variables #85

Open tvrusso opened 5 years ago

tvrusso commented 5 years ago

Per issue #67, the default implicit templates for ADMS (specifically e:dependency) do not correctly propagate probe and variable dependencies of input arguments into all output arguments. They only do this correctly for the function return value (by propagating these dependencies into the global expression containing the analog function call).

This PR augments e:dependency so that it treats analog function output variables in much the same way that it treats the left-hand side of assignments, propagating all probe and variable dependencies, and also setting flags such as "setinmodel", "setinevaluate", etc. just as assignments do.

This should fix issue #67 and should obsolete PR #68

I am also attaching a tarball that can be used to evaluate this PR. It contains: rlc.va -- a simple series RLC model in Verilog A rlc_AF.va --- the same model, but with all computation moved down into an analog function with multiple output variables html_params.xml -- an ADMS "code generator" back-end that just makes an HTML file describing the module xyceBasicTemplates.xml --- some templates that html_params.xml uses two HTML files generated with html_params.xml from rlc.va and rlc_AF.va, using the fixed adms.implicit.xml file in this PR.

ADMS_AnalogFunctionIssue2.tar.gz

If one regenerates the HTML file from rlc_AF.va without using the fixes in this PR (e.g. with "admsXml -e xyceBasicTemplates -e html_params.xml rlc_AF.va"), one can see that the CapacitorCharge and InductorFlux variables are not properly marked with their dependencies on probes or parameters. As a result of this incorrect dependency tracking, the Jacobian is missing elements as well. Any real code generated from this model without these fixes would be wrong.