forked from M-Labs/artiq
analyzer: fix byte_count
This commit is contained in:
parent
62ac4e3c2e
commit
85ea70a664
|
@ -167,11 +167,9 @@ class DMAWriter(Module, AutoCSR):
|
||||||
alignment_bits=data_alignment)
|
alignment_bits=data_alignment)
|
||||||
self.byte_count = CSRStatus(32) # only read when shut down
|
self.byte_count = CSRStatus(32) # only read when shut down
|
||||||
|
|
||||||
sink_layout = [("data", dw)]
|
self.sink = stream.Endpoint(
|
||||||
if messages_per_dw > 1:
|
[("data", dw),
|
||||||
sink_layout.append(("valid_token_count",
|
("valid_token_count", bits_for(messages_per_dw))])
|
||||||
bits_for(messages_per_dw)))
|
|
||||||
self.sink = stream.Endpoint(sink_layout)
|
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
@ -201,12 +199,13 @@ class DMAWriter(Module, AutoCSR):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
event_counter = Signal(32)
|
message_count = Signal(32 - log2_int(message_len))
|
||||||
self.comb += self.byte_count.status.eq(
|
self.comb += self.byte_count.status.eq(
|
||||||
event_counter << data_alignment)
|
message_count << log2_int(message_len))
|
||||||
self.sync += [
|
self.sync += [
|
||||||
If(self.reset.re, event_counter.eq(0)),
|
If(self.reset.re, message_count.eq(0)),
|
||||||
If(membus.ack, event_counter.eq(event_counter + 1))
|
If(membus.ack, message_count.eq(
|
||||||
|
message_count + self.sink.valid_token_count))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,10 +219,9 @@ class Analyzer(Module, AutoCSR):
|
||||||
rtio_core, self.enable.storage)
|
rtio_core, self.enable.storage)
|
||||||
self.submodules.fifo = stream.SyncFIFO(
|
self.submodules.fifo = stream.SyncFIFO(
|
||||||
[("data", message_len)], fifo_depth, True)
|
[("data", message_len)], fifo_depth, True)
|
||||||
dw = len(membus.dat_w)
|
|
||||||
self.submodules.converter = stream.Converter(
|
self.submodules.converter = stream.Converter(
|
||||||
message_len, dw, reverse=True,
|
message_len, len(membus.dat_w), reverse=True,
|
||||||
report_valid_token_count=dw > message_len)
|
report_valid_token_count=True)
|
||||||
self.submodules.dma = DMAWriter(membus)
|
self.submodules.dma = DMAWriter(membus)
|
||||||
|
|
||||||
enable_r = Signal()
|
enable_r = Signal()
|
||||||
|
|
Loading…
Reference in New Issue