From 91ca9fbcad041b5e863be925c56fbeb7c21b1b64 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Tue, 4 Jul 2017 16:49:59 +0200 Subject: [PATCH] sawg: also give offset some headroom closes #771 --- artiq/coredevice/sawg.py | 8 ++++---- artiq/gateware/test/dsp/test_sawg_fe.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/artiq/coredevice/sawg.py b/artiq/coredevice/sawg.py index 4ea97e23f..c781c93de 100644 --- a/artiq/coredevice/sawg.py +++ b/artiq/coredevice/sawg.py @@ -281,18 +281,18 @@ class SAWG: width = 16 time_width = 16 cordic_gain = 1.646760258057163 # Cordic(width=16, guard=None).gain - cordic_gain *= 1.01 # leave a bit of headroom + head_room = 1.001 self.config = Config(channel_base, self.core, cordic_gain) self.offset = Spline(width, time_width, channel_base + 1, - self.core, 2.) + self.core, 2.*head_room) self.amplitude1 = Spline(width, time_width, channel_base + 2, - self.core, 2*cordic_gain**2) + self.core, 2*head_room*cordic_gain**2) self.frequency1 = Spline(3*width, time_width, channel_base + 3, self.core, 1/self.core.coarse_ref_period) self.phase1 = Spline(width, time_width, channel_base + 4, self.core, 1.) self.amplitude2 = Spline(width, time_width, channel_base + 5, - self.core, 2*cordic_gain**2) + self.core, 2*head_room*cordic_gain**2) self.frequency2 = Spline(3*width, time_width, channel_base + 6, self.core, 1/self.core.coarse_ref_period) self.phase2 = Spline(width, time_width, channel_base + 7, diff --git a/artiq/gateware/test/dsp/test_sawg_fe.py b/artiq/gateware/test/dsp/test_sawg_fe.py index b905fea37..5aa3e1241 100644 --- a/artiq/gateware/test/dsp/test_sawg_fe.py +++ b/artiq/gateware/test/dsp/test_sawg_fe.py @@ -68,8 +68,7 @@ class SAWGTest(unittest.TestCase): v = int(round((1 << 48) * .1 * self.t)) self.assertEqual( self.rtio_manager.outputs, [ - (0., 1, 0, int(round( - (1 << self.driver.offset.width - 1)*.9))), + (0., 1, 0, int(round(self.driver.offset.scale*.9))), (2.*self.t, 8, 0, int(round( (1 << self.driver.frequency0.width) * self.t/self.channel.parallelism*.1))),