phy/model: fix case when not converting init data width

This commit is contained in:
Piotr Binkowski 2020-02-03 13:35:49 +01:00
parent a903c87872
commit 4c86235048
1 changed files with 2 additions and 3 deletions

View File

@ -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):