hello SI-list, I have a problem concerning the syntax of parameter passing in Spice. Our Spice simulator should be HSpice compatible. I have a problem with the way the scope of the parameters are handled, either our Spice simulator handles this as HSpice syntax or it does not or HSpice syntax is not rational. From the manual I read the following definitions: If a parameter is defined more than once in an (input) deck then -1- it is assigned a global .param defined value, if it exists and otherwise -2- it is assigned a .param defined value of the .X statement, if it exists and otherwise -3- it is assigned a .param defined value of the .subckt statement, if it exists and otherwise -4- it is assigned a .param defined value inside (local) of the .subckt statement I do not like statement -1- because it takes precedence over the others. If I run the file below then these definitions are correctly parsed, however, this does not seem rational. I would expect that parameters inside .subckt would be local and hidden, unless no values are assigned. This is in effect a definition of "scope of variables". The above definitions do not hide variables and they are, therefor, unreliable. If I do a search with google I find that passed parameters overide local subckt or global .param statements. This makes sense to me and actually statement -1- should be at the bottom. My questions are: -1- Are the above definitions a correct representation of the scope of variables in HSpice (which we assume is the reference and which our Spice simulator vendor claims compatibility with - I cannot find the scope rules used in HSpice on the internet) -2- If they are correct then how are side-effects minimised in practice, I use underscored variables in subckt as a solution, but I do not like this. Below is a file, it contains a resistive divider consisting of r1 and r2, the output node should be 0.5V and 0.25V for the global and subcicuits, however, the subcircuits xdiv1, xdiv2, xdiv3 will use the global defined r1 value of 3 and not the passed value of 1. The xdiv4 usesunderscored variable _r1=1 and this works, but I do not like this solution. ***************************************** test for parameter passing *** global param for r1 .param r1=3 *** global circuit v1 1 0 DC 1 r1 1 divg r1 r2 divg 0 1 *** 1st subckt, local r1 .subckt div1 vout .param r1=1 v1 1 0 DC 1 r1 1 vout r1 r2 vout 0 1 .ends div1 *** 2nd subckt, local r1 and param value default .subckt div2 vout params: r1=1 v1 1 0 DC 1 r1 1 vout r1 r2 vout 0 1 .ends div2 *** 3rd subckt, no local r1 .subckt div3 vout v1 1 0 DC 1 r1 1 vout r1 r2 vout 0 1 .ends div3 *** 4th subckt, redefined variable using underscore, a solution?? .subckt div4 vout .param _r1=1 v1 1 0 DC 1 r1 1 vout _r1 r2 vout 0 1 .ends div4 *** 4 subcircuit calls, I would like that scope rules would not have *** a global .param statement interfere with subckt scope! xdiv1 out1 div1 params: r1=1 xdiv2 out2 div2 params: r1=1 xdiv3 out3 div3 params: r1=1 xdiv4 out4 div4 params: _r1=1 .op .save v(div1) v(div2) v(div3) v(div4) v(divg) .end .end ********************************* Kind regards, Jan vercammen ------------------------------------------------------------------ To unsubscribe from si-list: si-list-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field or to administer your membership from a web page, go to: //www.freelists.org/webpage/si-list For help: si-list-request@xxxxxxxxxxxxx with 'help' in the Subject field List FAQ wiki page is located at: http://si-list.org/wiki/wiki.pl?Si-List_FAQ List technical documents are available at: http://www.si-list.org List archives are viewable at: //www.freelists.org/archives/si-list or at our remote archives: http://groups.yahoo.com/group/si-list/messages Old (prior to June 6, 2001) list archives are viewable at: http://www.qsl.net/wb6tpu