forked from M-Labs/artiq
1
0
Fork 0

ad9914: fix frequency_to_xftw and xftw_to_frequency

This commit is contained in:
Sebastien Bourdeauducq 2018-05-14 23:30:08 +08:00
parent 80df86f700
commit e121a81f21
1 changed files with 2 additions and 2 deletions

View File

@ -312,14 +312,14 @@ class AD9914:
"""Returns the frequency tuning word corresponding to the given
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"})
def xftw_to_frequency(self, xftw):
"""Returns the frequency corresponding to the given frequency tuning
word (extended resolution mode).
"""
return xftw*self.sysclk/int64(2)**63
return xftw*self.sysclk/(2.0*float(int64(2)**62))
@kernel
def set_x(self, frequency, amplitude=1.0):