CedarEDA / CedarSim.jl

Analog Circuit Simulator
Other
12 stars 0 forks source link

Cedar does not support .model lines inside .subckt #4

Open Keno opened 1 month ago

Keno commented 1 month ago

The IHP pdk has .model statements inside .subckt:

https://github.com/IHP-GmbH/IHP-Open-PDK/blob/5a42d03194e8c98558f4e34538338a60550f89b9/ihp-sg13g2/libs.tech/ngspice/models/sg13g2_moslv_mod.lib#L100-L104

Moreover the model parameterization depends on the subckt parameters. TBH, I'm surprised that ngspice accepts this at all. Unfortunately, I don't believe this is particularly easy for us to address with our current SPICE lowering.

Keno commented 1 month ago

Quick look at ngspice source code suggests each of those .model statements becomes a unique X1:X2:model .model in the inlined code for every subcircuit invocation Little bit wasteful, but memory is free I suppose.

I think for us to be able to handle this properly, I'd like to rewrite our SPICE lowering.