mirror of https://github.com/m-labs/artiq.git
ad9914: fix frequency_to_xftw and xftw_to_frequency
This commit is contained in:
parent
80df86f700
commit
e121a81f21
|
@ -312,14 +312,14 @@ class AD9914:
|
||||||
"""Returns the frequency tuning word corresponding to the given
|
"""Returns the frequency tuning word corresponding to the given
|
||||||
frequency (extended resolution mode).
|
frequency (extended resolution mode).
|
||||||
"""
|
"""
|
||||||
return round(float(int64(2)**63*frequency/self.sysclk))
|
return int64(round(2.0*float(int64(2)**62)*frequency/self.sysclk))
|
||||||
|
|
||||||
@portable(flags={"fast-math"})
|
@portable(flags={"fast-math"})
|
||||||
def xftw_to_frequency(self, xftw):
|
def xftw_to_frequency(self, xftw):
|
||||||
"""Returns the frequency corresponding to the given frequency tuning
|
"""Returns the frequency corresponding to the given frequency tuning
|
||||||
word (extended resolution mode).
|
word (extended resolution mode).
|
||||||
"""
|
"""
|
||||||
return xftw*self.sysclk/int64(2)**63
|
return xftw*self.sysclk/(2.0*float(int64(2)**62))
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def set_x(self, frequency, amplitude=1.0):
|
def set_x(self, frequency, amplitude=1.0):
|
||||||
|
|
Loading…
Reference in New Issue