x393  1.0
FPGAcodeforElphelNC393camera
csconvert_mono.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
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:0];
61  wire [7:0] y_out= {~din[7],din[6:0]};
62  reg [7:0] yaddr;
63  reg ywe;
64 
65  always @ (posedge clk) begin
66  ywe <= en & (pre_first_in || (ywe && (yaddr[7:0] !=8'hff)));
67  if (!en || pre_first_in) yaddr[7:0] <= 8'h0;
68  else if (ywe) yaddr[7:0] <= yaddr[7:0] + 1;
69  end
70 
71 endmodule
72 
2286y_outwire[7:0]
2287yaddrreg[7:0]