x393  1.0
FPGAcodeforElphelNC393camera
lens_flat393.v
Go to the documentation of this file.
1 
45 `timescale 1ns / 1ps
46 /*
47 F2(x,y)=p*(x-x0)^2 + q(y-yo)^2 + c=
48  p*x^2 - (2*p*x0) * x + p* (x0*x0) + q*y^2 - (2*q*y0) * y + q* (y0*y0) + c=
49  p* x^2 - (2*p*x0) * x + q* y^2 -(2*q)* y + (p* (x0*x0)+q* (y0*y0) + c)
50 Final:
51 F2(X,Y)=p* x^2 - (2*p*x0) * x + q* y^2 -(2*q)* y + (p* (x0*x0)+q* (y0*y0) + c):
52 Ax(Y)= p
53 Bx(Y)=-(2*p)
54 F(0,Y)= q*y^2 - (2*q*y0) * y + (q* (y0*y0) + c + p* (x0*x0))
55 C= (q* (y0*y0) + c + p* (x0*x0));
56 BY= - (2*q*y0)
57 AY= q
58 AX= p
59 BX= -2*p*x0
60 */
61 
62 module lens_flat393 #(
63 // Vignetting correction / pixel value scaling - controlled via single data word (same as in 252), some of bits [23:16]
64 // are used to select register, bits 25:24 - select sub-frame
65  parameter SENS_LENS_ADDR = 'h43c,
66  parameter SENS_LENS_ADDR_MASK = 'h7fc,
67 // parameter SENS_LENS_HEIGHTS = 'h0, // .. 'h2 set frame heights (all that is not SENS_LENS_COEFF)
68  parameter SENS_LENS_COEFF = 'h3, // set vignetting/scale coefficients (
69  parameter SENS_LENS_AX = 'h00, // 00000...
70  parameter SENS_LENS_AX_MASK = 'hf8,
71  parameter SENS_LENS_AY = 'h08, // 00001...
72  parameter SENS_LENS_AY_MASK = 'hf8,
73  parameter SENS_LENS_C = 'h10, // 00010...
74  parameter SENS_LENS_C_MASK = 'hf8,
75  parameter SENS_LENS_BX = 'h20, // 001.....
76  parameter SENS_LENS_BX_MASK = 'he0,
77  parameter SENS_LENS_BY = 'h40, // 010.....
78  parameter SENS_LENS_BY_MASK = 'he0,
79  parameter SENS_LENS_SCALES = 'h60, // 01100...
80  parameter SENS_LENS_SCALES_MASK = 'hf8,
81  parameter SENS_LENS_FAT0_IN = 'h68, // 01101000
82  parameter SENS_LENS_FAT0_IN_MASK = 'hff,
83  parameter SENS_LENS_FAT0_OUT = 'h69, // 01101001
84  parameter SENS_LENS_FAT0_OUT_MASK = 'hff,
85  parameter SENS_LENS_POST_SCALE = 'h6a, // 01101010
86  parameter SENS_LENS_POST_SCALE_MASK = 'hff,
87  parameter SENS_NUM_SUBCHN = 3, // number of subchannels on the same sensor port (<=4)
88 
89  parameter SENS_LENS_F_WIDTH = 19, // AF2015 18, // number of bits in the output result
90  parameter SENS_LENS_F_SHIFT = 22, // shift ~2*log2(width/2), for 4K width
91  parameter SENS_LENS_B_SHIFT = 12, //(<=F_SHIFT) shift b- coeff (12 is 2^12 - good for lines <4096, 1 output count per width)
92  parameter SENS_LENS_A_WIDTH = 19, // AF2015 18, // number of bits in a-coefficient (unsigned). Just to match the caller - MSBs will be anyway discarded
93  parameter SENS_LENS_B_WIDTH = 21 // number of bits in b-coefficient (signed).
94 
95 ) (
96  input prst, // @pclk sync reset
97  input pclk, // global clock input, pixel rate (96MHz for MT9P006)
98  // programming interface
99  input mrst, // @mclk sync reset
100  input mclk, // global clock, half DDR3 clock, synchronizes all I/O through the command port
101  input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
102  input cmd_stb, // strobe (with first byte) for the command a/d
103 
104  input [15:0] pxd_in, // @(posedge pclk)
105  input hact_in,
106  input sof_in, // start of frame, single pclk, input
107  input eof_in, // end of frame, single pclk, input
108 
109  output reg [15:0] pxd_out, // pixel data out, 16 bit unsigned
110  output hact_out, //
111  output sof_out, // latency 8 from pxd_in;
112  output eof_out, //
113 
114  input [1:0] bayer,
115  output [1:0] subchannel, // for gamma correction (valid before/at start of line, may be invalid at the end)
116  output last_in_sub // last line in subchannel (valid before/at start of line, may be invalid at the end)
117  );
118 
119 // AF2015 new signals
120  wire [ 1:0] cmd_a;
121  wire [31:0] cmd_data;
122  reg [31:0] cmd_data_r; // holds data to cross clock boundary
123  wire cmd_we;
124 
125  reg [15:0] heights_m1_ram[0:3]; // set @ posedge mclk, used at pclk, but should be OK (change before first hact)
126  reg [15:0] line_cntr; // count image lines to switch to next subchannels
127  reg [1:0] sub_frame_early; // valid before/at newline to provide coefficients to lens_flat393_line
128  reg [1:0] sub_frame;
129  reg [1:0] sub_frame_late; // valid @ hact_d[2]
130  reg [3:0] sub_frame_late_d; // add extra stages if needed
133  reg [13:0] hact_d; // lens_corr_out; /// lens correction out valid (first clock from column0 )
134  wire [15:0] pxd_d; // pxd_in delayed buy 4 clocks
135  reg [ 2:0] newline;
136  reg sosf; // start of subframe
138  reg we_scales;/// write additional individual per-color scales (17 bits each)
141 //F(x,y)=Ax*x^2+Bx*x+Ay*y^2+By*y+C
142 
143  // small rams to store per-subframe parameters, they will be registered at each subframe start
144 
145 
146  reg [18:0] AX_ram[0:3]; /// Ax
147  reg [18:0] AY_ram[0:3]; /// Ax
148  reg [20:0] BX_ram[0:3]; /// Bx
149  reg [20:0] BY_ram[0:3]; /// By
150  reg [18:0] C_ram[0:3]; /// C
151  reg [16:0] scales_ram[0:15]; // per-color coefficients (parallel-combined fro all colors)
152 // reg [16:0] scales_r;
153  reg [15:0] fatzero_in_ram[0:3]; /// zero level to subtract before multiplication
154  reg [15:0] fatzero_out_ram[0:3]; /// zero level to add after multiplication
155  reg [ 3:0] post_scale_ram[0:3]; /// shift product after first multiplier - maybe needed when using decimation
156 
157 
158 
159 
160  wire [18:0] FY; /// F(0,y)
161  wire [23:0] ERR_Y; /// running error for the first column
162  wire [18:0] FXY; /// F(x,y)
163 // reg [18:0] FXY_sat; // Not used, add extra cycle in calculations?
164 /// copied form sensorpix353.v
167  reg [1:0] color;
168  wire [35:0] mult_first_res;
169  reg [17:0] mult_first_scaled; /// scaled multiplication result (to use with decimation to make parabola 'sharper')
170  wire [35:0] mult_second_res;
171 
172  // Use sub_frame_late?
174 
175 
176 // wire sync_bayer=linerun && ~lens_corr_out[0];
177 // wire sync_bayer=hact_d[2] && ~hact_d[3];
178  wire sync_bayer=hact_d[6] && ~hact_d[7];
179 
180 // sub_frame_late_d[3:2] sets 1 cycle ahead of needed, OK to ease timing (there is always >=1 hact gap)
181  wire [17:0] pix_zero = {2'b0,pxd_d[15:0]}-{{2{fatzero_in_ram[sub_frame_late_d[3:2]][15]}},fatzero_in_ram[sub_frame_late_d[3:2]][15:0]};
182 
183  // Writing to register files @mclk (4 per-subframe registers for coefficients, 4x4 - for per-subframe per-color scales)
184  // these registers will be read out at other clock (pclk)
187 
188  assign subchannel = sub_frame ;
189  assign last_in_sub = inc_sub_frame;
190  assign hact_out = hact_d[13];
191 
192  always @(posedge mclk) begin
193  cmd_data_r <= cmd_data;
194 
196 
206  // Write to RAM
207  if (we_AX) AX_ram [func_chn(cmd_data_r)] <= cmd_data_r[18:0];
208  if (we_AY) AY_ram [func_chn(cmd_data_r)] <= cmd_data_r[18:0];
209  if (we_BX) BX_ram [func_chn(cmd_data_r)] <= cmd_data_r[20:0];
210  if (we_BY) BY_ram [func_chn(cmd_data_r)] <= cmd_data_r[20:0];
211  if (we_C) C_ram [func_chn(cmd_data_r)] <= cmd_data_r[18:0];
212  if (we_scales) scales_ram [{func_chn(cmd_data_r), cmd_data_r[18:17]}] <= cmd_data_r[16:0];
216  end
217 
218  always @ (posedge pclk) begin
219  hact_d <= {hact_d[12:0],hact_in};
220 // newline <= {newline[1:0], hact_in && !hact_d[0]};
221  newline <= {newline[1:0], hact_d[3] && !hact_d[4]};
222 // line_start <= newline; // make it SR?
223 
224  if (sof_in) pre_first_line <= 1;
225  else if (newline[0]) pre_first_line <= 0;
226 
227  if (pre_first_line || newline[0]) inc_sub_frame <= (sub_frame != (SENS_NUM_SUBCHN - 1)) && (line_cntr == 0);
228 
230 
231  if (pre_first_line) sub_frame <= 0;
232  else if (newline[0]) sub_frame <= sub_frame_early;
233 
234  // adjust when to switch?
236  else if (newline[1] ) line_cntr <= line_cntr - 1;
237 
238 // if (newline[2]) sub_frame_late <= sub_frame;
239  if (newline[1]) sub_frame_late <= sub_frame;
240  sub_frame_late_d <= {sub_frame_late_d[1:0],sub_frame_late}; // valid @ hact_d[3], use @hact_d[4] as there is always >= 1 clock HACT gap
241 
242  sosf <= (hact_in && ~hact_d[0]) && (pre_first_line || inc_sub_frame);
243 
244  end
245 
246 
247 //reg color[1:0]
248 
249  always @ (posedge pclk) begin
250 // bayer_nset <= !sof_in && (bayer_nset || hact_d[1]);
251  bayer_nset <= !sof_in && (bayer_nset || hact_d[5]);
253  color[1:0] <= { bayer_nset? (sync_bayer ^ color[1]):bayer[1] ,
255 
256 /// now scale the result (normally post_scale[2:0] ==1)
257  case (post_scale_ram[sub_frame][2:0])
258  3'h0:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:33]) ? 18'h1ffff:mult_first_res[33:16]; /// only limit positive overflow
259  3'h1:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:32]) ? 18'h1ffff:mult_first_res[32:15];
260  3'h2:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:31]) ? 18'h1ffff:mult_first_res[31:14];
261  3'h3:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:30]) ? 18'h1ffff:mult_first_res[30:13];
262  3'h4:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:29]) ? 18'h1ffff:mult_first_res[29:12];
263  3'h5:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:28]) ? 18'h1ffff:mult_first_res[28:11];
264  3'h6:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:27]) ? 18'h1ffff:mult_first_res[27:10];
265  3'h7:mult_first_scaled[17:0]<= (~mult_first_res[35] & |mult_first_res[34:26]) ? 18'h1ffff:mult_first_res[26: 9];
266  endcase
267 
268  if (hact_d[12]) pxd_out[15:0] <= pre_pixdo_with_zero[20]? 16'h0: /// negative - use 0
269  ((|pre_pixdo_with_zero[19:16])?16'hffff: ///>0xffff - limit by 0xffff
270  pre_pixdo_with_zero[15:0]);
271  end
272 
273  // Replacing MULT18X18SIO of x353, registers on both inputs, outputs
274  reg signed [17:0] mul1_a;
275  reg signed [17:0] mul1_b;
276  reg signed [35:0] mul1_p;
277  reg signed [17:0] mul2_a;
278  reg signed [17:0] mul2_b;
279 // wire [17:0] mul2_b = mult_first_scaled[17:0]; // TODO - delay to have a register!
280  reg signed [35:0] mul2_p;
281  always @ (posedge pclk) begin
282  if (hact_d[7]) mul1_a <= (FXY[18]==FXY[17])?FXY[17:0]:(FXY[18]?18'h20000:18'h1ffff);
283  if (hact_d[7]) mul1_b <= {1'b0,scales_ram[{sub_frame_late,~color[1:0]}]};
284  if (hact_d[8]) mul1_p <= mul1_a * mul1_b;
285 
286  if (hact_d[10]) mul2_a <= pix_zero[17:0]; // adjust sub_frame delay
287  if (hact_d[10]) mul2_b <= mult_first_scaled[17:0]; // 18-bit multiplier input - always positive
288  if (hact_d[11]) mul2_p <= mul2_a * mul2_b;
289  end
290  assign mult_first_res = mul1_p;
291  assign mult_second_res = mul2_p;
292 
293 
295  .ADDR (SENS_LENS_ADDR),
296  .ADDR_MASK (SENS_LENS_ADDR_MASK),
297  .NUM_CYCLES (6),
298  .ADDR_WIDTH (2),
299  .DATA_WIDTH (32)
300  ) cmd_deser_lens_i (
301  .rst (mrst), // rst), // input
302  .clk (mclk), // input
303  .srst (mrst), // input
304  .ad (cmd_ad), // input[7:0]
305  .stb (cmd_stb), // input
306  .addr (cmd_a), // output[15:0]
307  .data (cmd_data), // output[31:0]
308  .we (cmd_we) // output
309  );
310 
312  .WIDTH(2)
313  ) dly_16_sof_eof_i (
314  .clk (pclk), // input
315  .rst (prst), // input
316  .dly (4'd12), // input[3:0]
317  .din ({sof_in,eof_in}), // input[0:0]
318  .dout ({sof_out,eof_out}) // output[0:0]
319  );
320 
322  .WIDTH(16)
323  ) dly_16_pxd_i (
324  .clk (pclk), // input
325  .rst (prst), // input
326  .dly (4'd10), // input[3:0]
327  .din (pxd_in), // input[0:0]
328  .dout (pxd_d) // output[0:0]
329  );
330 /*
331  dly_16 #(
332  .WIDTH(1)
333  ) dly_16_sof_d_i (
334  .clk (pclk), // input
335  .rst (prst), // input
336  .dly (4'd8), // input[3:0]
337  .din (sof_in), // input[0:0]
338  .dout (sosf) // output[0:0]
339  );
340 */
342  .F_WIDTH (SENS_LENS_F_WIDTH), // number of bits in the output result (signed)
343  .F_SHIFT (SENS_LENS_F_SHIFT), // shift ~2*log2(width/2), for 4K width
344  .B_SHIFT (SENS_LENS_B_SHIFT), //(<=F_SHIFT) shift b- coeff (12 is 2^12 - good for lines <4096, 1 output count per width)
345  .A_WIDTH (SENS_LENS_A_WIDTH), // number of bits in a-coefficient (signed). Just to match the caller - MSBs will be anyway discarded
346  .B_WIDTH (SENS_LENS_B_WIDTH)) // number of bits in b-coefficient (signed).
347  i_fy(
348  .pclk (pclk), // pixel clock
349  // wrong - need to restart for each sub-frame
350  .first (sosf), // initialize running parameters from the inputs (first column). Should be at least 1-cycle gap between "first" and first "next"
351  .next (newline[0]), // calcualte next pixel
352  .F0 (C_ram[sub_frame_early]), // value of the output in the first column (before saturation), 18 bit, unsigned
353  .ERR0 (24'b0), // initial value of the running error (-2.0<err<+2.0), scaled by 2^22, so 24 bits
354  .A0 (AY_ram[sub_frame_early]), // Ay
355  .B0 (BY_ram[sub_frame_early]), // By, signed
356  .F (FY),
357  .ERR (ERR_Y));
358 
360  .F_WIDTH (SENS_LENS_F_WIDTH), // number of bits in the output result (signed)
361  .F_SHIFT (SENS_LENS_F_SHIFT), // shift ~2*log2(width/2), for 4K width
362  .B_SHIFT (SENS_LENS_B_SHIFT), // (<=F_SHIFT) shift b- coeff (12 is 2^12 - good for lines <4096, 1 output count per width)
363  .A_WIDTH (SENS_LENS_A_WIDTH), // number of bits in a-coefficient (signed). Just to match the caller - MSBs will be anyway discarded
364  .B_WIDTH (SENS_LENS_B_WIDTH)) // number of bits in b-coefficient (signed).
365  i_fxy(
366  .pclk (pclk), // pixel clock
367  .first (newline[0]), // initialize running parameters from the inputs (first column). Should be at least 1-cycle gap between "first" and first "next"
368  .next (hact_d[6]), // calcualte next pixel
369  .F0 (FY), // value of the output in the first column (before saturation), 18 bit, unsigned
370  .ERR0 (ERR_Y), // initial value of the running error (-2.0<err<+2.0), scaled by 2^22, so 24 bits
371  .A0 (AX_ram[sub_frame_early]), // Ax(Y), signed
372  .B0 (BX_ram[sub_frame_early]), // Bx(Y), signed
373  .F (FXY), // valid 2 clocks after next (for the second pixel), next cycle after next - for the first pixel
374  .ERR());
375 
376 
377  function func_cmd_we;
378  input [31:0] cmd_data;
379  input [7:0] pattern;
380  input [7:0] mask;
381  begin
382  func_cmd_we = ((cmd_data[23:16] ^ pattern) & mask) == 0;
383  end
384  endfunction
385  function [1:0] func_chn;
386  input [31:0] cmd_data;
387  begin
388  func_chn = cmd_data[25:24];
389  end
390  endfunction
391 
392 endmodule
393 
395  parameter F_WIDTH = 19, // AF2015 18, /// number of bits in the output result
396  parameter F_SHIFT = 22, /// shift ~2*log2(width/2), for 4K width
397  parameter B_SHIFT = 12, ///(<=F_SHIFT) shift b- coeff (12 is 2^12 - good for lines <4096, 1 output count per width)
398  parameter A_WIDTH = 19, // AF2015 18, /// number of bits in a-coefficient (unsigned). Just to match the caller - MSBs will be anyway discarded
399  parameter B_WIDTH = 21 // number of bits in b-coefficient (signed).
400 )(
401  input pclk, /// pixel clock
402  input first, /// initialize running parameters from the inputs (first column). Should be at least 1-cycle gap between "first" and first "next"
403  input next, /// calcualte next pixel
404  input [F_WIDTH-1:0] F0, /// value of the output in the first column (before saturation), 18 bit, unsigned
405  input [F_SHIFT+1:0] ERR0, /// initial value of the running error (-2.0<err<+2.0), scaled by 2^22, so 24 bits
406  input [A_WIDTH-1:0] A0, /// a - fixed for negative values
407  input [B_WIDTH-1:0] B0,
408  output [F_WIDTH-1:0] F,
409  output reg [F_SHIFT+1:0] ERR); /// running difference between ax^2+bx+c and y, scaled by 2^22, signed, should never overflow
410  // output - 18 bits, unsigned (not saturated)
411  localparam DF_WIDTH = B_WIDTH - F_SHIFT + B_SHIFT; //21-22+12 11; /// number of bits in step of F between (df/dx), signed
412 
413  reg [F_SHIFT+1:0] ApB; // a+b, scaled by 2 ^22, high bits ignored (not really needed - can use ApB0
414  reg [F_SHIFT+1:1] A2X; // running value for 2*a*x, scaled by 2^22, high bits ignored
415  reg [(DF_WIDTH)-1:0] dF; // or [9:0] - anyway only lower bits will be used in comparison operations
416  reg [F_WIDTH-1:0] F_r; // Running value of the output
417  reg next_d, first_d; // delayed by 1 cycle
418  reg [F_WIDTH-1:0] F1;
419  reg [A_WIDTH-1:0] A;
420 
421  wire [F_SHIFT+1:0] preERR={A2X[F_SHIFT+1:1],1'b0}+ApB[F_SHIFT+1:0]-{dF[1:0],{F_SHIFT{1'b0}}};
422  assign F = F_r;
423 /// Increment can be 0 or +/-1, depending on the required correction
424 /// It relies on the facts that:
425 /// - the output F(x) is integer
426 /// - dF/dx does not chnage by more than +/-1 when x is incremented (abs (d2f/dx2)<1), so the algorithm to get
427 /// y=round(F(x)) is simple :
428 /// At each step x, try to chnage y by the same amount as was done at the previous step, adding/subtracting 1 if needed
429 /// and updating the new running error (difference between the current (integer) value of y and the precise value of F(x)
430 /// This error is calculated here with the 22 binary digits after the point.
431 ///f=ax^2+bx+c
432 ///
433 ///1) f <= f+ df +1
434 /// df <= df+1;
435 /// err+= (2ax+a+b-df) -1
436 ///2) f <= f+ df
437 /// err+= (2ax+a+b-df)
438 ///3) f <= f+ df -1
439 /// df <= df-1;
440 /// err+= (2ax+a+b-df) +1
441 ///preERR->inc:
442 /// 100 -> 11
443 /// 101 -> 11
444 /// 110 -> 11
445 /// 111 -> 00
446 /// 000 -> 00
447 /// 001 -> 01
448 /// 010 -> 01
449 /// 011 -> 01
450  wire [1:0] inc= {preERR[F_SHIFT+1] & (~preERR[F_SHIFT] | ~preERR[F_SHIFT-1]),
451  (preERR[F_SHIFT+1:F_SHIFT-1] != 3'h0) &
452  (preERR[F_SHIFT+1:F_SHIFT-1] != 3'h7)};
453  always @(posedge pclk) begin
454  first_d <=first;
455  next_d <=next;
456  if (first) begin
457  F1 [F_WIDTH-1:0] <= F0[ F_WIDTH-1:0];
458  dF[(DF_WIDTH)-1:0] <= B0[B_WIDTH-1: (F_SHIFT-B_SHIFT)];
459  ERR[F_SHIFT+1:0] <= ERR0[F_SHIFT+1:0];
460 
461  ApB[F_SHIFT+1:0] <= {{F_SHIFT + 2 - A_WIDTH{A0[A_WIDTH-1]}},A0[A_WIDTH-1:0]} + // width correct
462 //AF2015 {B0[B_WIDTH-1:0],{F_SHIFT-B_SHIFT{1'b0}}}; /// high bits from B will be discarded
463  {B0[B_SHIFT-1:0],{F_SHIFT-B_SHIFT{1'b0}}}; /// high bits from B are discarded
464  A [A_WIDTH-1:0] <= A0[A_WIDTH-1:0];
465  end else if (next) begin
466 //AF2015 dF[(DF_WIDTH)-1:0] <= dF[(DF_WIDTH)-1:0]+{{((DF_WIDTH)-1){inc[1]}},inc[1:0]};
467  dF[(DF_WIDTH)-1:0] <= dF[(DF_WIDTH)-1:0] + {{((DF_WIDTH)-2){inc[1]}},inc[1:0]};
468  ERR[F_SHIFT-1:0]<= preERR[F_SHIFT-1:0];
469  ERR[F_SHIFT+1:F_SHIFT]<= preERR[F_SHIFT+1:F_SHIFT]-inc[1:0];
470  end
471 
472  if (first_d) F_r[F_WIDTH-1:0] <= F1[ F_WIDTH-1:0];
473  else if (next_d) F_r[F_WIDTH-1:0] <= F_r[F_WIDTH-1:0]+{{(F_WIDTH-(DF_WIDTH)){dF[(DF_WIDTH)-1]}},dF[(DF_WIDTH)-1:0]};
474 //AF2015 if (first_d) A2X[F_SHIFT+1:1] <= {{F_SHIFT+2-A_WIDTH{A[A_WIDTH-1]}},A[A_WIDTH-1:0]};
475 //AF2015 else if (next) A2X[F_SHIFT+1:1] <= A2X[F_SHIFT+1:1] + {{F_SHIFT+2-A_WIDTH{A[A_WIDTH-1]}},A[A_WIDTH-1:0]};
476  if (first_d) A2X[F_SHIFT+1:1] <= {{F_SHIFT+1-A_WIDTH{A[A_WIDTH-1]}},A[A_WIDTH-1:0]};
477  else if (next) A2X[F_SHIFT+1:1] <= A2X[F_SHIFT+1:1] + {{F_SHIFT+1-A_WIDTH{A[A_WIDTH-1]}},A[A_WIDTH-1:0]};
478  end
479 endmodule
6674SENS_LENS_BY_MASK'he0
Definition: lens_flat393.v:78
6782F_rreg[F_WIDTH-1:0]
Definition: lens_flat393.v:416
6663SENS_LENS_ADDR_MASK'h7fc
Definition: lens_flat393.v:66
6711line_cntrreg[15:0]
Definition: lens_flat393.v:126
10332clk
Definition: dly_16.v:44
[0:15] 6736scales_ramreg[16:0]
Definition: lens_flat393.v:151
6676SENS_LENS_SCALES_MASK'hf8
Definition: lens_flat393.v:80
6754mul1_areg[17:0]
Definition: lens_flat393.v:274
6678SENS_LENS_FAT0_IN_MASK'hff
Definition: lens_flat393.v:82
6757mul2_areg[17:0]
Definition: lens_flat393.v:277
6715sub_frame_late_dreg[3:0]
Definition: lens_flat393.v:130
[0:3] 6734BY_ramreg[20:0]
Definition: lens_flat393.v:149
[0:3] 6732AY_ramreg[18:0]
Definition: lens_flat393.v:147
6684SENS_LENS_F_WIDTH19
Definition: lens_flat393.v:89
[0:3] 6739post_scale_ramreg[3:0]
Definition: lens_flat393.v:155
6785F1reg[F_WIDTH-1:0]
Definition: lens_flat393.v:418
6667SENS_LENS_AY'h08
Definition: lens_flat393.v:71
[0:3] 6710heights_m1_ramreg[15:0]
Definition: lens_flat393.v:125
6675SENS_LENS_SCALES'h60
Definition: lens_flat393.v:79
dly_16_pxd_i dly_16
Definition: lens_flat393.v:321
6664SENS_LENS_COEFF'h3
Definition: lens_flat393.v:68
[1:0] 6703bayer
Definition: lens_flat393.v:114
reg [F_SHIFT+1:0] 6777ERR
Definition: lens_flat393.v:409
6714sub_frame_latereg[1:0]
Definition: lens_flat393.v:129
6730we_post_scalereg
Definition: lens_flat393.v:140
[1:0] 6704subchannel
Definition: lens_flat393.v:115
6713sub_framereg[1:0]
Definition: lens_flat393.v:128
6706cmd_awire[1:0]
Definition: lens_flat393.v:120
6668SENS_LENS_AY_MASK'hf8
Definition: lens_flat393.v:72
6744bayer0_latchedreg
Definition: lens_flat393.v:166
6786Areg[A_WIDTH-1:0]
Definition: lens_flat393.v:419
6779ApBreg[F_SHIFT+1:0]
Definition: lens_flat393.v:413
[B_WIDTH-1:0] 6775B0
Definition: lens_flat393.v:407
[ADDR_MASK2!=0?2:ADDR_MASK1!=0?1:0:0] 9935we
Definition: cmd_deser.v:60
6662SENS_LENS_ADDR'h43c
Definition: lens_flat393.v:65
6666SENS_LENS_AX_MASK'hf8
Definition: lens_flat393.v:70
6751pix_zerowire[17:0]
Definition: lens_flat393.v:181
6742FXYwire[18:0]
Definition: lens_flat393.v:162
[WIDTH-1:0] 10336dout
Definition: dly_16.v:48
6708cmd_data_rreg[31:0]
Definition: lens_flat393.v:122
6753set_heights_wwire
Definition: lens_flat393.v:186
func_cmd_wecmd_datapatternmask
Definition: lens_flat393.v:377
6746mult_first_reswire[35:0]
Definition: lens_flat393.v:168
6677SENS_LENS_FAT0_IN'h68
Definition: lens_flat393.v:81
6672SENS_LENS_BX_MASK'he0
Definition: lens_flat393.v:76
6750sync_bayerwire
Definition: lens_flat393.v:178
6670SENS_LENS_C_MASK'hf8
Definition: lens_flat393.v:74
[1:0] func_chncmd_data
Definition: lens_flat393.v:385
6747mult_first_scaledreg[17:0]
Definition: lens_flat393.v:169
6728we_fatzero_inreg
Definition: lens_flat393.v:139
[WIDTH-1:0] 10335din
Definition: dly_16.v:47
6729we_fatzero_outreg
Definition: lens_flat393.v:139
6759mul2_preg[35:0]
Definition: lens_flat393.v:280
6665SENS_LENS_AX'h00
Definition: lens_flat393.v:69
[7:0] 6693cmd_ad
Definition: lens_flat393.v:101
6716pre_first_linereg
Definition: lens_flat393.v:131
[DATA_WIDTH-1:0] 9934data
Definition: cmd_deser.v:59
[0:3] 6735C_ramreg[18:0]
Definition: lens_flat393.v:150
[F_WIDTH-1:0] 6772F0
Definition: lens_flat393.v:404
6755mul1_breg[17:0]
Definition: lens_flat393.v:275
6671SENS_LENS_BX'h20
Definition: lens_flat393.v:75
6781dFreg[DF_WIDTH-1:0]
Definition: lens_flat393.v:415
6748mult_second_reswire[35:0]
Definition: lens_flat393.v:170
6682SENS_LENS_POST_SCALE_MASK'hff
Definition: lens_flat393.v:86
[0:3] 6733BX_ramreg[20:0]
Definition: lens_flat393.v:148
6680SENS_LENS_FAT0_OUT_MASK'hff
Definition: lens_flat393.v:84
6741ERR_Ywire[23:0]
Definition: lens_flat393.v:161
[15:0] 6695pxd_in
Definition: lens_flat393.v:104
6719pxd_dwire[15:0]
Definition: lens_flat393.v:134
6745colorreg[1:0]
Definition: lens_flat393.v:167
6687SENS_LENS_A_WIDTH19
Definition: lens_flat393.v:92
6717inc_sub_framereg
Definition: lens_flat393.v:132
[7:0] 9931ad
Definition: cmd_deser.v:56
[F_WIDTH-1:0] 6776F
Definition: lens_flat393.v:408
[ADDR_WIDTH-1:0] 9933addr
Definition: cmd_deser.v:58
6679SENS_LENS_FAT0_OUT'h69
Definition: lens_flat393.v:83
6787preERRwire[F_SHIFT+1:0]
Definition: lens_flat393.v:421
6669SENS_LENS_C'h10
Definition: lens_flat393.v:73
6685SENS_LENS_F_SHIFT22
Definition: lens_flat393.v:90
6718hact_dreg[13:0]
Definition: lens_flat393.v:133
[0:3] 6737fatzero_in_ramreg[15:0]
Definition: lens_flat393.v:153
reg [15:0] 6699pxd_out
Definition: lens_flat393.v:109
6673SENS_LENS_BY'h40
Definition: lens_flat393.v:77
6720newlinereg[2:0]
Definition: lens_flat393.v:135
6686SENS_LENS_B_SHIFT12
Definition: lens_flat393.v:91
[0:3] 6738fatzero_out_ramreg[15:0]
Definition: lens_flat393.v:154
6758mul2_breg[17:0]
Definition: lens_flat393.v:278
6681SENS_LENS_POST_SCALE'h6a
Definition: lens_flat393.v:85
6778DF_WIDTHB_WIDTH - F_SHIFT + B_SHIFT
Definition: lens_flat393.v:411
[0:3] 6731AX_ramreg[18:0]
Definition: lens_flat393.v:146
6740FYwire[18:0]
Definition: lens_flat393.v:160
cmd_deser_lens_i cmd_deser
Definition: lens_flat393.v:294
[F_SHIFT+1:0] 6773ERR0
Definition: lens_flat393.v:405
6756mul1_preg[35:0]
Definition: lens_flat393.v:276
i_fxy lens_flat393_line
Definition: lens_flat393.v:359
6780A2Xreg[F_SHIFT+1:1]
Definition: lens_flat393.v:414
6707cmd_datawire[31:0]
Definition: lens_flat393.v:121
10333rst
Definition: dly_16.v:45
6712sub_frame_earlyreg[1:0]
Definition: lens_flat393.v:127
6688SENS_LENS_B_WIDTH21
Definition: lens_flat393.v:93
[A_WIDTH-1:0] 6774A0
Definition: lens_flat393.v:406
6749pre_pixdo_with_zerowire[20:0]
Definition: lens_flat393.v:173
6752set_lens_wwire
Definition: lens_flat393.v:185
[3:0] 10334dly
Definition: dly_16.v:46