google / skywater-pdk-libs-sky130_fd_pr_reram

SKY130 ReRAM and examples (SkyWater Provided)
https://sky130_fd_pr_reram.rtfd.io
Apache License 2.0
36 stars 8 forks source link

Verilog-A model not mathematically sound #10

Open Keno opened 2 years ago

Keno commented 2 years ago

The Verilog-A model does a manual integration of the filament thickness here:

https://github.com/google/skywater-pdk-libs-sky130_fd_pr_reram/blob/6574676cbbd062d63be0f090013d59ced7302349/cells/reram_cell/sky130_fd_pr_reram__reram_cell.va#L96

This is not a mathematically sound way to do this, because it makes the solution dependent on the simulator's chosen timestep. Such trajectory-dependent models will confuse adaptive integrators and generally cause more sophisticated simulators to error. The correct way to handle something like this is to give this as a separate ODE to the integrator, e.g. as

eletrical Tfilament;
[....]
I(Tfilament) <+ ddt(V(Tfliament)) - Tfilament_dTdt

Of course, Tfilament isn't actually a voltage, so if one was bothered by that, one could do a custom discipline

nature Growth;
  units      = "m/s";
  access     = Growth;
  idt_nature = Length;
end

nature Length;
  units      = "m";
  access     = Length;
  ddt_nature = Growth;
end

discipline metric;
  potential Length;
  flow Growth;
enddiscipline

which would let you write the above as:

metric Tfilament;
[....]
Growth(Tfilament) <+ ddt(Length(Tfliament)) - Tfilament_dTdt
Keno commented 2 years ago

(I can submit a PR for this at some point, but I haven't tested that this actually works yet, so I'll do that once I get around to doing that, unless somebody beats me to it).

mithro commented 2 years ago

These two documents could be useful;

QuantamHD commented 2 years ago

@Keno Does that also imply that the temperature integrator is wrong as well?

https://github.com/google/skywater-pdk-libs-sky130_fd_pr_reram/blob/6574676cbbd062d63be0f090013d59ced7302349/cells/reram_cell/sky130_fd_pr_reram__reram_cell.va#L99

Keno commented 2 years ago

Yes, sorry should have specified. Also it's not "wrong" as much as "bad"/"unsound". For integrators without adaptive time stepping or dynamic error detection, it will probably give sensible answers.

QuantamHD commented 2 years ago

So basically we should remove all the unsound integrators, and replace them with custom disciplines and ODEs.

Keno commented 2 years ago

Yes, though the "custom disciplines" part of that is optional (and I wouldn't be surprised if many simulators chocked on those) and of course thermal is already a standard discipline. But yes, replace all manual integration with proper ODE representations. Plus you'll be able to remove the time step bounding

https://github.com/google/skywater-pdk-libs-sky130_fd_pr_reram/blob/9ba7d408c9f360c9afd24c7ba8a4d0a3976549fb/cells/reram_cell/sky130_fd_pr_reram__reram_cell.va#L89

so your simulations will both be faster and more accurate :)

mithro commented 2 years ago

@Keno - Looking forward to your pull request! It would be great if we could add some spice simulations which produce the graphs found in the documentation too.

lekez2005 commented 2 years ago

@Keno Is there a way to cap the growth of Tfilament? Tfilament is supposed to be limited to between 3.3nm and 4.9nm. Using the Growth(Tfilament) construct, it grows without bound.