software/Dump: add add_scope_clk and add_scope_trig methods and add scope_clk/trig to dumps.
This commit is contained in:
parent
219a90122f
commit
69de7c4930
|
@ -32,7 +32,10 @@ class LiteScopeAnalyzerDriver:
|
|||
self.group = 0
|
||||
self.data = DumpData(self.data_width)
|
||||
|
||||
# disable trigger and storage
|
||||
self.offset = 0
|
||||
self.length = None
|
||||
|
||||
# Disable trigger and storage
|
||||
self.trigger_enable.write(0)
|
||||
self.storage_enable.write(0)
|
||||
|
||||
|
@ -104,6 +107,8 @@ class LiteScopeAnalyzerDriver:
|
|||
length = self.depth
|
||||
assert offset < self.depth
|
||||
assert length <= self.depth
|
||||
self.offset = offset
|
||||
self.length = length
|
||||
if self.debug:
|
||||
print("[running]...")
|
||||
self.storage_offset.write(offset)
|
||||
|
@ -124,7 +129,7 @@ class LiteScopeAnalyzerDriver:
|
|||
length = self.storage_length.read()
|
||||
for position in range(1, length + 1):
|
||||
if self.debug:
|
||||
sys.stdout.write("|{}>{}| {}%\r".format('=' * (20*position//length),
|
||||
sys.stdout.write("[{}>{}] {}%\r".format('=' * (20*position//length),
|
||||
' ' * (20-20*position//length),
|
||||
100*position//length))
|
||||
sys.stdout.flush()
|
||||
|
@ -153,6 +158,8 @@ class LiteScopeAnalyzerDriver:
|
|||
dump.add_from_layout(self.layouts[self.group], self.data)
|
||||
else:
|
||||
dump.add_from_layout_flatten(self.layouts[self.group], self.data)
|
||||
dump.add_scope_clk()
|
||||
dump.add_scope_trig(self.offset)
|
||||
dump.write(filename)
|
||||
|
||||
def get_instant_value(self, group, name):
|
||||
|
|
|
@ -77,7 +77,6 @@ class Dump:
|
|||
values2x = [values[i//2] for i in range(len(values)*2)]
|
||||
self.add(DumpVariable(name, sample_width, values2x))
|
||||
offset += sample_width
|
||||
self.add(DumpVariable("scope_clk", 1, [1, 0]*(len(self)//2)))
|
||||
|
||||
def add_from_layout_flatten(self, layout, variable):
|
||||
offset = 0
|
||||
|
@ -89,10 +88,13 @@ class Dump:
|
|||
values_flatten = [values[i//sample_width] >> (i % sample_width ) & 1 for i in range(len(values)*sample_width)]
|
||||
self.add(DumpVariable(name, 1, values_flatten))
|
||||
offset += sample_width
|
||||
# the clock.. might need some more love here. the clock pattern probably should be sample_width wide
|
||||
# e.g. 11110000 and not 10101010
|
||||
|
||||
def add_scope_clk(self):
|
||||
self.add(DumpVariable("scope_clk", 1, [1, 0]*(len(self)//2)))
|
||||
|
||||
def add_scope_trig(self, offset):
|
||||
self.add(DumpVariable("scope_trig", 1, [0]*offset + [1]*(len(self)-offset)))
|
||||
|
||||
def __len__(self):
|
||||
l = 0
|
||||
for variable in self.variables:
|
||||
|
|
Loading…
Reference in New Issue