x393  1.0
FPGAcodeforElphelNC393camera
csconvert_jp4.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
41 module csconvert_jp4 (en,
42  clk,
43  din,
45  y_out,
46  yaddr,
47  ywe,
49 
50  input en;
51  input clk; // clock
52  input [7:0] din; // input data in scanline sequence
53  input pre_first_in; // marks the first input pixel
54  output [7:0] y_out; // output Y (16x16) in scanline sequence. Valid if ys active
55  output [7:0] yaddr; // address for the external buffer memory to write 16x16x8bit Y data
56  output ywe; // wrire enable of Y data
57  output pre_first_out;
58 
60  wire [7:0] y_out= {~din[7],din[6:0]};
61  reg [7:0] yaddr_cntr;
62  reg ywe;
63  wire [7:0] yaddr= {yaddr_cntr[4],yaddr_cntr[7:5],yaddr_cntr[0],yaddr_cntr[3:1]};
64  always @ (posedge clk) begin
65  ywe <= en & (pre_first_in || (ywe && (yaddr[7:0] !=8'hff)));
66  if (!en || pre_first_in) yaddr_cntr[7:0] <= 8'h0;
67  else if (ywe) yaddr_cntr[7:0] <= yaddr_cntr[7:0] + 1;
68  end
69 
70 endmodule
71 
72 
2226y_outwire[7:0]
Definition: csconvert_jp4.v:60
2229yaddrwire[7:0]
Definition: csconvert_jp4.v:63
2227yaddr_cntrreg[7:0]
Definition: csconvert_jp4.v:61
2225pre_first_outwire
Definition: csconvert_jp4.v:59
[7:0] 2219din
Definition: csconvert_jp4.v:52