parameterSENSOR_FIFO_DELAY=7// approxiametly half (1 << SENSOR_FIFO_2DEPTH) - how long to wait after getting HACT on FIFO before stering it on output
parameterSENSOR_FIFO_DELAY=5// 7 // approxiametly half (1 << SENSOR_FIFO_2DEPTH) - how long to wait after getting HACT on FIFO before stering it on output
)(
)(
// input rst,
// input rst,
inputiclk,// input -synchronous clock
inputiclk,// input -synchronous clock
...
@@ -45,7 +45,8 @@ module sensor_fifo #(
...
@@ -45,7 +45,8 @@ module sensor_fifo #(
regsof_r,eof_r;
regsof_r,eof_r;
wirewe;
wirewe;
// output clock domain
// output clock domain
wirepre_re,re_w,re;
// wire pre_re;
wirere;// re_w,re;
regre_r;
regre_r;
reg[1:0]pre_hact;
reg[1:0]pre_hact;
reghact_out_r;
reghact_out_r;
...
@@ -86,14 +87,44 @@ module sensor_fifo #(
...
@@ -86,14 +87,44 @@ module sensor_fifo #(
);
);
// output clock domain
// output clock domain
assignpre_re=nempty&&!re_r;
// assign pre_re = nempty && !re_r;
assignre_w=re_r&&nempty;// to protect from false positive on nempty
// Generating first read (for hact), then wait to fill half FIFO and continue continuous read until hact end
assignre=(re_w&&!pre_hact)||hact_out_r;
// assign re_w = re_r && nempty; // to protect from false positive on nempty
// assign re = (re_w && !pre_hact) || hact_out_r; // no check for nempty - producing un-interrupted stream
assignre=(re_r&&nempty&&!pre_hact[0])||hact_out_r;// no check for nempty - producing un-interrupted stream
assignpxd_out=pxd_r;
assignpxd_out=pxd_r;
assigndata_valid=hact_out_r;
assigndata_valid=hact_out_r;
assignsof=sof_r;
assignsof=sof_r;
assigneof=eof_r;
assigneof=eof_r;
always@(posedgepclk)begin
if(prst)re_r<=0;
elsere_r<=nempty&&!re_r&&!pre_hact[0];// only generate one cycle (after SOF of HACT)