core/_Storage: Simplify using connect and create specific endpoint for read_source.
This commit is contained in:
parent
3fb1018737
commit
1d85cbcb6d
|
@ -223,17 +223,15 @@ class _Storage(Module, AutoCSR):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Memory read
|
# Memory read
|
||||||
|
read_source = stream.Endpoint([("data", data_width)])
|
||||||
if data_width > read_width:
|
if data_width > read_width:
|
||||||
pad_bits = - data_width % read_width
|
pad_bits = - data_width % read_width
|
||||||
self.submodules.w_conv = w_conv = stream.Converter(data_width + pad_bits, read_width)
|
w_conv = stream.Converter(data_width + pad_bits, read_width)
|
||||||
self.comb += [
|
self.submodules += w_conv
|
||||||
self.w_conv.sink.data.eq(cdc.source.data),
|
self.comb += cdc.source.connect(w_conv.sink)
|
||||||
self.w_conv.sink.valid.eq(cdc.source.valid),
|
self.comb += w_conv.source.connect(read_source)
|
||||||
cdc.source.ready.eq(self.w_conv.sink.ready),
|
|
||||||
]
|
|
||||||
read_source = w_conv.source
|
|
||||||
else:
|
else:
|
||||||
read_source = cdc.source
|
self.comb += cdc.source.connect(read_source)
|
||||||
|
|
||||||
self.comb += [
|
self.comb += [
|
||||||
read_source.ready.eq(self.mem_data.we | ~self.enable.storage),
|
read_source.ready.eq(self.mem_data.we | ~self.enable.storage),
|
||||||
|
|
Loading…
Reference in New Issue