From eb6268a78366e28d652fdee8f3859cd9c071f1f8 Mon Sep 17 00:00:00 2001 From: David Shah Date: Tue, 13 Oct 2020 13:10:31 +0100 Subject: [PATCH] init: Cast DDR4 RCD fine_speed to int Fixes `TypeError: unsupported operand type(s) for |: 'int' and 'float'` for some clock frequencies. Signed-off-by: David Shah --- litedram/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litedram/init.py b/litedram/init.py index 7fa6cb8..7e5f5cb 100644 --- a/litedram/init.py +++ b/litedram/init.py @@ -398,7 +398,7 @@ def get_ddr4_phy_init_sequence(phy_settings, timing_settings): def get_fine_speed(tck): # JESD82-31A page 83 freq = 2/tck - fine_speed = (freq - 1240e6) // 20e6 + fine_speed = int((freq - 1240e6) // 20e6) fine_speed = max(fine_speed, 0) fine_speed = min(fine_speed, 0b1100001) return fine_speed