Fix initialization delay

There was an issue where the initialization sequence wasn't being calculated correctly. It could result in the SDRAM not being initialized properly.
This commit is contained in:
Joshua Bassett
2020-09-27 20:51:44 +10:00
parent 9589822404
commit 3672a2e409

View File

@@ -160,7 +160,7 @@ architecture arch of sdram is
constant CLK_PERIOD : real := 1.0/CLK_FREQ*1000.0;
-- the number of clock cycles to wait before initialising the device
constant DESELECT_WAIT : natural := natural(ceil(T_DESL/CLK_PERIOD));
constant INIT_WAIT : natural := natural(ceil(T_DESL/CLK_PERIOD));
-- the number of clock cycles to wait while a LOAD MODE command is being
-- executed
@@ -234,13 +234,13 @@ begin
when INIT =>
if wait_counter = 0 then
next_cmd <= CMD_DESELECT;
elsif wait_counter = DESELECT_WAIT-1 then
elsif wait_counter = INIT_WAIT-1 then
next_cmd <= CMD_PRECHARGE;
elsif wait_counter = PRECHARGE_WAIT-1 then
elsif wait_counter = INIT_WAIT+PRECHARGE_WAIT-1 then
next_cmd <= CMD_AUTO_REFRESH;
elsif wait_counter = PRECHARGE_WAIT+REFRESH_WAIT-1 then
elsif wait_counter = INIT_WAIT+PRECHARGE_WAIT+REFRESH_WAIT-1 then
next_cmd <= CMD_AUTO_REFRESH;
elsif wait_counter = PRECHARGE_WAIT+REFRESH_WAIT+REFRESH_WAIT-1 then
elsif wait_counter = INIT_WAIT+PRECHARGE_WAIT+REFRESH_WAIT+REFRESH_WAIT-1 then
next_state <= MODE;
next_cmd <= CMD_LOAD_MODE;
end if;