<@U016EM8L91B> I am open to this. Can you send me...
# xyce
e
@User I am open to this. Can you send me more info about it?
🌍 1
t
That's about the whole description. I have code in the ngspice repository under
src/xspice/icm/digital/d_genlut
. If you could point me to where the digital behavioral models are implemented in the Xyce source, I might be able to do the implementation myself and just send you a pull request.
I found the digital behavior gates implementation in
DeviceModelPKG/OpenModels/N_DEV_Digital.C
. Since the digital gates are already implemented with function
evalTruthTable
, the LUT model really should be trivially simple to implement, as all it needs to do is to define the string parameter, then parse it to generate the truth table, and that's about it.
e
Yes, that is the file containing the digital devices. You have found them. They haven’t always been numerically well-behaved, is probably my main concern about them. But possibly this is an opportunity to revisit that issue. I’ll take a look at
src/xspice/icm/digital/d_genlut
as well.
t
The only thing I'm not sure about is whether I can implement an arbitrary number of outputs. Since I have never seen a standard cell set with gates with other than either one or two outputs, I could always just implement a one-output LUT model and a two-output LUT model. I guess I'm also not sure whether it is valid to set the number of inputs to zero, as would be needed for a tie-high or tie-low cell.
A consistent syntax for N-input, M-output LUTs would probably be
U<name> <type>(<num inputs>)(<num outputs>)
but may not be worth the trouble to implement. Since Xyce already implements an adder, I'm inclined to just implement the LUT as an N-input, 1-output device.
p
@User I know standard cells that have two logical outputs and provide them both positive and inverted, so that would make 4 outputs from a single cell. Well, and there are full adders....
t
@User: The full adder is already in the set implemented in Xyce. But yes, even the sky130 standard cells have the "conb" cell, which is a 0-input, 2-output cell (and is a non-standard, royal pain that kept breaking all the tools, but that's another matter). So I would probably opt for two LUT cells, one with one output and one with two outputs, unless it turns out that implementing
U<name> <type>(<num inputs>)(<num outputs>)
is easy, which it might be.
@User: I tried to implement a baseline simple digital circuit using the "U" devices in Xyce. Apparently I am missing something, because the output of the digital (an AND gate with buffers on input and output) remains at 1/2 vdd through the whole simulation and never changes. Can you please take a look at the circuit and tell me what I'm doing wrong?
e
@User today is pretty busy for me, but I’ll try to take a look.
t
@User: If you know of a link where I could find a reference to a working digital example netlist, that would probably be all I need.
e
The main thing I’d suggest is the digital tests in our regression suite. The directory path is: Xyce_Regression/Netlists/DIGITAL And you can see them here: https://github.com/Xyce/Xyce_Regression/tree/master/Netlists/DIGITAL
For your output (since this is a small ckt you are debugging) you might use the V() wildcard. i.e., `.print tran v()` That way you can check all the signals.
t
Great, that's perfect.
👍 1
e
I will comment that I’ve never been that happy with the robustness of the digital models in Xyce. They were intended (years ago) to mimic a similar feature in Pspice. But they haven’t ever worked as well as I would like them to. A lot of people just link Xyce to a digital tool (like icarus verilog) and do mixed signal simulation that way.
There is a “mixed signal API” for Xyce. I think the most recent documentation is here: https://xyce.sandia.gov/files/xyce/AppNote-MixedSignal.pdf
t
The issue with the digital was just that the parameter defaults for
S0RLO S0RHI S1RLO S1RHI
are unrealistic and need to be set before the simulation will produce any change in the output. I have also been looking at the mixed-signal API. It is very similar to the implementation for ngspice, although the ngspice implementation always had the drawback that the maximum timestep had to be kept very low or else the digital transitions would get missed. If I'm not mistaken, both implementations are build around the VPI interface which implies that Xyce or ngspice is launched from the verilog simulator, which then limits the verilog to a single process. Probably a sufficiently clever script could generate a wrapper verilog module incorporating multiple modules to be simulated as verilog, and figure out all the connections into and out of the SPICE netlist. Anyway, I do intend to play around with the mixed-signal simulation in Xyce sometime soon. But I like the embedded digital simulation capability, because I can use a simple script to convert any digitally-synthesized subcircuit into its digital component equivalent, and swap it in for the original with an
.include
statement. Sure, it takes longer to run than cosimulation, but the embedded digital simulation requires zero effort if you have the script to convert the analog subcircuits to digital (which I do, for ngspice, and can do a quick rewrite for Xyce once I've implemented the LUT model).
@User: Okay, I have a working LUT model for Xyce. I tested the LUT as a 2-input AND gate, a 3-input AND gate, a zero-input TIEHI gate, and a 2-output full adder. All works well. ngspice implements xspice directly from spice3, and xspice is a different implementation, with an event-based digital simulator built independently of the spice solver; all nodes connected to digital components are handled by the event-driven simulator, and the only place the simulators interact is at the digital I/O, which requires A/D and D/A components. So within the digital simulator, the circuit nodes can maintain a traditional set of digital states, that is, 0, 1, pull-up, pull-down, unknown, and high impedance. That allowed me to let the LUT implement tristate inverters and buffers, and handle propagating unknowns. I can do the same for Xyce's implementation, but I would need to change the boolean logic state to an enumerated list, then meddle with output voltages and conductances to get the approprate behavior for the non-binary states. That would require a number of changes to the existing digital gate implementations, so I'd like to get the LUT merged into the code first, and then get your opinion about the rest. Would you like me to get you code changes by pull request or something else (can I even do a pull request on the Xyce repo on github)?
🌍 1
e
Hi @User, glad to hear you got it working!
Regarding the VPI interface, the Xyce mixed-signal API includes that, but it isn’t just that. We actually had a mixed signal interface b4 it occurred to us to support VPI. After that we added it.
I know that Xyce is set up so that multiple Xyce instantiations can be allocated and invoked from a single backplane. Possibly that is restricted when using VPI (not sure), but that restriction doesn’t apply to general usage of Xyce-as-a-library.
Regarding pull requests, etc, we’re somewhat restricted when it comes to accepting code from external developers. I’ll have to check internally first about this.
Lab rules, etc.
t
Understood.