Oscillator Macro Model

20 August 2019 Link


Here I wanted to make a macro model of a relaxation oscillator to simulate in my test bench with other blocks of the chip. I wanted to keep it simple and also control the frequency.


I came up with the following circuit:


So I wanted to avoid any switches to make the simulation as easy as possible with minimum discontinuities. Here the model is totally Mathematical by using polynomial sources. I tried out implementing the reference hysteresis using switches as well to see if that helps Spectre limit the maximum time step.
Here there are 2 additional signals SS and PAUSE. SS causes the frequency to reduce to half and PAUSE causes it to reduce to 1/3 but those can be adjusted based on the polynomial coefficients. Doing it with polynomials also keeps the clock synchronized when we change the frequency and does not produce glitches.


The only issue I saw in the simulation was that Spectre did not control the timestep finely enough and caused some errors in the result. Only when I made the simulator run in Conservative time step did it resolve the clock properly otherwise I would see slow edges wrong pulses etc. But with conservative it simulates extremely fast and correctly