Support Record objects.

This commit is contained in:
Tim 'mithro' Ansell 2016-12-14 16:57:32 +01:00
parent edbcf65f6f
commit 9f829fe608
1 changed files with 12 additions and 1 deletions

View File

@ -162,7 +162,18 @@ class LiteScopeIO(Module, AutoCSR):
class LiteScopeAnalyzer(Module, AutoCSR):
def __init__(self, signals, depth, cd="sys", cd_ratio=1):
self.signals = [signals] if not isinstance(signals, list) else signals
if not isinstance(signals, list):
signals = [signals]
split_signals = []
for s in signals:
if isinstance(s, Record):
split_signals.extend(s.flatten())
else:
split_signals.append(s)
signals = split_signals
self.signals = signals
self.dw = sum([len(s) for s in signals])
self.core_dw = self.dw*cd_ratio