From 4c862350481922cabf42e7138d9e1172f4debd76 Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Mon, 3 Feb 2020 13:35:49 +0100 Subject: [PATCH] phy/model: fix case when not converting init data width --- litedram/phy/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litedram/phy/model.py b/litedram/phy/model.py index ea50166..3fdb6f0 100644 --- a/litedram/phy/model.py +++ b/litedram/phy/model.py @@ -127,16 +127,15 @@ class SDRAMPHYModel(Module): if len(init)%data_width_bytes != 0: init.extend([0]*(data_width_bytes-len(init)%data_width_bytes)) - new_init = [0]*(len(init)//model_data_ratio) # Convert init data width from 32-bit to data_width if needed if model_data_ratio > 1: + new_init = [0]*(len(init)//model_data_ratio) for i in range(0, len(init), model_data_ratio): ints = init[i:i+model_data_ratio] strs = ''.join('{:08x}'.format(x) for x in reversed(ints)) new_init[i//model_data_ratio] = int(strs, 16) - - init = new_init + init = new_init if address_mapping == "ROW_BANK_COL": for row in range(nrows):