Skip to content

Commit 91e828e

Browse files
committed
op_tree method is updated for python2
1 parent ed4bf1d commit 91e828e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

veriloggen/stream/stypes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,16 +1834,20 @@ def Madd(a, b, c):
18341834
return MulAdd(a, b, c)
18351835

18361836

1837-
def op_tree(op, initval=0, latency=None, *args):
1838-
if len(args) == 1:
1839-
return args[0]
1837+
def op_tree(op, initval, latency, *args):
18401838
if len(args) == 0:
18411839
return initval
1840+
1841+
if len(args) == 1:
1842+
return args[0]
1843+
18421844
half_len = len(args) // 2
18431845
ret = op(op_tree(op, initval, latency, *args[:half_len]),
18441846
op_tree(op, initval, latency, *args[half_len:]))
1847+
18451848
if latency is not None:
18461849
ret.latency = latency
1850+
18471851
return ret
18481852

18491853

0 commit comments

Comments
 (0)