Add wait states during refresh

This commit is contained in:
Byron Lathi
2023-07-19 21:06:54 -07:00
parent 21e3a477c1
commit 6eeecda368

View File

@@ -14,6 +14,8 @@ module sdram_adapter(
output o_sdr_init_done,
output o_wait,
output o_sdr_CKE,
output o_sdr_n_CS,
output o_sdr_n_RAS,
@@ -100,6 +102,32 @@ always @(posedge i_sysclk) begin
o_data <= _data;
end
logic r_wait;
logic _r_wait;
assign o_wait = r_wait;
// we need to assert rdy low until a falling edge if a reset happens
always @(posedge i_sysclk or posedge i_arst) begin
if (i_arst == '1) begin
r_wait <= '0;
_r_wait <= '0;
end else begin
if (o_dbg_ref_req) begin
r_wait <= '1;
end else if (i_cpuclk == '1) begin
_r_wait <= '1;
end
if (i_cpuclk == '0) begin
if (_r_wait) begin
_r_wait <= '0;
r_wait <= '0;
end
end
end
end
//because of timing issues, We really need to trigger
//the write on the falling edge of phi2. There is a 2ns
//delay between the rising edge of phi2 and data valid
@@ -220,6 +248,8 @@ logic [31:0] o_dbg_DATA_in;
logic o_sdr_init_done;
logic [3:0] o_sdr_state;
assign o_ref_req = o_dbg_ref_req;
sdram_controller u_sdram_controller(
.i_arst(i_arst), //Positive Controller Reset