<!channel>: Xyce just updated its github repo yes...
# xyce
t
<!channel>: Xyce just updated its github repo yesterday with support for
M=
on subcircuits and for use of parameters referencing other parameters on the same line. These were two major issues with sky130 compatibility. I am recompiling now and will report on testing of both issues.
👏🏻 1
👏 3
👍 8
e
@User Great! I’ll be interested to hear how it goes. I added those features just last week. So you’ll be one of the first people to try them out, outside of the regression tests I created.
💪🏻 1
PS. Another compatibility issue to look out for is how Xyce handles duplicate parameters. ie, if a .param is set more than once. In most codes, the last duplicate parameter is the one that is used. In Xyce, by default, it uses the first one. This can also be changed via a command line option. That option is
Xyce  -redefined_params <option>
where option can be:
ignore
,
uselast
,
usefirst
,
warn
or
error
. At the moment this option isn’t included in the
-hspice-ext all
combination of settings so it must be set separately. Anyway, to force Xyce to be compatible with other simulators in this regard, add
-redefined_params uselast
to the command line.
t
@User: The handling of parameters and subcircuit M value work as advertised. I have one small nit to pick, though, as I have a definition
Copy code
.subckt  sky130_fd_pr__nfet_01v8_lvt  d g s b  mult=1
.param  l = 1 w = 1 ad = 0 as = 0 pd = 0 ps = 0 nrd = {0.14/w}
+ nrs = {0.14/w} sa = 0 sb = 0 sd = 0 nf = 1
...
and made a testbench with
Copy code
X1 3 2 0 0 sky130_fd_pr__nfet_01v8_lvt W=3.0 L=0.15 M=1
+ ad = ' int((nf + 1)/2) * W/nf * 0.29 '
+ as = ' int((nf + 2)/2) * W/nf * 0.29 '
+ pd = ' 2 * int((nf + 1)/2) * (W/nf + 0.29) '
+ ps = ' 2 * int((nf + 2)/2) * (W/nf + 0.29) '
...
This fails to parse in Xyce until I add
NF=1
to the
X1
instance above. My expectation would be that the instance implicitly defines the default parameter and value
nf = 1
, so that if I use
nf
in another parameter, but I have not otherwise (re)defined
nf
, then it should assume the default value of
1
instead of throwing an error. This is not necessarily an error, and xschem, for one, always writes out the
NF
parameter value in the instance call, it's just that it seems to me that known subcircuit parameters should be recognized within an equation and the default values used if not present in the instance call (I do recognize that there are valid reasons to argue against this).
e
@User glad to hear that M= works as it should!
Regarding your nit…. yes, I don’t think Xyce would handle that at the moment. The parameters set on the “X” line are considered to be in the “parent” circuit scope, and the parameters in the .subckt line, and also inside the subcircuit are considered to be in the “child” circuit scope. So, child scoped expressions can see everything in the parent, but the reverse is not true.
t
Well, the
M
value parsed cleanly and didn't throw the warning message that it used to. I do need to check that the output is properly scaling with the value of
M
. I need to do a bit of translation between ngspice and Xyce syntax first.
e
The reason Xyce previously didn’t handle parameters referring to each other on the same “X” line is that they were considered to be basically the same as device instance parameters. And device instance params don’t refer to each other. Anyway, they were all handled by the same function. “X” parameters are now handled by a new function, but I didn’t change the scoping for it.
Glad that “M” parsed cleanly. I do have a handful of regression tests for it. They are mostly in the Xyce_Regression/Netlists/Certification_Tests/ISSUE_267 directory. The tests are based (mostly) on comparing equivalent circuits.
t
I do not quite follow your first response. If the child-scoped expression sees everything in the parent, then shouldn't it see the parameter name
NF
and the default value that exists in the parent?
e
In your code fragment, you have nf=1 inside the subckt. That’s the child scope. The X1 line doesn’t (that I can see) have nf defined. That’s the parent scope. So the expressions on the X1 line that depend on nf can’t be resoved, as they can’t see into the child scope.
But I’ll think about this. I spent some time last week considering if the “X” parameters should be considered child or parent. As “X” lines were previously treated the same as device instances, they were previously considered parent-scope. But there is an argument for them being in the child. I experimented with that last week and it broke some of our regression tests, which is why I went back to treating it as parent scope. Anyway…. if treating it the other way is standard, I’ll revisit it.
Hopefully that all made sense. TLDR, I’ll take a look at the nit.
t
Yes, that makes sense. I was just inverting the concept of "parent" and "child" in my mind. An instance and its subcircuit don't really have a "parent":"child" relationship per se; I think of the subcircuit as more of a template for the instance. At any rate, it is just a "small nit", as I said, and I don't think it will have any impact if you leave it the way it is.
e
thanks; the terminology parent/child isn’t perfect but it was the best I could think of at the moment. 🙂
h
@User
Xyce
might be in a state now that you could consider clean integration into
xschem
#xschem
👍 1
s
@User yes, time to test more Xyce. @User Great improvements!.
👍 1
e
@User and @User, just to alert you, the new M= had a bug in it that I found yesterday. The bugfix has been push to our public git repo, so you may want to do an update and rebuild. If curious, the specific bugfix is here in this commit: https://github.com/Xyce/Xyce/commit/a3c4185ec1b4b5089164ec7e9b50cfffec4a1bbc
t
@User: Okay, thanks, I'll update.
👍 1
s
Thanks @User i will shortly rebuild Xyce (i did the full thing one day before the m= commit 🙂 )
👍 1