software: add rising/falling edge support
This commit is contained in:
parent
65b7f08cbc
commit
a269e67a10
|
@ -13,7 +13,7 @@ dumps = {
|
|||
|
||||
for group, filename in dumps.items():
|
||||
analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
|
||||
analyzer.configure_trigger(cond={"zero": 1})
|
||||
analyzer.add_rising_edge_trigger("zero")
|
||||
analyzer.configure_subsampler(1)
|
||||
analyzer.configure_group(group)
|
||||
analyzer.run(offset=32, length=128)
|
||||
|
|
|
@ -65,8 +65,9 @@ class LiteScopeAnalyzerDriver:
|
|||
self.group = value
|
||||
self.mux_value.write(value)
|
||||
|
||||
def configure_trigger(self, value=0, mask=0, cond=None):
|
||||
self.frontend_trigger_enable.write(0)
|
||||
def add_trigger(self, value=0, mask=0, cond=None):
|
||||
if self.frontend_trigger_mem_full.read():
|
||||
raise ValueError("Trigger memory full, too much conditions")
|
||||
if cond is not None:
|
||||
for k, v in cond.items():
|
||||
value |= getattr(self, k + "_o")*v
|
||||
|
@ -75,6 +76,17 @@ class LiteScopeAnalyzerDriver:
|
|||
self.frontend_trigger_mem_value.write(value)
|
||||
self.frontend_trigger_mem_write.write(1)
|
||||
|
||||
def add_rising_edge_trigger(self, name):
|
||||
self.add_trigger(getattr(self, name + "_o")*0, getattr(self, name + "_m"))
|
||||
self.add_trigger(getattr(self, name + "_o")*1, getattr(self, name + "_m"))
|
||||
|
||||
def add_falling_edge_trigger(self, name):
|
||||
self.add_trigger(getattr(self, name + "_o")*1, getattr(self, name + "_m"))
|
||||
self.add_trigger(getattr(self, name + "_o")*0, getattr(self, name + "_m"))
|
||||
|
||||
def configure_trigger(self, value=0, mask=0, cond=None):
|
||||
self.add_trigger(value, mask, cond)
|
||||
|
||||
def configure_subsampler(self, value):
|
||||
self.frontend_subsampler_value.write(value-1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue