Author Topic: strange oscillations in the output of the LTSPICE D flip-flop model  (Read 2172 times)

0 Members and 1 Guest are viewing this topic.

Offline graybeardTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
  • Consulting III-V RF/mixed signal/device engineer
    • Chris Grossman
I was planning to run simulation with LTSPICE using the built-in the D flip-flop model.  Since I have never used that model I decided to run a few test simulations with the model before I used it in a much larger circuit.  When I ran the simulations I observed very strange oscillations on the flip-flop output.





When I zoomed in on the apparent oscillations it appears to be a triangle waveform





I am running the latest version of LTSPICE as of today August 21, 2021



These results are not giving me much confidence in the LTSPICE's built-in digital models.

If you want to try it, here are links to the files:

The LT spice schematic

A LT spice plot parameters file (not needed but nice to have)

The MAX985 comparator model

I will email a link to this post to Analog Devices bug reporting email.

Chris Grossman
« Last Edit: August 22, 2021, 02:07:07 am by graybeard »
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6541
  • Country: ro
Re: strange oscillations in the output of the LTSPICE D flip-flop model
« Reply #1 on: August 21, 2021, 07:53:03 pm »
I don't think that's a bug.  Looks more like numerical artifacts caused by SPICE trying to optimize for a minimum number of steps to compute, yet the duration is very long (20 seconds) and the digital circuit is millions times faster when compared with those 20 seconds.

SPICE needs a little guidance in this situation.

Specify a maximum allowed timestep (for example 1 microseconds).  Use ".tran 0 20 0 1us uic" instead of ".tran 0 20 0 uic", and the ringing at each edge will appear reasonably OK.

Offline graybeardTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
  • Consulting III-V RF/mixed signal/device engineer
    • Chris Grossman
Re: strange oscillations in the output of the LTSPICE D flip-flop model
« Reply #2 on: August 21, 2021, 08:18:43 pm »
That only changes the period of the ringing.   It should not be there in the first place.

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15044
  • Country: fr
Re: strange oscillations in the output of the LTSPICE D flip-flop model
« Reply #3 on: August 21, 2021, 08:28:43 pm »
I don't think that's a bug.  Looks more like numerical artifacts caused by SPICE trying to optimize for a minimum number of steps to compute, yet the duration is very long (20 seconds) and the digital circuit is millions times faster when compared with those 20 seconds.

Yes, it's exactly that. If you zoom in on the "oscillations", you can see that those are jumps of discrete values (it looks like a 'triangle' wave). This is typical of an integration error, which comes from the fact  that there are very sharp edges relative to the total simulation time. Spice will try adjusting the simulation steps automatically but there are limits to this.

Specify a maximum allowed timestep (for example 1 microseconds).  Use ".tran 0 20 0 1us uic" instead of ".tran 0 20 0 uic", and the ringing at each edge will appear reasonably OK.

Yes, this is how you can work around this.

Note that I'm a bit surprised here, because I would have expected the logic primitives in LTSpice to be pure digital simulation - LTSpice is a mixed signal simulator - so that I wouldn't have expected integration errors on a digital primitive output, but I don't know how it's really implemented behind the scenes. Possibly it's the "analog-to-digital" interface of the primitive that causes this.
 

Offline graybeardTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
  • Consulting III-V RF/mixed signal/device engineer
    • Chris Grossman
Re: strange oscillations in the output of the LTSPICE D flip-flop model
« Reply #4 on: August 21, 2021, 08:29:33 pm »
It is much happier with Gear integration since it does a much better job of varying the size of the time step.  However there is still a bit of input state dependent overshooot I would not expect from a simple digital model.





Chris
« Last Edit: August 21, 2021, 08:33:35 pm by graybeard »
 
The following users thanked this post: RoGeorge

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6541
  • Country: ro
Re: strange oscillations in the output of the LTSPICE D flip-flop model
« Reply #5 on: August 21, 2021, 09:35:39 pm »
Gear integration

Wow, that ran so much faster than forcing a max time step!   :-+
I didn't know about the Gear method, thank you.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf