Skip to content

Commit

Permalink
Discard on request from host.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Jul 2, 2024
1 parent 05304b3 commit e4569ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cynthion/python/src/gateware/analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ def __init__(self, *, utmi_interface, mem_depth=4096):
self.stream = StreamInterface(payload_width=16)

self.capture_enable = Signal()
self.discard_request = Signal()
self.idle = Signal()
self.stopped = Signal()
self.overrun = Signal()
self.capturing = Signal()
self.starting = Signal()
self.discarding = Signal()


Expand Down Expand Up @@ -150,6 +152,9 @@ def elaborate(self, platform):
# One word is popped if the FIFO stream is read.
m.d.comb += fifo_words_popped.eq(self.stream.ready & self.stream.valid)

# Discard if starting, or if requested to.
m.d.comb += self.discarding.eq(self.starting | self.discard_request)

# If discarding data, set the count to zero.
with m.If(self.discarding):
m.d.usb += [
Expand Down Expand Up @@ -181,7 +186,7 @@ def elaborate(self, platform):
self.stopped .eq(f.ongoing("AWAIT_START") | f.ongoing("OVERRUN")),
self.overrun .eq(f.ongoing("OVERRUN")),
self.capturing .eq(f.ongoing("CAPTURE_PACKET")),
self.discarding.eq(self.stopped & self.capture_enable),
self.starting .eq(self.stopped & self.capture_enable),
]

# AWAIT_START: wait for capture to be enabled, but don't start mid-packet.
Expand Down
1 change: 1 addition & 0 deletions cynthion/python/src/gateware/analyzer/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def elaborate(self, platform):
m.d.comb += [
# Connect enable signal to host-controlled state register.
analyzer.capture_enable .eq(state.current[0]),
analyzer.discard_request .eq(state.current[3]),

# Flush endpoint when analyzer is idle with capture disabled.
stream_ep.flush .eq(analyzer.idle & ~analyzer.capture_enable),
Expand Down

0 comments on commit e4569ac

Please sign in to comment.