Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel LiteX
migen
Commits
c71eb577
Commit
c71eb577
authored
10 years ago
by
Robert Jordens
Committed by
Sebastien Bourdeauducq
10 years ago
Browse files
Options
Download
Email Patches
Plain Diff
migen.fhdl.structure: have Cat() flat_iteration-ize its arguments
parent
1bf13375
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
migen/fhdl/structure.py
migen/fhdl/structure.py
+5
-4
No files found.
migen/fhdl/structure.py
View file @
c71eb577
...
@@ -4,6 +4,7 @@ import builtins
...
@@ -4,6 +4,7 @@ import builtins
from
collections
import
defaultdict
from
collections
import
defaultdict
from
migen.fhdl
import
tracer
from
migen.fhdl
import
tracer
from
migen.util.misc
import
flat_iteration
class
HUID
:
class
HUID
:
__next_uid
=
0
__next_uid
=
0
...
@@ -87,7 +88,7 @@ class Value(HUID):
...
@@ -87,7 +88,7 @@ class Value(HUID):
elif
isinstance
(
key
,
slice
):
elif
isinstance
(
key
,
slice
):
start
,
stop
,
step
=
key
.
indices
(
flen
(
self
))
start
,
stop
,
step
=
key
.
indices
(
flen
(
self
))
if
step
!=
1
:
if
step
!=
1
:
return
Cat
(
*
(
self
[
i
]
for
i
in
range
(
start
,
stop
,
step
))
)
return
Cat
(
self
[
i
]
for
i
in
range
(
start
,
stop
,
step
))
return
_Slice
(
self
,
start
,
stop
)
return
_Slice
(
self
,
start
,
stop
)
else
:
else
:
raise
KeyError
raise
KeyError
...
@@ -155,11 +156,11 @@ class Cat(Value):
...
@@ -155,11 +156,11 @@ class Cat(Value):
meeting these properties. The bit length of the return value is the sum of
meeting these properties. The bit length of the return value is the sum of
the bit lengths of the arguments::
the bit lengths of the arguments::
flen(Cat(
*
args)) == sum(flen(arg) for arg in args)
flen(Cat(args)) == sum(flen(arg) for arg in args)
Parameters
Parameters
----------
----------
*args : Value, inout
*args : Value
s or iterables of Values
, inout
`Value` s to be concatenated.
`Value` s to be concatenated.
Returns
Returns
...
@@ -169,7 +170,7 @@ class Cat(Value):
...
@@ -169,7 +170,7 @@ class Cat(Value):
"""
"""
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
Value
.
__init__
(
self
)
Value
.
__init__
(
self
)
self
.
l
=
args
self
.
l
=
list
(
flat_iteration
(
args
))
class
Replicate
(
Value
):
class
Replicate
(
Value
):
"""Replicate a value
"""Replicate a value
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment