From d3486dba91cfc29f7dd26d5b17fa092682444eb0 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 23 Feb 2015 09:41:18 +0100 Subject: [PATCH] rle: increase dw automatically when needed --- litescope/core/storage.py | 2 -- litescope/frontend/la.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/litescope/core/storage.py b/litescope/core/storage.py index 48ff9d16..30aab161 100644 --- a/litescope/core/storage.py +++ b/litescope/core/storage.py @@ -28,8 +28,6 @@ class LiteScopeRunLengthEncoderUnit(Module): def __init__(self, dw, length): self.dw = dw self.length = length - if dw < (log2_int(length) + 1): - raise ValueError("Not enough bits to encode RLE length, increase dw or reduce RLE length") self.sink = sink = Sink(data_layout(dw)) self.source = source = Source(data_layout(dw)) diff --git a/litescope/frontend/la.py b/litescope/frontend/la.py index cbe7dbc4..fd8bd269 100644 --- a/litescope/frontend/la.py +++ b/litescope/frontend/la.py @@ -13,6 +13,7 @@ class LiteScopeLA(Module, AutoCSR): self.data = Cat(*layout) self.dw = flen(self.data) if with_rle: + self.dw = max(self.dw, log2_int(rle_length)) self.dw += 1 self.depth = depth self.clk_domain = clk_domain -- 2.30.2