Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cde39f3

Browse files
committedMar 12, 2016
interconnect/stream: add insert_chunks parameter to Converter (to be validated with ARTIQ's Analyzer)
1 parent df3a45b commit cde39f3

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed
 

Diff for: ‎misoc/interconnect/stream.py

+24-4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class _UpConverter(Module):
132132
def __init__(self, layout_from, layout_to, ratio, reverse):
133133
self.sink = sink = Endpoint(layout_from)
134134
self.source = source = Endpoint(layout_to)
135+
self.chunks = Signal(bits_for(ratio))
135136

136137
# # #
137138

@@ -176,11 +177,15 @@ def __init__(self, layout_from, layout_to, ratio, reverse):
176177
self.sync += If(load_part, Case(demux, cases))
177178
self.comb += source.payload.raw_bits().eq(source_payload_raw_bits)
178179

180+
# chunks
181+
self.sync += If(load_part, self.chunks.eq(demux + 1))
182+
179183

180184
class _DownConverter(Module):
181185
def __init__(self, layout_from, layout_to, ratio, reverse):
182186
self.sink = sink = Endpoint(layout_from)
183187
self.source = source = Endpoint(layout_to)
188+
self.chunks = Signal()
184189

185190
# # #
186191

@@ -212,17 +217,24 @@ def __init__(self, layout_from, layout_to, ratio, reverse):
212217
src = sink_payload_raw_bits[n*width:(n+1)*width]
213218
dst = source.payload.raw_bits()
214219
cases[i] = dst.eq(src)
215-
self.comb += Case(mux, cases).makedefault(),
220+
self.comb += Case(mux, cases).makedefault()
221+
222+
# chunks
223+
self.comb += self.chunks.eq(last)
216224

217225

218226
class _IdentityConverter(Module):
219227
def __init__(self, layout_from, layout_to, ratio, reverse):
220228
self.sink = sink = Endpoint(layout_from)
221229
self.source = source = Endpoint(layout_to)
230+
self.chunks = Signal()
222231

223232
# # #
224233

225-
self.comb += sink.connect(source)
234+
self.comb += [
235+
sink.connect(source),
236+
self.chunks.eq(1)
237+
]
226238

227239

228240
def _get_converter_ratio(layout_from, layout_to):
@@ -247,15 +259,23 @@ def _get_converter_ratio(layout_from, layout_to):
247259

248260

249261
class Converter(Module):
250-
def __init__(self, layout_from, layout_to, reverse=False):
262+
def __init__(self, layout_from, layout_to, reverse=False, insert_chunks=False):
251263
self.cls, self.ratio = _get_converter_ratio(layout_from, layout_to)
252264

253265
# # #
254266

255267
converter = self.cls(layout_from, layout_to, self.ratio, reverse)
256268
self.submodules += converter
257269

258-
self.sink, self.source = converter.sink, converter.source
270+
self.sink = converter.sink
271+
if insert_chunks:
272+
self.source = Endpoint(layout_from + [("chunks", bits_for(self.ratio))])
273+
self.comb += [
274+
converter.source.connect(self.source),
275+
self.source.chunks.eq(converter.chunks)
276+
]
277+
else:
278+
self.source = converter.source
259279

260280

261281
class StrideConverter(Module):

0 commit comments

Comments
 (0)
Please sign in to comment.