mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
corelogic/misc: contiguous split
This commit is contained in:
parent
ef436a1ec9
commit
e62ac1d3a1
1 changed files with 8 additions and 0 deletions
|
@ -31,3 +31,11 @@ def optree(op, operands, lb=None, ub=None, default=None):
|
||||||
return _Operator(op,
|
return _Operator(op,
|
||||||
[optree(op, operands, lb, s, default),
|
[optree(op, operands, lb, s, default),
|
||||||
optree(op, operands, s, ub, default)])
|
optree(op, operands, s, ub, default)])
|
||||||
|
|
||||||
|
def split(v, *counts):
|
||||||
|
r = []
|
||||||
|
offset = 0
|
||||||
|
for n in counts:
|
||||||
|
r.append(v[offset:offset+n])
|
||||||
|
offset += n
|
||||||
|
return tuple(r)
|
||||||
|
|
Loading…
Reference in a new issue