From e121a81f2175c941e05f1e7401b69300bc9acb6e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 14 May 2018 23:30:08 +0800 Subject: [PATCH] ad9914: fix frequency_to_xftw and xftw_to_frequency --- artiq/coredevice/ad9914.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/coredevice/ad9914.py b/artiq/coredevice/ad9914.py index 55882d4bd..e892ba65d 100644 --- a/artiq/coredevice/ad9914.py +++ b/artiq/coredevice/ad9914.py @@ -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):