forked from M-Labs/artiq
phaser: cleanup prbs
This commit is contained in:
parent
b41b9de905
commit
9b43f09c1d
|
@ -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
|
||||
|
||||
|
|
|
@ -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 e in range(2):
|
||||
for i in range(3): # prbs7, prbs15, prbs31
|
||||
self.prbs(i, 100)
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue