Hello all,
I’m an engineer at a semiconductor firm and we are interested in providing QSpice models of our parts. For our use case models of digital system are in verilog, and we need support for delay statements. Converting our models to C++ is not viable. verilator supports most timing constructs when invoked with the --timing
option (the unsupported features are not a problem for our use case). It appears as though QSpice does not invoke verilator with this option, and the generated C++ wrapper for verilog models does not implement the needed functionality anyways.
It looks like delay supported could be implemented roughly this way:
- Invoke verilator with
--timing
option MaxExtStepSize
should be added to verilated C++ wrapper and can usenextTimeSlot()
on the verilated struct to limit stepsize.- The model eval function in the wrapper needs to update the verilator context with time. It looks like this is not done currently, which seems wrong so it’s probably just being done somewhere I don’t know about.
Trunc
likely needs to be modified as well, although I’m not as sure about the changes needed for that.- Compile/link/etc into .dll
- Simulate
The most significant issue I see at the moment is that --timing
generates C++ that requires C++ 20 support in the compiler, which the mars toolchain doesn’t seem to support. This could be an issue for adding timing support natively in QSpice, but isn’t an issue for models compiled externally.
Anyone have any thoughts or pointers for implementing this? I’m going to attempt to implement delay support using the approach outlined above and see how far that gets me.