x393  1.0
FPGAcodeforElphelNC393camera
dcc_sync393.v
Go to the documentation of this file.
1 
41 `timescale 1ns/1ps
42 
43 module dcc_sync393(
44  input sclk, // system clock: twe, ta,tdi - valid @negedge (ra, tdi - 2 cycles ahead)
45  input dcc_en, // clk rising, sync with start of the frame
46  input finish_dcc, // sclk rising
47  input dcc_vld, // clk rising
48  input [15:0] dcc_data, //[15:0] clk risimg
49  output reg statistics_dv, //sclk
50  output reg [15:0] statistics_do); //[15:0] sclk
51 
53  reg dcc_run;
55  reg skip16; // output just 16 zero words (data was multiple of 16 words)
56  reg [ 4:0] dcc_cntr;
57 
58  always @ (posedge sclk) begin
59  dcc_run <= dcc_en;
61  statistics_do[15:0] <= statistics_we?dcc_data[15:0]:16'h0;
63  skip16 <= finish_dcc && (statistics_dv?(dcc_cntr[3:0]==4'hf):(dcc_cntr[3:0]==4'h0) );
64  if (!dcc_run) dcc_cntr[3:0] <= 4'h0;
65  else if (statistics_dv) dcc_cntr[3:0] <= dcc_cntr[3:0]+1;
66  dcc_cntr[4] <= dcc_run && ((dcc_finishing && ((dcc_cntr[3:0]==4'hf)^dcc_cntr[4]) || skip16));
67  dcc_finishing <= dcc_run && (finish_dcc || (dcc_finishing && (dcc_cntr[4:1]!=4'hf)));
68  end
69 
70 endmodule
71 
2297dcc_runreg
Definition: dcc_sync393.v:53
2296statistics_wereg
Definition: dcc_sync393.v:52
reg [15:0] 2295statistics_do
Definition: dcc_sync393.v:50
2300dcc_cntrreg[4:0]
Definition: dcc_sync393.v:56
2298dcc_finishingreg
Definition: dcc_sync393.v:54
[15:0] 2293dcc_data
Definition: dcc_sync393.v:48
reg 2294statistics_dv
Definition: dcc_sync393.v:49