sawg: fast-math

This commit is contained in:
Robert Jördens 2016-10-17 22:13:17 +02:00
parent b2327cf808
commit 78700a67bc
1 changed files with 6 additions and 6 deletions

View File

@ -32,13 +32,13 @@ class SAWG:
""" """
rtio_output(now_mu(), self.channel_base, 0, amplitude) rtio_output(now_mu(), self.channel_base, 0, amplitude)
@kernel @kernel(flags=["fast-math"])
def set_amplitude(self, amplitude: TFloat): def set_amplitude(self, amplitude: TFloat):
"""Set DDS amplitude. """Set DDS amplitude.
:param amplitude: DDS amplitude relative to full-scale. :param amplitude: DDS amplitude relative to full-scale.
""" """
self.set_amplitude_mu(int(amplitude*self.amplitude_scale)) self.set_amplitude_mu(int(round(amplitude*self.amplitude_scale)))
@kernel @kernel
def set_frequency_mu(self, frequency: TInt32): def set_frequency_mu(self, frequency: TInt32):
@ -48,13 +48,13 @@ class SAWG:
""" """
rtio_output(now_mu(), self.channel_base + 1, 0, frequency) rtio_output(now_mu(), self.channel_base + 1, 0, frequency)
@kernel @kernel(flags=["fast-math"])
def set_frequency(self, frequency: TFloat): def set_frequency(self, frequency: TFloat):
"""Set DDS frequency. """Set DDS frequency.
:param frequency: DDS frequency in Hz. :param frequency: DDS frequency in Hz.
""" """
self.set_frequency_mu(int(frequency*self.frequency_scale)) self.set_frequency_mu(int(round(frequency*self.frequency_scale)))
@kernel @kernel
def set_phase_mu(self, phase: TInt32): def set_phase_mu(self, phase: TInt32):
@ -64,10 +64,10 @@ class SAWG:
""" """
rtio_output(now_mu(), self.channel_base + 2, 0, phase) rtio_output(now_mu(), self.channel_base + 2, 0, phase)
@kernel @kernel(flags=["fast-math"])
def set_phase(self, phase: TFloat): def set_phase(self, phase: TFloat):
"""Set DDS phase. """Set DDS phase.
:param phase: DDS phase relative in turns. :param phase: DDS phase relative in turns.
""" """
self.set_phase_mu(int(phase*self.phase_scale)) self.set_phase_mu(int(round(phase*self.phase_scale)))