New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test/coredevice: Add input gate/timestamp test #1136
Conversation
a4f5daa
to
ea5d2f5
Compare
ea5d2f5
to
7435cac
Compare
artiq/test/coredevice/test_rtio.py
Outdated
def run(self): | ||
# Make sure there are no leftover events. | ||
self.core.break_realtime() | ||
self.loop_in.count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be leftover events because of the very bug you are testing against (due to the gateware latency in the timestamp counter to gate path, the timeout - referenced to the timestamp counter - is too small and the kernel thinks the gateware has closed the gate when it has not). Use core.reset()
instead.
7435cac
to
906fe3c
Compare
self.core.reset() | ||
|
||
# Determine loop delay. | ||
self.core.break_realtime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset()
already does break_realtime()
.
if not (gate_start_mu < in_mu < gate_end_mu): | ||
raise PulseNotReceived("Input event should occur during gate") | ||
if not (-2 < (in_mu - out_mu - loop_delay_mu) < 2): | ||
raise PulseNotReceived("Loop delay should not change") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PulseNotReceived?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about IncorrectPulseTiming?
if in_mu < 0: | ||
raise PulseNotReceived("No input event") | ||
if not (gate_start_mu < in_mu < gate_end_mu): | ||
raise PulseNotReceived("Input event should occur during gate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now there is an uncompensated latency offset between the gate and the input. So, the received timestamps can be slightly outside the gate. This offset also causes the pulse not to be received above.
self.loop_in.gate_rising_mu(24) | ||
gate_end_mu = now_mu() | ||
|
||
out_mu = gate_start_mu - loop_delay_mu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ 3*8
compensates for latency offset (then the pulse arrives in the middle of the gate).
Expected to be broken based on local tests.