mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
suservo: add clip flags (#992)
This commit is contained in:
parent
60fd362d57
commit
f055bf88f6
@ -109,8 +109,10 @@ class SUServo:
|
|||||||
"""Get current SU Servo status.
|
"""Get current SU Servo status.
|
||||||
|
|
||||||
This method does not advance the timeline but consumes all slack.
|
This method does not advance the timeline but consumes all slack.
|
||||||
|
This method returns and clears the clip indicator for all channels.
|
||||||
|
|
||||||
:return: Status. Bit 0: enabled, bit 1: done
|
:return: Status. Bit 0: enabled, bit 1: done,
|
||||||
|
bits 8-15: channel clip indicators.
|
||||||
"""
|
"""
|
||||||
return self.read(CONFIG_ADDR)
|
return self.read(CONFIG_ADDR)
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ class SUServo(EnvExperiment):
|
|||||||
# DDS attenuator
|
# DDS attenuator
|
||||||
self.suservo0.cpld0.set_att_mu(0, 64)
|
self.suservo0.cpld0.set_att_mu(0, 64)
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
assert self.suservo0.get_status() == 2
|
# Servo is done
|
||||||
|
assert self.suservo0.get_status() & 0xff == 2
|
||||||
delay(10*us)
|
delay(10*us)
|
||||||
|
|
||||||
# set up profile 0 on channel 0
|
# set up profile 0 on channel 0
|
||||||
@ -51,16 +52,19 @@ class SUServo(EnvExperiment):
|
|||||||
delay(10*ms)
|
delay(10*ms)
|
||||||
|
|
||||||
# check servo status
|
# check servo status
|
||||||
assert self.suservo0.get_status() == 1
|
assert self.suservo0.get_status() & 0xff == 1
|
||||||
delay(10*us)
|
delay(10*us)
|
||||||
|
|
||||||
# reach back ADC data
|
# reach back ADC data
|
||||||
print(self.suservo0.get_adc_mu(0))
|
assert self.suservo0.get_adc_mu(0) == 0
|
||||||
delay(10*ms)
|
delay(10*us)
|
||||||
|
|
||||||
# read out IIR data
|
# read out IIR data
|
||||||
print(self.suservo0_ch0.get_y_mu(0))
|
assert self.suservo0_ch0.get_y_mu(0) == 0x1ffff
|
||||||
delay(10*ms)
|
delay(10*us)
|
||||||
|
|
||||||
|
assert self.suservo0.get_status() & 0xff00 == 0x0100
|
||||||
|
delay(10*us)
|
||||||
|
|
||||||
# repeatedly clear the IIR state/integrator
|
# repeatedly clear the IIR state/integrator
|
||||||
# with the ADC yielding 0's and given the profile configuration,
|
# with the ADC yielding 0's and given the profile configuration,
|
||||||
@ -69,6 +73,10 @@ class SUServo(EnvExperiment):
|
|||||||
while True:
|
while True:
|
||||||
self.suservo0_ch0.set(1, 0, 0)
|
self.suservo0_ch0.set(1, 0, 0)
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
|
assert self.suservo0.get_status() & 0xff00 == 0x0100
|
||||||
|
delay(10*us)
|
||||||
|
assert self.suservo0.get_status() & 0xff00 == 0x0000
|
||||||
|
delay(10*us)
|
||||||
self.suservo0_ch0.set_y_mu(0, 0)
|
self.suservo0_ch0.set_y_mu(0, 0)
|
||||||
delay(1*us)
|
delay(1*us)
|
||||||
self.suservo0_ch0.set(1, 1, 0)
|
self.suservo0_ch0.set(1, 1, 0)
|
||||||
|
@ -58,9 +58,11 @@ class RTServoMem(Module):
|
|||||||
|
|
||||||
config = Signal(w.coeff, reset=0)
|
config = Signal(w.coeff, reset=0)
|
||||||
status = Signal(w.coeff)
|
status = Signal(w.coeff)
|
||||||
|
pad = Signal(6)
|
||||||
self.comb += [
|
self.comb += [
|
||||||
Cat(servo.start).eq(config),
|
Cat(servo.start).eq(config),
|
||||||
status.eq(Cat(servo.start, servo.done))
|
status.eq(Cat(servo.start, servo.done, pad,
|
||||||
|
[_.clip for _ in servo.iir.ctrl]))
|
||||||
]
|
]
|
||||||
|
|
||||||
assert len(self.rtlink.o.address) == (
|
assert len(self.rtlink.o.address) == (
|
||||||
@ -108,6 +110,9 @@ class RTServoMem(Module):
|
|||||||
self.sync.rio_phy += [
|
self.sync.rio_phy += [
|
||||||
If(self.rtlink.o.stb & we & state_sel & config_sel,
|
If(self.rtlink.o.stb & we & state_sel & config_sel,
|
||||||
config.eq(self.rtlink.o.data)
|
config.eq(self.rtlink.o.data)
|
||||||
|
),
|
||||||
|
If(read & read_config & read_state,
|
||||||
|
[_.clip.eq(0) for _ in servo.iir.ctrl]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
self.comb += [
|
self.comb += [
|
||||||
|
@ -238,6 +238,7 @@ class IIR(Module):
|
|||||||
("profile", w.profile),
|
("profile", w.profile),
|
||||||
("en_out", 1),
|
("en_out", 1),
|
||||||
("en_iir", 1),
|
("en_iir", 1),
|
||||||
|
("clip", 1),
|
||||||
("stb", 1)])
|
("stb", 1)])
|
||||||
for i in range(1 << w.channel)]
|
for i in range(1 << w.channel)]
|
||||||
# only update during ~loading
|
# only update during ~loading
|
||||||
@ -266,6 +267,7 @@ class IIR(Module):
|
|||||||
profiles = Array([ch.profile for ch in self.ctrl])
|
profiles = Array([ch.profile for ch in self.ctrl])
|
||||||
en_outs = Array([ch.en_out for ch in self.ctrl])
|
en_outs = Array([ch.en_out for ch in self.ctrl])
|
||||||
en_iirs = Array([ch.en_iir for ch in self.ctrl])
|
en_iirs = Array([ch.en_iir for ch in self.ctrl])
|
||||||
|
clips = Array([ch.clip for ch in self.ctrl])
|
||||||
|
|
||||||
# state counter
|
# state counter
|
||||||
state = Signal(w.channel + 2)
|
state = Signal(w.channel + 2)
|
||||||
@ -443,8 +445,10 @@ class IIR(Module):
|
|||||||
en_out.eq(en_outs[channel[0]]),
|
en_out.eq(en_outs[channel[0]]),
|
||||||
en_iir.eq(en_iirs[channel[0]]),
|
en_iir.eq(en_iirs[channel[0]]),
|
||||||
If(stage[1],
|
If(stage[1],
|
||||||
ddss[channel[1]][:w.word].eq(
|
ddss[channel[1]][:w.word].eq(m_coeff.dat_r)
|
||||||
m_coeff.dat_r),
|
),
|
||||||
|
If(stage[2] & en[1] & dsp.clip,
|
||||||
|
clips[channel[2]].eq(1)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
1: [
|
1: [
|
||||||
|
Loading…
Reference in New Issue
Block a user