if (mrst) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= 0; //{FRAME_HEIGHT_BITS{1'b0}};
// else if (chn_rst || frame_start_r[0]) line_unfinished_r[1] <= window_y0+start_y;
// else if (chn_rst || frame_start_r[0]) line_unfinished_r[1] <= window_y0+start_y;
elseif(chn_rst||frame_start_r[2])line_unfinished_r[1]<=window_y0+start_y;// _r[0] -> _r[2] to make it simultaneous with frame_number
else if (chn_rst || frame_start_r[2]) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= window_y0+start_y; // _r[0] -> _r[2] to make it simultaneous with frame_number
// in read mode advance line number ASAP
// in read mode advance line number ASAP
elseif(xfer_start_r[2]&&!cmd_wrmem)line_unfinished_r[1]<=window_y0+next_y[FRAME_HEIGHT_BITS-1:0];// latency 2 from xfer_start
else if (xfer_start_r[2] && !cmd_wrmem) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= window_y0+next_y[FRAME_HEIGHT_BITS-1:0]; // latency 2 from xfer_start
// in write mode advance line number only when it is guaranteed it will be the first to actually access memory
// in write mode advance line number only when it is guaranteed it will be the first to actually access memory
if (mrst) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= 0; //{FRAME_HEIGHT_BITS{1'b0}};
elseif(chn_rst||frame_start_r[2])line_unfinished_r[1]<=window_y0+start_y;// _r[0] -> _r[2] to make it simultaneous with frame_number
else if (chn_rst || frame_start_r[2]) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= window_y0+start_y; // _r[0] -> _r[2] to make it simultaneous with frame_number
// in read mode advance line number ASAP
// in read mode advance line number ASAP
elseif(xfer_start_r[2]&&!cmd_wrmem)line_unfinished_r[1]<=window_y0+next_y[FRAME_HEIGHT_BITS-1:0];// latency 2 from xfer_start
else if (xfer_start_r[2] && !cmd_wrmem) line_unfinished_r[FRAME_HEIGHT_BITS +: FRAME_HEIGHT_BITS] <= window_y0+next_y[FRAME_HEIGHT_BITS-1:0]; // latency 2 from xfer_start
// in write mode advance line number only when it is guaranteed it will be the first to actually access memory
// in write mode advance line number only when it is guaranteed it will be the first to actually access memory