add storage qualifier
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 27 Jan 2015 19:14:07 +0000 (20:14 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 27 Jan 2015 19:14:07 +0000 (20:14 +0100)
README
litescope/core/storage.py
litescope/frontend/la.py
litescope/host/driver.py
test/test_la.py

diff --git a/README b/README
index c310196d7e231e29d5c8572016cb2d9f265f1623..0443353d4256be404844d185b8c97ba54c49d333 100644 (file)
--- a/README
+++ b/README
@@ -44,6 +44,8 @@ external Rx/Tx pins to be ready to debug or control all your Wishbone peripheral
 - Logic analyser with LiteScopeLA:
   - Various triggering modules: Term, Range, Edge (add yours! :)
   - Run Length Encoder to "compress" data and increase recording depth
+  - Subsampling
+  - Storage qualifier
   - Data storage in block rams
 
 [> Possibles improvements
index be1ac211e580ed239bd694432101afb6101ef67d..ce1cf35d558e75cb5408940cf1d893df09a9acc0 100644 (file)
@@ -85,6 +85,7 @@ class LiteScopeRecorderUnit(Module):
                self.data_sink = data_sink = Sink(data_layout(dw))
 
                self.trigger = Signal()
+               self.qualifier = Signal()
                self.length = Signal(bits_for(depth))
                self.offset = Signal(bits_for(depth))
                self.done = Signal()
@@ -119,7 +120,11 @@ class LiteScopeRecorderUnit(Module):
                        If(trigger_sink.stb & trigger_sink.hit, NextState("POST_HIT_RECORDING"))
                )
                fsm.act("POST_HIT_RECORDING",
-                       fifo.sink.stb.eq(data_sink.stb),
+                       If(self.qualifier,
+                               fifo.sink.stb.eq(trigger_sink.stb & trigger_sink.hit & data_sink.stb)
+                       ).Else(
+                               fifo.sink.stb.eq(data_sink.stb)
+                       ),
                        fifo.sink.data.eq(data_sink.data),
                        data_sink.ack.eq(fifo.sink.ack),
 
@@ -131,6 +136,7 @@ class LiteScopeRecorder(LiteScopeRecorderUnit, AutoCSR):
                LiteScopeRecorderUnit.__init__(self, dw, depth)
 
                self._trigger = CSR()
+               self._qualifier = CSRStorage()
                self._length = CSRStorage(bits_for(depth))
                self._offset = CSRStorage(bits_for(depth))
                self._done = CSRStatus()
@@ -143,6 +149,7 @@ class LiteScopeRecorder(LiteScopeRecorderUnit, AutoCSR):
 
                self.comb += [
                        self.trigger.eq(self._trigger.re),
+                       self.qualifier.eq(self._qualifier.storage),
                        self.length.eq(self._length.storage),
                        self.offset.eq(self._offset.storage),
                        self._done.status.eq(self.done),
index 4defc02ac9696d4d030eb3914eaf148112eb4ff7..104ced6807c3402b4e5e0e7fc420840cae0f9ce2 100644 (file)
@@ -63,7 +63,11 @@ class LiteScopeLA(Module, AutoCSR):
                                Record.connect(rle.source, self.recorder.data_sink)
                        ]
                else:
-                       self.comb += Record.connect(sink, self.recorder.data_sink)
+                       self.submodules.delay_buffer = Buffer(self.sink.description)
+                       self.comb += [
+                               Record.connect(sink, self.delay_buffer.d),
+                               Record.connect(self.delay_buffer.q, self.recorder.data_sink)
+                       ]
 
        def export(self, vns, filename):
                def format_line(*args):
index 4c305a0e17fd0d219d7d6aff302cb21784ced406..904b9fef13822edadc4391fe06f11b6dd276bbd1 100644 (file)
@@ -187,6 +187,9 @@ class LiteScopeLADriver():
        def configure_subsampler(self, n):
                self.subsampler_value.write(n-1)
 
+       def configure_qualifier(self, v):
+               self.recorder_qualifier.write(v)
+
        def configure_rle(self, v):
                self.rle_enable.write(v)
 
index 4904aa0810d2301734d8ec3433cac44eaa74b1b8..48b7a9ba250be9ecfdf1235262ef105dc704c27a 100644 (file)
@@ -8,7 +8,8 @@ la = LiteScopeLADriver(wb.regs, "la", debug=True)
 cond = {"cnt0" :       128} # trigger on cnt0 = 128
 la.configure_term(port=0, cond=cond)
 la.configure_sum("term")
-la.configure_subsampler(16)
+la.configure_subsampler(1)
+la.configure_qualifier(1)
 la.run(offset=128, length=256)
 
 while not la.done():