Video fetch: register the end-of-line test before the SDRAM ack

coco_mem_fetch.sv compared read_count against WORD_END_COUNT on the same
114 MHz edge that took SDRAM_VID_ACK and updated VID_READ_OFFSET, the fetch
address; that path missed timing (-0.7 ns). read_count only changes on the
ack, so the compare is now registered in state_start with identical results.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Alan SterembergandClaude Opus 5.5 committed 2026-10-02 07:15:44 -04:00
1 parent 72a50a16bb
commit 4afcebf22a
1 file changed
+7 -1
+7 -1
View File
@@ -84,6 +84,11 @@ reg [8:0] read_count;
reg [4:0] state; reg [4:0] state;
reg second_write; reg second_write;
reg init_offset_a0; reg init_offset_a0;
// End-of-line test for the fetch being requested, registered in state_start.
// read_count only changes on SDRAM_VID_ACK, so this equals the old in-line
// compare; it takes the 9-bit compare off the ACK -> VID_READ_OFFSET path,
// which missed timing at 114 MHz.
reg last_fetch;
reg [4:0] a0_delay; reg [4:0] a0_delay;
localparam state_pre_start = 4'd0; localparam state_pre_start = 4'd0;
@@ -161,6 +166,7 @@ begin
SDRAM_VID_REQ <= 1'b1; SDRAM_VID_REQ <= 1'b1;
state <= state_wait_accept; state <= state_wait_accept;
init_offset_a0 <= PHY_VID_ADD[1]; init_offset_a0 <= PHY_VID_ADD[1];
last_fetch <= (read_count >= WORD_END_COUNT);
end end
end end
@@ -170,7 +176,7 @@ begin
begin begin
SDRAM_VID_REQ <= 1'b0; SDRAM_VID_REQ <= 1'b0;
if (read_count >= WORD_END_COUNT) if (last_fetch)
begin begin
read_count <= 9'h000; read_count <= 9'h000;
state <= state_done; state <= state_done;