enable RLE only in POST_HIT_RECORDING state (to ensure programmed offset is respected)

This commit is contained in:
Florent Kermarrec 2015-02-19 10:26:34 +01:00
parent 788652c6f8
commit 5fb6beb473
2 changed files with 6 additions and 2 deletions

View File

@ -73,8 +73,9 @@ class LiteScopeRunLengthEncoder(LiteScopeRunLengthEncoderUnit, AutoCSR):
def __init__(self, dw, length=1024): def __init__(self, dw, length=1024):
LiteScopeRunLengthEncoderUnit.__init__(self, dw, length) LiteScopeRunLengthEncoderUnit.__init__(self, dw, length)
self._enable = CSRStorage() 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): class LiteScopeRecorderUnit(Module):
def __init__(self, dw, depth): def __init__(self, dw, depth):
@ -89,6 +90,7 @@ class LiteScopeRecorderUnit(Module):
self.length = Signal(bits_for(depth)) self.length = Signal(bits_for(depth))
self.offset = Signal(bits_for(depth)) self.offset = Signal(bits_for(depth))
self.done = Signal() self.done = Signal()
self.post_hit = Signal()
self.source = Source(data_layout(dw)) self.source = Source(data_layout(dw))
@ -120,6 +122,7 @@ class LiteScopeRecorderUnit(Module):
If(trigger_sink.stb & trigger_sink.hit, NextState("POST_HIT_RECORDING")) If(trigger_sink.stb & trigger_sink.hit, NextState("POST_HIT_RECORDING"))
) )
fsm.act("POST_HIT_RECORDING", fsm.act("POST_HIT_RECORDING",
self.post_hit.eq(1),
If(self.qualifier, If(self.qualifier,
fifo.sink.stb.eq(trigger_sink.stb & trigger_sink.hit & data_sink.stb) fifo.sink.stb.eq(trigger_sink.stb & trigger_sink.hit & data_sink.stb)
).Else( ).Else(

View File

@ -59,7 +59,8 @@ class LiteScopeLA(Module, AutoCSR):
self.submodules.rle = LiteScopeRunLengthEncoder(self.dw) self.submodules.rle = LiteScopeRunLengthEncoder(self.dw)
self.comb += [ self.comb += [
Record.connect(sink, self.rle.sink), 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: else:
self.submodules.delay_buffer = Buffer(self.sink.description) self.submodules.delay_buffer = Buffer(self.sink.description)