forked from M-Labs/artiq
fix dt computation
This commit is contained in:
parent
c26fa5eb90
commit
27e3c044ed
|
@ -1469,13 +1469,13 @@ class Miqro:
|
||||||
data[0] = window
|
data[0] = window
|
||||||
word = 0
|
word = 0
|
||||||
idx = 10
|
idx = 10
|
||||||
for i in range(len(profiles)):
|
for profile in profiles:
|
||||||
if profiles[i] > 0x1f:
|
if profile > 0x1f:
|
||||||
raise ValueError("profile out of bounds")
|
raise ValueError("profile out of bounds")
|
||||||
if idx >= 30:
|
if idx >= 30:
|
||||||
word += 1
|
word += 1
|
||||||
idx = 0
|
idx = 0
|
||||||
data[word] |= (profiles[i] & 0x1f) << idx
|
data[word] |= profile << idx
|
||||||
idx += 5
|
idx += 5
|
||||||
return word
|
return word
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ class MiqroChannel(Module):
|
||||||
self.ack = Signal()
|
self.ack = Signal()
|
||||||
regs = [Signal(30, reset_less=True) for _ in range(3)]
|
regs = [Signal(30, reset_less=True) for _ in range(3)]
|
||||||
dt = Signal(7, reset_less=True)
|
dt = Signal(7, reset_less=True)
|
||||||
|
dt_frame = Signal(6, reset_less=True)
|
||||||
stb = Signal()
|
stb = Signal()
|
||||||
pulse = Cat(stb, dt, regs)
|
pulse = Cat(stb, dt, regs)
|
||||||
assert len(self.pulse) >= len(pulse)
|
assert len(self.pulse) >= len(pulse)
|
||||||
|
@ -107,18 +108,18 @@ class MiqroChannel(Module):
|
||||||
self.rtlink.o.busy.eq(stb & ~self.ack),
|
self.rtlink.o.busy.eq(stb & ~self.ack),
|
||||||
]
|
]
|
||||||
self.sync.rtio += [
|
self.sync.rtio += [
|
||||||
dt.eq(dt + 2),
|
dt_frame.eq(dt_frame + 1),
|
||||||
If(self.ack,
|
If(self.ack,
|
||||||
dt[1:].eq(0),
|
dt_frame.eq(0),
|
||||||
stb.eq(0),
|
|
||||||
If(stb,
|
If(stb,
|
||||||
[r.eq(0) for r in regs],
|
[r.eq(0) for r in regs],
|
||||||
),
|
),
|
||||||
|
stb.eq(0),
|
||||||
),
|
),
|
||||||
If(self.rtlink.o.stb,
|
If(self.rtlink.o.stb,
|
||||||
Array(regs)[self.rtlink.o.address].eq(self.rtlink.o.data),
|
Array(regs)[self.rtlink.o.address].eq(self.rtlink.o.data),
|
||||||
If(self.rtlink.o.address == 0,
|
If(self.rtlink.o.address == 0,
|
||||||
dt[0].eq(self.rtlink.o.fine_ts),
|
dt.eq(Cat(self.rtlink.o.fine_ts, dt_frame)),
|
||||||
stb.eq(1),
|
stb.eq(1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue