enable RLE only in POST_HIT_RECORDING state (to ensure programmed offset is respected)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 19 Feb 2015 09:26:34 +0000 (10:26 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 19 Feb 2015 09:26:34 +0000 (10:26 +0100)
litescope/core/storage.py
litescope/frontend/la.py

index 1bd67743ebf5892c0af705398a6c532615d8ce67..d1c8cb297879072036f7f939e2aae25163ea6008 100644 (file)
@@ -73,8 +73,9 @@ class LiteScopeRunLengthEncoder(LiteScopeRunLengthEncoderUnit, AutoCSR):
        def __init__(self, dw, length=1024):
                LiteScopeRunLengthEncoderUnit.__init__(self, dw, length)
                self._enable = CSRStorage()
+               self.external_enable = Signal(reset=1)
                ###
-               self.comb += self.enable.eq(self._enable.storage)
+               self.comb += self.enable.eq(self._enable.storage & self.external_enable)
 
 class LiteScopeRecorderUnit(Module):
        def __init__(self, dw, depth):
@@ -89,6 +90,7 @@ class LiteScopeRecorderUnit(Module):
                self.length = Signal(bits_for(depth))
                self.offset = Signal(bits_for(depth))
                self.done = Signal()
+               self.post_hit = Signal()
 
                self.source = Source(data_layout(dw))
 
@@ -120,6 +122,7 @@ class LiteScopeRecorderUnit(Module):
                        If(trigger_sink.stb & trigger_sink.hit, NextState("POST_HIT_RECORDING"))
                )
                fsm.act("POST_HIT_RECORDING",
+                       self.post_hit.eq(1),
                        If(self.qualifier,
                                fifo.sink.stb.eq(trigger_sink.stb & trigger_sink.hit & data_sink.stb)
                        ).Else(
index cd6499c284550a7e276c7a7e97cac1bb47ccc4d7..16be1facae31dcbe1db8d87158a9052fbd52711a 100644 (file)
@@ -59,7 +59,8 @@ class LiteScopeLA(Module, AutoCSR):
                        self.submodules.rle = LiteScopeRunLengthEncoder(self.dw)
                        self.comb += [
                                Record.connect(sink, self.rle.sink),
-                               Record.connect(self.rle.source, self.recorder.data_sink)
+                               Record.connect(self.rle.source, self.recorder.data_sink),
+                               self.rle.external_enable.eq(self.recorder.post_hit)
                        ]
                else:
                        self.submodules.delay_buffer = Buffer(self.sink.description)