Configure LiteScopeAnalyzer with Run-Length Encoding (RLE)
masterLiteScopeAnalyzer supports optional Run-Length Encoding (RLE) to compress repeated samples in Block RAM.
Hardware Configuration (Migen):
When defining the analyzer in your hardware description, set with_rle=True and specify an rle_length (e.g., 256).
Software Configuration (Python Driver):
If RLE was enabled at build time, you must explicitly enable it in the driver before performing a capture using configure_rle(True).
Important Note on Depth:
When RLE is enabled, the depth and capture length parameters refer to the number of encoded storage words, not the final count of decoded logical samples. A compressed capture can result in more logical samples than the configured storage length.
# Hardware side configuration
analyzer = LiteScopeAnalyzer(
signals,
depth = 1024,
with_rle = True,
rle_length = 256,
)
# Software side driver configuration
from litescope import LiteScopeAnalyzerDriver
analyzer = LiteScopeAnalyzerDriver(bus.regs, "analyzer", config_csv="analyzer.csv")
# Enable RLE for the capture
analyzer.configure_rle(True)
# To cap the decoded logical samples returned by the driver:
data = analyzer.upload(max_samples=1024)