2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-29 05:03:34 +08:00

phaser: cleanup prbs

This commit is contained in:
Robert Jördens 2016-10-14 11:56:10 +02:00
parent b41b9de905
commit 9b43f09c1d
2 changed files with 21 additions and 10 deletions

View File

@ -62,7 +62,7 @@ class DACSetup(EnvExperiment):
@kernel
def busywait_us(self, t):
t = now_mu() + seconds_to_mu(t*us)
t = self.core.get_rtio_counter_mu() + seconds_to_mu(t*us)
while self.core.get_rtio_counter_mu() < t:
pass

View File

@ -1,5 +1,3 @@
import time
from artiq.coredevice.ad9154_reg import *
from artiq.experiment import *
@ -9,14 +7,25 @@ class Test(EnvExperiment):
self.setattr_device("core")
self.setattr_device("ad9154")
@kernel
def run(self):
for i in range(3): # prbs7, prbs15, prbs31
self.prbs(i, 100)
for e in range(2):
for i in range(3): # prbs7, prbs15, prbs31
self.prbs(i, 10, e)
@kernel
def busywait_us(self, t):
t = self.core.get_rtio_counter_mu() + seconds_to_mu(t*us)
while self.core.get_rtio_counter_mu() < t:
pass
def p(self, f, *a):
print(f % a)
print(f.format(*a))
def prbs(self, p, t, inject_errors=0):
@kernel
def prbs(self, p, t, inject_errors):
self.p("---\nprbs sequence {}, threshold {}, inject_errors {}:",
p, t, inject_errors)
self.ad9154.jesd_prbs((1 << p) | (inject_errors << 3))
self.ad9154.dac_write(AD9154_PHY_PRBS_TEST_CTRL,
@ -35,15 +44,17 @@ class Test(EnvExperiment):
self.ad9154.dac_write(AD9154_PHY_PRBS_TEST_CTRL,
AD9154_PHY_PRBS_PAT_SEL_SET(p) | AD9154_PHY_TEST_START_SET(1))
time.sleep(.5)
self.busywait_us(1000000)
self.ad9154.dac_write(AD9154_PHY_PRBS_TEST_CTRL, AD9154_PHY_PRBS_PAT_SEL_SET(p))
self.p("prbs status: 0x%02x", self.ad9154.dac_read(AD9154_PHY_PRBS_TEST_STATUS))
self.p("prbs status: {:#04x}", self.ad9154.dac_read(AD9154_PHY_PRBS_TEST_STATUS))
for i in range(8):
self.ad9154.dac_write(AD9154_PHY_PRBS_TEST_CTRL, AD9154_PHY_SRC_ERR_CNT_SET(i))
self.p("prbs errors[%d]: 0x%08x", i,
self.p("prbs errors[{}]: {:#08x}", i,
self.ad9154.dac_read(AD9154_PHY_PRBS_TEST_ERRCNT_LOBITS) |
(self.ad9154.dac_read(AD9154_PHY_PRBS_TEST_ERRCNT_MIDBITS) << 8) |
(self.ad9154.dac_read(AD9154_PHY_PRBS_TEST_ERRCNT_HIBITS) << 16))
self.ad9154.jesd_prbs(0)