2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-22 09:54:00 +08:00

ad9910: fix turns_to_pow return-type on host

When run on the host, the `turns_to_pow` retrun-type is numpy.int64.
Sensibly, the compiler does not attempt to convert `numpy.int64` to `int32`.

Signed-off-by: Marius Weber <marius.weber@physics.ox.ac.uk>
This commit is contained in:
Marius Weber 2020-09-29 01:24:39 +01:00 committed by David Nadlinger
parent 9ff47bacab
commit 3e38833020

View File

@ -596,7 +596,7 @@ class AD9910:
def turns_to_pow(self, turns) -> TInt32: def turns_to_pow(self, turns) -> TInt32:
"""Return the 16-bit phase offset word corresponding to the given phase """Return the 16-bit phase offset word corresponding to the given phase
in turns.""" in turns."""
return int32(round(turns*0x10000)) & 0xffff return int32(round(turns*0x10000)) & int32(0xffff)
@portable(flags={"fast-math"}) @portable(flags={"fast-math"})
def pow_to_turns(self, pow_): def pow_to_turns(self, pow_):