forked from M-Labs/artiq
compiler.iodelay: fold and eval SToMU to an int, not float.
This commit is contained in:
parent
178ff74da2
commit
abb36b42be
|
@ -114,12 +114,12 @@ class SToMU(Conv):
|
||||||
return "s->mu({})".format(self.operand)
|
return "s->mu({})".format(self.operand)
|
||||||
|
|
||||||
def eval(self, env):
|
def eval(self, env):
|
||||||
return self.operand.eval(env) / self.ref_period
|
return int(self.operand.eval(env) / self.ref_period)
|
||||||
|
|
||||||
def fold(self, vars=None):
|
def fold(self, vars=None):
|
||||||
operand = self.operand.fold(vars)
|
operand = self.operand.fold(vars)
|
||||||
if isinstance(operand, Const):
|
if isinstance(operand, Const):
|
||||||
return Const(operand.value / self.ref_period)
|
return Const(int(operand.value / self.ref_period))
|
||||||
else:
|
else:
|
||||||
return SToMU(operand, ref_period=self.ref_period)
|
return SToMU(operand, ref_period=self.ref_period)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue