PULSE generator corrupting c++ block?

Hello there!
I am quite new to QSpice, so far loving it.
I noticed that when I simulate a c++ device with a pulse block in the schematic it corrupts the output of the c++ block, even if it does not use the pulse. The c++ block just copies in into out.
I can’t upload the code files since I am a new user and I can only upload one picture as such:

Blue= output of the c++
Green = input
Red = clk

Thanks!

This is how the C++ block is supposed to behave. The output always incurs a one simulation step delay. The default Pulse source in Qspice aggressively changes the simulation step at pulse transitions to reassemble a sharp transition for pulse. That is why you see V(out) suddenly appearing closer to V(in) at the transition. If you add instance parameter “timectrl=none” for Pulse Source, you can disable this dynamic timestep control scheme for it.

You can add .option maxstep=<value> to limit the maximum timestep, ensuring that your V(out) appears closer to V(in). However, regardless of your actions, they will always be one simulation step apart.

Perfectly clear, thank you!
May I ask where can I find that page you have shown above?

Click my thumbnail and you can link to my Github. Goto Guideline > Qspice - Device Reference Guide by KSKelvin.pdf. Github should have a download raw file icon and you can download this pdf note. I have two slide P.340-341 to explain this part.

1 Like