x393  1.0
FPGAcodeforElphelNC393camera
cmd_encod_tiled_32_rw.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
42  parameter ADDRESS_NUMBER= 15,
43  parameter COLADDR_NUMBER= 10,
44  parameter CMD_PAUSE_BITS= 10,
45  parameter CMD_DONE_BIT= 10, // VDT BUG: CMD_DONE_BIT is used in a function call parameter!
46  parameter FRAME_WIDTH_BITS= 13, // Maximal frame width - 8-word (16 bytes) bursts
47  parameter RSEL= 1'b1, // late/early READ commands (to adjust timing by 1 SDCLK period)
48  parameter WSEL= 1'b0 // late/early WRITE commands (to adjust timing by 1 SDCLK period)
49 
50 ) (
51  input mrst,
52  input clk,
53 // programming interface
54  input [2:0] start_bank, // bank address
55  input [ADDRESS_NUMBER-1:0] start_row, // memory row
56  input [COLADDR_NUMBER-4:0] start_col, // start memory column in 8-bit bursts
57  input [FRAME_WIDTH_BITS:0] rowcol_inc_in, // increment {row.col} when bank rolls over, removed 3 LSBs (in 8-bursts)
58  input [5:0] num_rows_in_m1, // number of rows to read minus 1
59  input [5:0] num_cols_in_m1, // number of 16-pixel columns to read (rows first, then columns) - 1
60  input keep_open_in, // keep banks open (for <=8 banks only
61  input skip_next_page_in, // do not reset external buffer (continue)
62  input start_rd, // start generating commands by cmd_encod_linear_rd
63  input start_wr, // start generating commands by cmd_encod_linear_wr
64  output reg start, // this channel was started (1 clk from start_rd || start_wr
65  output reg [31:0] enc_cmd, // encoded command
66  output reg enc_wr, // write encoded command
67  output reg enc_done // encoding finished
68 );
69  wire [31:0] enc_cmd_rd; // encoded command
70  wire enc_wr_rd; // write encoded command
71  wire enc_done_rd; // encoding finished
72  wire [31:0] enc_cmd_wr; // encoded command
73  wire enc_wr_wr; // write encoded command
74  wire enc_done_wr; // encoding finished
75  reg select_wr;
76 
82  .RSEL (RSEL)
83  ) cmd_encod_tiled_rd_i (
84  .mrst (mrst), // input
85  .clk (clk), // input
86  .start_bank (start_bank), // input[2:0]
87  .start_row (start_row), // input[14:0]
88  .start_col (start_col), // input[6:0]
89  .rowcol_inc_in (rowcol_inc_in), // input[13:0] // [21:0]
90  .num_rows_in_m1 (num_rows_in_m1), // input[5:0]
91  .num_cols_in_m1 (num_cols_in_m1), // input[5:0]
92  .keep_open_in (keep_open_in), // input
94 
95  .start (start_rd), // input
96  .enc_cmd (enc_cmd_rd), // output[31:0] reg
97  .enc_wr (enc_wr_rd), // output reg
98  .enc_done (enc_done_rd) // output reg
99  );
100 
106  .WSEL (WSEL)
107  ) cmd_encod_tiled_wr_i (
108  .mrst (mrst), // input
109  .clk (clk), // input
110  .start_bank (start_bank), // input[2:0]
111  .start_row (start_row), // input[14:0]
112  .start_col (start_col), // input[6:0]
113  .rowcol_inc_in (rowcol_inc_in), // input[13:0] // [21:0]
114  .num_rows_in_m1 (num_rows_in_m1), // input[5:0]
115  .num_cols_in_m1 (num_cols_in_m1), // input[5:0]
116  .keep_open_in (keep_open_in), // input
118 
119  .start (start_wr), // input
120  .enc_cmd (enc_cmd_wr), // output[31:0] reg
121  .enc_wr (enc_wr_wr), // output reg
122  .enc_done (enc_done_wr) // output reg
123  );
124 
125  always @(posedge clk) begin
126  if (mrst) start <= 0;
127  else start <= start_rd || start_wr;
128 
129  if (mrst) select_wr <= 0;
130  else if (start_rd) select_wr <= 0;
131  else if (start_wr) select_wr <= 1;
132  end
133  always @(posedge clk) begin
137  end
138 
139 endmodule
140 
141 
[FRAME_WIDTH_BITS:0] 4167rowcol_inc_in
[ADDRESS_NUMBER-1:0] 4194start_row
[COLADDR_NUMBER-4:0] 4166start_col
[COLADDR_NUMBER-4:0] 4195start_col
cmd_encod_tiled_rd_i cmd_encod_tiled_32_rd
[ADDRESS_NUMBER-1:0] 4093start_row
[FRAME_WIDTH_BITS:0] 4196rowcol_inc_in
cmd_encod_tiled_wr_i cmd_encod_tiled_32_wr
[ADDRESS_NUMBER-1:0] 4165start_row
[COLADDR_NUMBER-4:0] 4094start_col
[FRAME_WIDTH_BITS:0] 4095rowcol_inc_in