Pulse width not generated correctly in repetitive mode (WREN gateware, pulser)
I tested the scenario when a pulser is configured to be in repetitive mode and
- it waits for a start signal
- it starts generating pulses when a start appears
- and then it stops because a stop signal appears
- these three steps above repeats
On the wavegraph below, we can see that these steps are executed correctly (purple-pulser output, orange-start, blue-stop):
However, the pulse width is executed correctly only for the first group of generated pulses, and not for others:
-
Correctly generated first group (pulse width=71ns, pulse period=92ns)
-
For all other groups of pulses, after the previous group was interrupted by a stop signal, the pulse width is not generated correctly (the pulse period is correct).
In the sample below, pulse width is 43ns instead of 71ns, while the pulse period is correct 92ns
After the investigation of the code in pulser.vhd, I found that hcount register is not reset to the configuration value, when the pulser goes back to the START state after being interrupted by a stop.
The following line should be added in the START state (pulser.vhd, after line 257) - nregs.hcount <= unsigned (regs.cfg.high);
After this modification of the code, a bug from above is solved.