Created
July 20, 2018 16:21
-
-
Save dnadlinger/c50e6e89a0752ae809ba5dc1caa4436c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from artiq.experiment import * | |
class DMAInputGateTest(EnvExperiment): | |
def build(self): | |
self.setattr_device("core") | |
self.setattr_device("core_dma") | |
self.setattr_device("loop_out") | |
self.setattr_device("loop_in") | |
self.setattr_device("scheduler") | |
self.setattr_argument("use_dma", BooleanValue(default=True)) | |
@kernel | |
def execute(self): | |
with parallel: | |
with sequential: | |
delay(1 * us) | |
self.loop_out.pulse(1 * us) | |
self.loop_in.gate_rising(3 * us) | |
@kernel | |
def run(self): | |
with self.core_dma.record("test"): | |
self.execute() | |
handle = self.core_dma.get_handle("test") | |
while not self.scheduler.check_pause(): | |
self.core.break_realtime() | |
for i in range(100): | |
# Gratuituously large delay to avoid any silly race conditions. | |
delay(50*us) | |
before = now_mu() | |
if self.use_dma: | |
self.core_dma.playback_handle(handle) | |
else: | |
self.execute() | |
after = now_mu() | |
count = self.loop_in.count() | |
if count != 1: | |
print("Mismatch:", i, count) | |
print(before, after, after - before) | |
self.core.break_realtime() | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print:Mismatch: 0 0 | |
print:10802032690608 10802032693608 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment