Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 12 additions and 12 deletions.
  1. +3 −3 migen/actorlib/control.py
  2. +9 −9 migen/flow/network.py
View
6 migen/actorlib/control.py
@@ -8,14 +8,14 @@
# Generates integers from start to maximum-1
class For(Actor):
- def __init__(self, *maxima, start=False, step=False):
- self.dimensions = len(maxima)
+ def __init__(self, *nbits, start=False, step=False):
+ self.dimensions = len(nbits)
self.start = start
self.step = step
params = ["end"]
if start: params.append("start")
if step: params.append("step")
- self.d_bv = [BV(bits_for(dimension)) for dimension in maxima]
+ self.d_bv = [BV(dimension) for dimension in nbits]
l_sink = [("d{0}".format(n), [(p, bv) for p in params])
for n, bv in enumerate(self.d_bv)]
l_source = [("d{0}".format(n), bv)
View
18 migen/flow/network.py
@@ -75,12 +75,12 @@ def del_connections(self, source_node, sink_node, data_requirements):
# Returns a dictionary
# source -> [sink1, ..., sinkn]
# source element is a (node, endpoint) pair.
- # sink elements are (node, endpoint, source subrecord) triples.
+ # sink elements are (node, endpoint, source subrecord, sink subrecord) triples.
def _source_to_sinks(self):
d = dict()
for u, v, data in self.edges_iter(data=True):
el_src = (u, data["source"])
- el_dst = (v, data["sink"], data["source_subr"])
+ el_dst = (v, data["sink"], data["source_subr"], data["sink_subr"])
if el_src in d:
d[el_src].append(el_dst)
else:
@@ -90,11 +90,11 @@ def _source_to_sinks(self):
# Returns a dictionary
# sink -> [source1, ... sourcen]
# sink element is a (node, endpoint) pair.
- # source elements are (node, endpoint, sink subrecord) triples.
+ # source elements are (node, endpoint, sink subrecord, source subrecord) triples.
def _sink_to_sources(self):
d = dict()
for u, v, data in self.edges_iter(data=True):
- el_src = (u, data["source"], data["sink_subr"])
+ el_src = (u, data["source"], data["sink_subr"], data["source_subr"])
el_dst = (v, data["sink"])
if el_dst in d:
d[el_dst].append(el_src)
@@ -125,25 +125,25 @@ def _eliminate_subrecords_and_divergences(self):
if len(sources) > 1 or sources[0][2] is not None:
# build combinator
# "layout" is filled in during instantiation
- subrecords = [dst_subrecord for src_node, src_endpoint, dst_subrecord in sources]
+ subrecords = [dst_subrecord for src_node, src_endpoint, dst_subrecord, src_subrecord in sources]
combinator = ActorNode(plumbing.Combinator, {"subrecords": subrecords})
# disconnect source1 -> sink ... sourcen -> sink
# connect source1 -> combinator_sink1 ... sourcen -> combinator_sinkn
- for n, (src_node, src_endpoint, dst_subrecord) in enumerate(sources):
+ for n, (src_node, src_endpoint, dst_subrecord, src_subrecord) in enumerate(sources):
self.del_connections(src_node, dst_node,
{"source": src_endpoint, "sink": dst_endpoint})
self.add_connection(src_node, combinator,
- src_endpoint, "sink{0}".format(n))
+ src_endpoint, "sink{0}".format(n), source_subr=src_subrecord)
# connect combinator_source -> sink
self.add_connection(combinator, dst_node, "source", dst_endpoint)
# Insert splitters.
for (src_node, src_endpoint), sinks in self._source_to_sinks().items():
if len(sinks) > 1 or sinks[0][2] is not None:
- subrecords = [src_subrecord for dst_node, dst_endpoint, src_subrecord in sinks]
+ subrecords = [src_subrecord for dst_node, dst_endpoint, src_subrecord, dst_subrecord in sinks]
splitter = ActorNode(plumbing.Splitter, {"subrecords": subrecords})
# disconnect source -> sink1 ... source -> sinkn
# connect splitter_source1 -> sink1 ... splitter_sourcen -> sinkn
- for n, (dst_node, dst_endpoint, src_subrecord) in enumerate(sinks):
+ for n, (dst_node, dst_endpoint, src_subrecord, dst_subrecord) in enumerate(sinks):
self.del_connections(src_node, dst_node,
{"source": src_endpoint, "sink": dst_endpoint})
self.add_connection(splitter, dst_node,

No commit comments for this range

Something went wrong with that request. Please try again.