From 100e6d9bc6aaeb2a7c47a119ead5c51525999fe7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 2 Sep 2024 14:36:57 +0200 Subject: [PATCH] core/crossbar: Fix cba_shifts when bank_byte_alignment is not defined. --- litedram/core/crossbar.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litedram/core/crossbar.py b/litedram/core/crossbar.py index 64da8e65..46aebca7 100644 --- a/litedram/core/crossbar.py +++ b/litedram/core/crossbar.py @@ -127,7 +127,12 @@ def do_finalize(self): nmasters = len(self.masters) # Address mapping -------------------------------------------------------------------------- - cba_shifts = {"ROW_BANK_COL": max(controller.settings.geom.colbits - controller.address_align, log2_int(controller.settings.bank_byte_alignment //(controller.data_width // 8))) } + cba_shifts = { + "ROW_BANK_COL": max( + controller.settings.geom.colbits - controller.address_align, + log2_int(getattr(controller.settings, "bank_byte_alignment", 0) //(controller.data_width // 8)) + ) + } cba_shift = cba_shifts[controller.settings.address_mapping] m_ba = [m.get_bank_address(self.bank_bits, cba_shift)for m in self.masters] m_rca = [m.get_row_column_address(self.bank_bits, self.rca_bits, cba_shift) for m in self.masters]