x393  1.0
FPGAcodeforElphelNC393camera
compressor393.v
Go to the documentation of this file.
1 
39 `timescale 1ns/1ps
40 
41 module compressor393 # (
42  parameter CMPRS_NUM_AFI_CHN = 2, // 1 - multiplex all 4 compressors to a single AXI_HP, 2 - split between to AXI_HP
43  parameter CMPRS_GROUP_ADDR = 'h600, // total of 'h60
44  parameter CMPRS_BASE_INC = 'h10,
45  parameter CMPRS_AFIMUX_RADDR0= 'h40, // relative to CMPRS_NUM_AFI_CHN ( 16 addr)
46  parameter CMPRS_AFIMUX_RADDR1= 'h50, // relative to CMPRS_NUM_AFI_CHN ( 16 addr)
47  parameter CMPRS_AFIMUX_MASK= 'h7f0,
48  // Ststus needs 'h10 (16) registers, currently 'h10..'h1f
49  parameter CMPRS_STATUS_REG_BASE= 'h10,
50  parameter CMPRS_HIFREQ_REG_BASE= 'h14,
51  parameter CMPRS_AFIMUX_REG_ADDR0= 'h18, // Uses 4 locations
52  parameter CMPRS_AFIMUX_REG_ADDR1= 'h1c, // Uses 4 locations
53 
54  parameter CMPRS_STATUS_REG_INC= 1,
55  parameter CMPRS_HIFREQ_REG_INC= 1,
56  parameter CMPRS_MASK= 'h7f8,
57  parameter CMPRS_CONTROL_REG= 0,
58  parameter CMPRS_STATUS_CNTRL= 1,
59  parameter CMPRS_FORMAT= 2,
60  parameter CMPRS_COLOR_SATURATION= 3,
61  parameter CMPRS_CORING_MODE= 4,
62  parameter CMPRS_INTERRUPTS= 5,
63  parameter CMPRS_TABLES= 6, // 6..7
64  parameter TABLE_QUANTIZATION_INDEX = 0,
65  parameter TABLE_CORING_INDEX = 1,
66  parameter TABLE_FOCUS_INDEX = 2,
67  parameter TABLE_HUFFMAN_INDEX = 3,
68  parameter FRAME_HEIGHT_BITS= 16, // Maximal frame height
69  parameter LAST_FRAME_BITS= 16, // number of bits in frame counter (before rolls over)
70  // Bit-fields in compressor control word
71  parameter CMPRS_CBIT_RUN = 2, // bit # to control compressor run modes
72  parameter CMPRS_CBIT_RUN_BITS = 2, // number of bits to control compressor run modes
73  parameter CMPRS_CBIT_QBANK = 6, // bit # to control quantization table page
74  parameter CMPRS_CBIT_QBANK_BITS = 3, // number of bits to control quantization table page
75  parameter CMPRS_CBIT_DCSUB = 8, // bit # to control extracting DC components bypassing DCT
76  parameter CMPRS_CBIT_DCSUB_BITS = 1, // bit # to control extracting DC components bypassing DCT
77  parameter CMPRS_CBIT_CMODE = 13, // bit # to control compressor color modes
78  parameter CMPRS_CBIT_CMODE_BITS = 4, // number of bits to control compressor color modes
79  parameter CMPRS_CBIT_FRAMES = 15, // bit # to control compressor multi/single frame buffer modes
80  parameter CMPRS_CBIT_FRAMES_BITS = 1, // number of bits to control compressor multi/single frame buffer modes
81  parameter CMPRS_CBIT_BAYER = 20, // bit # to control compressor Bayer shift mode
82  parameter CMPRS_CBIT_BAYER_BITS = 2, // number of bits to control compressor Bayer shift mode
83  parameter CMPRS_CBIT_FOCUS = 23, // bit # to control compressor focus display mode
84  parameter CMPRS_CBIT_FOCUS_BITS = 2, // number of bits to control compressor focus display mode
85  // compressor bit-fields decode
86  parameter CMPRS_CBIT_RUN_RST = 2'h0, // reset compressor, stop immediately
87 // parameter CMPRS_CBIT_RUN_DISABLE = 2'h1, // disable compression of the new frames, finish any already started
88  parameter CMPRS_CBIT_RUN_STANDALONE = 2'h2, // enable compressor, compress single frame from memory (async)
89  parameter CMPRS_CBIT_RUN_ENABLE = 2'h3, // enable compressor, enable synchronous compression mode
90  parameter CMPRS_CBIT_CMODE_JPEG18 = 4'h0, // color 4:2:0
91  parameter CMPRS_CBIT_CMODE_MONO6 = 4'h1, // mono 4:2:0 (6 blocks)
92  parameter CMPRS_CBIT_CMODE_JP46 = 4'h2, // jp4, 6 blocks, original
93  parameter CMPRS_CBIT_CMODE_JP46DC = 4'h3, // jp4, 6 blocks, dc -improved
94  parameter CMPRS_CBIT_CMODE_JPEG20 = 4'h4, // mono, 4 blocks (but still not actual monochrome JPEG as the blocks are scanned in 2x2 macroblocks)
95  parameter CMPRS_CBIT_CMODE_JP4 = 4'h5, // jp4, 4 blocks, dc-improved
96  parameter CMPRS_CBIT_CMODE_JP4DC = 4'h6, // jp4, 4 blocks, dc-improved
97  parameter CMPRS_CBIT_CMODE_JP4DIFF = 4'h7, // jp4, 4 blocks, differential
98  parameter CMPRS_CBIT_CMODE_JP4DIFFHDR = 4'h8, // jp4, 4 blocks, differential, hdr
99  parameter CMPRS_CBIT_CMODE_JP4DIFFDIV2 = 4'h9, // jp4, 4 blocks, differential, divide by 2
100  parameter CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 4'ha, // jp4, 4 blocks, differential, hdr,divide by 2
101  parameter CMPRS_CBIT_CMODE_MONO1 = 4'hb, // mono JPEG (not yet implemented)
102  parameter CMPRS_CBIT_CMODE_MONO4 = 4'he, // mono 4 blocks
103  parameter CMPRS_CBIT_FRAMES_SINGLE = 0, //1, // use a single-frame buffer for images
104 
105  parameter CMPRS_COLOR18 = 0, // JPEG 4:2:0 with 18x18 overlapping tiles for de-bayer
106  parameter CMPRS_COLOR20 = 1, // JPEG 4:2:0 with 18x18 overlapping tiles for de-bayer (not implemented)
107  parameter CMPRS_MONO16 = 2, // JPEG 4:2:0 with 16x16 non-overlapping tiles, color components zeroed
108  parameter CMPRS_JP4 = 3, // JP4 mode with 16x16 macroblocks
109  parameter CMPRS_JP4DIFF = 4, // JP4DIFF mode TODO: see if correct
110  parameter CMPRS_MONO8 = 7, // Regular JPEG monochrome with 8x8 macroblocks (not yet implemented)
111 
112  parameter CMPRS_FRMT_MBCM1 = 0, // bit # of number of macroblock columns minus 1 field in format word
113  parameter CMPRS_FRMT_MBCM1_BITS = 13, // number of bits in number of macroblock columns minus 1 field in format word
114  parameter CMPRS_FRMT_MBRM1 = 13, // bit # of number of macroblock rows minus 1 field in format word
115  parameter CMPRS_FRMT_MBRM1_BITS = 13, // number of bits in number of macroblock rows minus 1 field in format word
116  parameter CMPRS_FRMT_LMARG = 26, // bit # of left margin field in format word
117  parameter CMPRS_FRMT_LMARG_BITS = 5, // number of bits in left margin field in format word
118  parameter CMPRS_CSAT_CB = 0, // bit # of number of blue scale field in color saturation word
119  parameter CMPRS_CSAT_CB_BITS = 10, // number of bits in blue scale field in color saturation word
120  parameter CMPRS_CSAT_CR = 12, // bit # of number of red scale field in color saturation word
121  parameter CMPRS_CSAT_CR_BITS = 10, // number of bits in red scale field in color saturation word
122  parameter CMPRS_CORING_BITS = 3, // number of bits in coring mode
123 
124  parameter CMPRS_TIMEOUT_BITS= 12,
125  parameter CMPRS_TIMEOUT= 1000, // mclk cycles
126 
127  parameter CMPRS_AFIMUX_EN= 'h0, // enables (gl;obal and per-channel)
128  parameter CMPRS_AFIMUX_RST= 'h1, // per-channel resets
129  parameter CMPRS_AFIMUX_MODE= 'h2, // per-channel select - which register to return as status
130  parameter CMPRS_AFIMUX_STATUS_CNTRL= 'h4, // .. 'h7
131  parameter CMPRS_AFIMUX_SA_LEN= 'h8, // .. 'hf
132 
133  parameter CMPRS_AFIMUX_WIDTH = 26, // maximal for status: currently only works with 26)
134  parameter CMPRS_AFIMUX_CYCBITS = 3,
135  parameter AFI_MUX_BUF_LATENCY = 4'd2, // buffers read latency from fifo_ren* to fifo_rdata* valid : 2 if no register layers are used
136  parameter NUM_FRAME_BITS = 4 // number of bits use for frame number
137 
138 `ifdef DEBUG_RING
139  ,parameter DEBUG_CMD_LATENCY = 2
140 `endif
141 
142 )(
143  input xclk, // global clock input, compressor single clock rate
144 `ifdef USE_XCLK2X
145  input xclk2x, // global clock input, compressor double clock rate, nominally rising edge aligned
146 `endif
147  input mrst, // @posedge mclk, sync reset
148  input xrst, // @posedge xclk, sync reset
149  input hrst, // @posedge hclk, sync reset
150 
151  // programming interface
152  input mclk, // global system/memory clock
153  input [7:0] cmd_ad, // byte-serial command address/data (up to 6 bytes: AL-AH-D0-D1-D2-D3
154  input cmd_stb, // strobe (with first byte) for the command a/d
155  output [7:0] status_ad, // status address/data - up to 5 bytes: A - {seq,status[1:0]} - status[2:9] - status[10:17] - status[18:25]
156  output status_rq, // input request to send status downstream
157  input status_start, // Acknowledge of the first status packet byte (address)
158  output [3:0] cmprs_irq, // Compressor done interruupt
159 
160  // Buffer interfaces, combined for 4 channels
161  input [3:0] xfer_reset_page_rd, // from mcntrl_tiled_rw (
162  input [3:0] buf_wpage_nxt, // advance to next page memory interface writes to
163  input [3:0] buf_we, // @!mclk write buffer from memory, increment write
164  input [255:0] buf_din, // data out
165  input [3:0] page_ready, // single mclk (posedge)
166  output [3:0] next_page, // single mclk (posedge): Done with the page in the buffer, memory controller may read more data
167 
168  // master (sensor) with slave (compressor) synchronization I/Os
169  output [3:0] frame_start_dst, // @mclk - trigger receive (tiledc) memory channel (it will take care of single/repetitive
170  // these output either follows vsync_late (reclocks it) or generated in non-bonded mode
171  // (compress from memory)
172  input [4*FRAME_HEIGHT_BITS-1:0] line_unfinished_src,// number of the current (unfinished ) line, in the source (sensor) channel (RELATIVE TO FRAME, NOT WINDOW?)
173  input [4*LAST_FRAME_BITS-1:0] frame_number_src, // current frame number (for multi-frame ranges) in the source (sensor) channel
174  input [3:0] frame_done_src, // single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
175  // frame_done_src is later than line_unfinished_src/ frame_number_src changes
176  // Used withe a single-frame buffers
177  input [4*FRAME_HEIGHT_BITS-1:0] line_unfinished_dst,// number of the current (unfinished ) line in this (compressor) channel
178  input [4*LAST_FRAME_BITS-1:0] frame_number_dst, // current frame number (for multi-frame ranges) in this (compressor channel
179  input [3:0]frame_done_dst, // single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
180  // use as 'eot_real' in 353
181  output [3:0]suspend, // suspend reading data for this channel - waiting for the source data
183  output [4*LAST_FRAME_BITS-1:0] frame_number_finished, // frame numbers compressed
184 
185 // statistics data was not used in late nc353
186 // input dccout, //enable output of DC and HF components for brightness/color/focus adjustments
187 // input [2:0] hfc_sel, // [2:0] (for autofocus) only components with both spacial frequencies higher than specified will be added
188 // output statistics_dv,
189 // output [15:0] statistics_do,
190 
191 // Timestamp messages (@mclk) - combine to a single ts_data?
192  input [3:0] ts_pre_stb, // @mclk - 1 cycle before receiving 8 bytes of timestamp data
193  input [31:0] ts_data, // timestamp data (s0,s1,s2,s3,us0,us1,us2,us3==0)
194 
195 // Outputs for interrupts generation
196  output [3:0] eof_written_mclk,
197  output [3:0] stuffer_done_mclk,
198  // frame input synchronization
199  input [3:0] vsync_late, // delayed start of frame, @mclk. In 353 it was 16 lines after VACT active
200  // source channel should already start, some delay give time for sequencer commands
201  // that should arrive before it
202 // Frame numbers to determine number of compressed frame (for interrupts)
203  input [4 * NUM_FRAME_BITS-1:0] frame_num_compressed,
204 
205  // AXI_HP inteface (single/dual). afi indices - relative (0,1) may actually be connected to 1,2 (or only to 1)
206  input hclk,
207 
208  // write address
209  output [31:0] afi0_awaddr,
210  output afi0_awvalid,
211  input afi0_awready, // @SuppressThisWarning VEditor unused - used FIF0 level
212  output [ 5:0] afi0_awid,
213  output [ 1:0] afi0_awlock,
214  output [ 3:0] afi0_awcache,
215  output [ 2:0] afi0_awprot,
216  output [ 3:0] afi0_awlen,
217  output [ 1:0] afi0_awsize,
218  output [ 1:0] afi0_awburst,
219  output [ 3:0] afi0_awqos,
220  // write data
221  output [63:0] afi0_wdata,
222  output afi0_wvalid,
223  input afi0_wready, // @SuppressThisWarning VEditor unused - used FIF0 level
224  output [ 5:0] afi0_wid,
225  output afi0_wlast,
226  output [ 7:0] afi0_wstrb,
227  // write response
228  input afi0_bvalid,
229  output afi0_bready,
230  input [ 5:0] afi0_bid,
231  input [ 1:0] afi0_bresp, // @SuppressThisWarning VEditor unused
232  // PL extra (non-AXI) signals
233  input [ 7:0] afi0_wcount,
234  input [ 5:0] afi0_wacount,
235  output afi0_wrissuecap1en,
236 
237  // write address, second channel
238  output afi1_clk, // same as hclk if the second channel is used
239  output [31:0] afi1_awaddr,
240  output afi1_awvalid,
241  input afi1_awready, // @SuppressThisWarning VEditor unused - used FIF0 level
242  output [ 5:0] afi1_awid,
243  output [ 1:0] afi1_awlock,
244  output [ 3:0] afi1_awcache,
245  output [ 2:0] afi1_awprot,
246  output [ 3:0] afi1_awlen,
247  output [ 1:0] afi1_awsize,
248  output [ 1:0] afi1_awburst,
249  output [ 3:0] afi1_awqos,
250  // write data
251  output [63:0] afi1_wdata,
252  output afi1_wvalid,
253  input afi1_wready, // @SuppressThisWarning VEditor unused - used FIF0 level
254  output [ 5:0] afi1_wid,
255  output afi1_wlast,
256  output [ 7:0] afi1_wstrb,
257  // write response
258  input afi1_bvalid,
259  output afi1_bready,
260  input [ 5:0] afi1_bid,
261  input [ 1:0] afi1_bresp, // @SuppressThisWarning VEditor unused
262  // PL extra (non-AXI) signals
263  input [ 7:0] afi1_wcount,
264  input [ 5:0] afi1_wacount,
265  output afi1_wrissuecap1en
266 `ifdef DEBUG_RING
267  ,output debug_do, // output to the debug ring
268  input debug_sl, // 0 - idle, (1,0) - shift, (1,1) - load
269  input debug_di // input from the debug ring
270 `endif
271 
272 );
273 
274 `ifdef DEBUG_RING
275  localparam DEBUG_RING_LENGTH = 5 + ((CMPRS_NUM_AFI_CHN > 1)?1:0);
276  wire [DEBUG_RING_LENGTH:0] debug_ring; // TODO: adjust number of bits
277  assign debug_do = debug_ring[0];
279 `endif
281  wire [47:0] status_ad_mux;
282  wire [5:0] status_rq_mux;
283  wire [5:0] status_start_mux;
284 
285  // signals to connect to AFI multiplexers
286  wire [3:0] fifo_rst;
287  wire [3:0] fifo_ren;
288  wire [255:0] fifo_rdata;
289  wire [3:0] fifo_eof; //SuppressThisWarning VEditor : Not used?
290  wire [3:0] eof_written;
291  wire [3:0] fifo_flush; // after last frame data was written
292  wire [3:0] flush_hclk; // before last data was written
293  wire [31:0] fifo_count;
295  status_router8 status_router8_i (
296  .rst (1'b0), //rst), // input
297  .clk (mclk), // input
298  .srst (mrst), // input
299  .db_in0 (status_ad_mux[ 0 +: 8]), // input[7:0]
300  .rq_in0 (status_rq_mux[0]), // input
301  .start_in0 (status_start_mux[0]), // output
302 
303  .db_in1 (status_ad_mux[ 8 +: 8]), // input[7:0]
304  .rq_in1 (status_rq_mux[1]), // input
305  .start_in1 (status_start_mux[1]), // output
306 
307  .db_in2 (status_ad_mux[ 16 +: 8]), // input[7:0]
308  .rq_in2 (status_rq_mux[2]), // input
309  .start_in2 (status_start_mux[2]), // output
310 
311  .db_in3 (status_ad_mux[ 24 +: 8]), // input[7:0]
312  .rq_in3 (status_rq_mux[3]), // input
313  .start_in3 (status_start_mux[3]), // output
314 
315  .db_in4 (status_ad_mux[ 32 +: 8]), // input[7:0]
316  .rq_in4 (status_rq_mux[4]), // input
317  .start_in4 (status_start_mux[4]), // output
318 
319  .db_in5 (status_ad_mux[ 40 +: 8]), // input[7:0]
320  .rq_in5 (status_rq_mux[5]), // input
321  .start_in5 (status_start_mux[5]), // output
322 
323  .db_in6 (8'b0), // input[7:0]
324  .rq_in6 (1'b0), // input
325  .start_in6 (), // output
326 
327  .db_in7 (8'b0), // input[7:0]
328  .rq_in7 (1'b0), // input
329  .start_in7 (), // output
330 
331  .db_out (status_ad), // output[7:0]
332  .rq_out (status_rq), // output
333  .start_out (status_start) // input
334  );
336  generate
337  genvar i;
338  for (i=0; i < 4; i=i+1) begin: cmprs_channel_block
339  jp_channel #(
340  .CMPRS_NUMBER (i),
395  .CMPRS_JP4 (CMPRS_JP4),
411  .NUM_FRAME_BITS (NUM_FRAME_BITS)
412 `ifdef DEBUG_RING
413  ,.DEBUG_CMD_LATENCY (DEBUG_CMD_LATENCY)
414 `endif
415  ) jp_channel_i (
416 // .rst (rst), // input
417  .xclk (xclk), // input
418 `ifdef USE_XCLK2X
419  .xclk2x (xclk2x), // input
420 `endif
421  .mrst (mrst), // input
422  .xrst (xrst), // input
423  .hrst (hrst), // input
424  .mclk (mclk), // input
425  .cmd_ad (cmd_ad), // input[7:0]
426  .cmd_stb (cmd_stb), // input
427  .status_ad (status_ad_mux[8 * i +: 8]), // output[7:0]
428  .status_rq (status_rq_mux[i]), // output
429  .status_start (status_start_mux[i]), // input
430  .irq (cmprs_irq[i]), // output
431  .xfer_reset_page_rd (xfer_reset_page_rd[i]), // input
432  .buf_wpage_nxt (buf_wpage_nxt[i]), // input
433  .buf_we (buf_we[i]), // input
434  .buf_din (buf_din[64 * i +: 64]), // input[63:0]
435  .page_ready_chn (page_ready[i]), // input
436  .next_page_chn (next_page[i]), // output
437 
438  .frame_start_dst (frame_start_dst[i]), // output
441  .frame_done_src (frame_done_src[i]), // input
444  .frame_done_dst (frame_done_dst[i]), // input
445  .suspend (suspend[i]), // output
447  .dccout (1'b0), // input
448  .hfc_sel (3'b0), // input[2:0]
449  .statistics_dv (), // output
450  .statistics_do (), // output[15:0]
451  .ts_pre_stb (ts_pre_stb[i]), // input
452  .ts_data (ts_data[8*i +: 8]), // input[7:0]
453  .eof_written_mclk (eof_written_mclk[i]), // output
454  .stuffer_done_mclk (stuffer_done_mclk[i]), // output
455  .vsync_late (vsync_late[i]), // input
456  .frame_num_compressed (frame_num_compressed[i * NUM_FRAME_BITS +: NUM_FRAME_BITS]), // input[3:0]
457 
458  .hclk (hclk), // input
459  .fifo_rst (fifo_rst[i]), // input
460  .fifo_ren (fifo_ren[i]), // input
461  .fifo_rdata (fifo_rdata[64 * i +: 64]), // output[63:0]
462 
463  .fifo_eof (fifo_eof[i]), // output
464  .eof_written (eof_written[i]), // input
465  .fifo_flush (fifo_flush[i]), // output
466  .flush_hclk (flush_hclk[i]), // output
467  .fifo_count (fifo_count[8* i +: 8]) // output[7:0]
468  `ifdef DEBUG_RING
469  ,.debug_do (debug_ring[i]), // output
470  .debug_sl (debug_sl), // output
471  .debug_di (debug_ring[i+1]) // input
472 `endif
473 
474  );
475  end
476  endgenerate
477 
478  generate
479  if (CMPRS_NUM_AFI_CHN > 1) begin
480  cmprs_afi_mux #(
481  .CMPRS_AFIMUX_ADDR (CMPRS_GROUP_ADDR + CMPRS_AFIMUX_RADDR0),
488  .CMPRS_AFIMUX_STATUS_REG_ADDR (CMPRS_AFIMUX_REG_ADDR0), //***********
492 `ifdef DEBUG_RING
493  ,.DEBUG_CMD_LATENCY (DEBUG_CMD_LATENCY)
494 `endif
495 
496  ) cmprs_afi0_mux_i (
497 // .rst (rst), // input
498  .mclk (mclk), // input
499  .hclk (hclk), // input
500  .mrst (mrst), // input
501  .hrst (hrst), // input
502  .cmd_ad (cmd_ad), // input[7:0]
503  .cmd_stb (cmd_stb), // input
504  .status_ad (status_ad_mux[32 +: 8]), // output[7:0]
505  .status_rq (status_rq_mux[4]), // output
506  .status_start (status_start_mux[4]), // input
507  .fifo_rst0 (fifo_rst[0]), // output
508  .fifo_ren0 (fifo_ren[0]), // output
509  .fifo_rdata0 (fifo_rdata[0 +: 64]), // input[63:0]
510 
511  .eof_written0 (eof_written[0]), // output //?
512  .pre_flush0 (flush_hclk[0]), // input
513  .fifo_flush0 (fifo_flush[0]), // input
514  .fifo_count0 (fifo_count[0 +: 8]), // input[7:0]
515 
516  .fifo_rst1 (fifo_rst[1]), // output
517  .fifo_ren1 (fifo_ren[1]), // output
518  .fifo_rdata1 (fifo_rdata[64 +: 64]), // input[63:0]
519  .eof_written1 (eof_written[1]), // output
520  .pre_flush1 (flush_hclk[1]), // input
521  .fifo_flush1 (fifo_flush[1]), // input
522  .fifo_count1 (fifo_count[8 +: 8]), // input[7:0]
523  .fifo_rst2 (), // output
524  .fifo_ren2 (), // output
525  .fifo_rdata2 (64'b0), // input[63:0]
526  .eof_written2 (), // output
527  .pre_flush2 (1'b0), // input
528  .fifo_flush2 (1'b0), // input
529  .fifo_count2 (8'b0), // input[7:0]
530  .fifo_rst3 (), // output
531  .fifo_ren3 (), // output
532  .fifo_rdata3 (64'b0), // input[63:0]
533  .eof_written3 (), // output
534  .pre_flush3 (1'b0), // input
535  .fifo_flush3 (1'b0), // input
536  .fifo_count3 (8'b0), // input[7:0]
537  .afi_awaddr (afi0_awaddr), // output[31:0]
538  .afi_awvalid (afi0_awvalid), // output
539  .afi_awready (afi0_awready), // input
540  .afi_awid (afi0_awid), // output[5:0]
541  .afi_awlock (afi0_awlock), // output[1:0]
542  .afi_awcache (afi0_awcache), // output[3:0]
543  .afi_awprot (afi0_awprot), // output[2:0]
544  .afi_awlen (afi0_awlen), // output[3:0]
545  .afi_awsize (afi0_awsize), // output[2:0]
546  .afi_awburst (afi0_awburst), // output[1:0]
547  .afi_awqos (afi0_awqos), // output[3:0]
548  .afi_wdata (afi0_wdata), // output[63:0]
549  .afi_wvalid (afi0_wvalid), // output
550  .afi_wready (afi0_wready), // input
551  .afi_wid (afi0_wid), // output[5:0]
552  .afi_wlast (afi0_wlast), // output
553  .afi_wstrb (afi0_wstrb), // output[7:0]
554  .afi_bvalid (afi0_bvalid), // input
555  .afi_bready (afi0_bready), // output
556  .afi_bid (afi0_bid), // input[5:0]
557  .afi_bresp (afi0_bresp), // input[1:0]
558  .afi_wcount (afi0_wcount), // input[7:0]
559  .afi_wacount (afi0_wacount), // input[5:0]
561 `ifdef DEBUG_RING
562  ,.debug_do (debug_ring[4]), // output
563  .debug_sl (debug_sl), // input
564  .debug_di (debug_ring[5]) // input
565 `endif
566 
567  );
568 
569  cmprs_afi_mux #(
570  .CMPRS_AFIMUX_ADDR (CMPRS_GROUP_ADDR + CMPRS_AFIMUX_RADDR1),
577  .CMPRS_AFIMUX_STATUS_REG_ADDR (CMPRS_AFIMUX_REG_ADDR1),
581 `ifdef DEBUG_RING
582  ,.DEBUG_CMD_LATENCY (DEBUG_CMD_LATENCY)
583 `endif
584  ) cmprs_afi1_mux_i (
585 // .rst (rst), // input
586  .mclk (mclk), // input
587  .hclk (hclk), // input
588  .mrst (mrst), // input
589  .hrst (hrst), // input
590  .cmd_ad (cmd_ad), // input[7:0]
591  .cmd_stb (cmd_stb), // input
592  .status_ad (status_ad_mux[40 +: 8]), // output[7:0]
593  .status_rq (status_rq_mux[5]), // output
594  .status_start (status_start_mux[5]), // input
595  .fifo_rst0 (fifo_rst[2]), // output
596  .fifo_ren0 (fifo_ren[2]), // output
597  .fifo_rdata0 (fifo_rdata[128 +: 64]), // input[63:0]
598  .eof_written0 (eof_written[2]), // output
599  .pre_flush0 (flush_hclk[2]), // input
600  .fifo_flush0 (fifo_flush[2]), // input
601  .fifo_count0 (fifo_count[16 +: 8]), // input[7:0]
602  .fifo_rst1 (fifo_rst[3]), // output
603  .fifo_ren1 (fifo_ren[3]), // output
604  .fifo_rdata1 (fifo_rdata[192 +: 64]), // input[63:0]
605  .eof_written1 (eof_written[3]), // output
606  .pre_flush1 (flush_hclk[3]), // input
607  .fifo_flush1 (fifo_flush[3]), // input
608  .fifo_count1 (fifo_count[24 +: 8]), // input[7:0]
609  .fifo_rst2 (), // output
610  .fifo_ren2 (), // output
611  .fifo_rdata2 (64'b0), // input[63:0]
612  .eof_written2 (), // output
613  .pre_flush2 (1'b0), // input
614  .fifo_flush2 (1'b0), // input
615  .fifo_count2 (8'b0), // input[7:0]
616  .fifo_rst3 (), // output
617  .fifo_ren3 (), // output
618  .fifo_rdata3 (64'b0), // input[63:0]
619  .eof_written3 (), // output
620  .pre_flush3 (1'b0), // input
621  .fifo_flush3 (1'b0), // input
622  .fifo_count3 (8'b0), // input[7:0]
623  .afi_awaddr (afi1_awaddr), // output[31:0]
624  .afi_awvalid (afi1_awvalid), // output
625  .afi_awready (afi1_awready), // input
626  .afi_awid (afi1_awid), // output[5:0]
627  .afi_awlock (afi1_awlock), // output[1:0]
628  .afi_awcache (afi1_awcache), // output[3:0]
629  .afi_awprot (afi1_awprot), // output[2:0]
630  .afi_awlen (afi1_awlen), // output[3:0]
631  .afi_awsize (afi1_awsize), // output[2:0]
632  .afi_awburst (afi1_awburst), // output[1:0]
633  .afi_awqos (afi1_awqos), // output[3:0]
634  .afi_wdata (afi1_wdata), // output[63:0]
635  .afi_wvalid (afi1_wvalid), // output
636  .afi_wready (afi1_wready), // input
637  .afi_wid (afi1_wid), // output[5:0]
638  .afi_wlast (afi1_wlast), // output
639  .afi_wstrb (afi1_wstrb), // output[7:0]
640  .afi_bvalid (afi1_bvalid), // input
641  .afi_bready (afi1_bready), // output
642  .afi_bid (afi1_bid), // input[5:0]
643  .afi_bresp (afi1_bresp), // input[1:0]
644  .afi_wcount (afi1_wcount), // input[7:0]
645  .afi_wacount (afi1_wacount), // input[5:0]
647 `ifdef DEBUG_RING
648  ,.debug_do (debug_ring[5]), // output
649  .debug_sl (debug_sl), // input
651 `endif
652  );
653  assign afi1_clk = hclk;
654  end else begin
655  cmprs_afi_mux #(
656  .CMPRS_AFIMUX_ADDR (CMPRS_GROUP_ADDR + CMPRS_AFIMUX_RADDR0),
663  .CMPRS_AFIMUX_STATUS_REG_ADDR (CMPRS_AFIMUX_REG_ADDR0),
667 `ifdef DEBUG_RING
668  ,.DEBUG_CMD_LATENCY (DEBUG_CMD_LATENCY)
669 `endif
670  ) cmprs_afi0_mux_i (
671 // .rst (rst), // input
672  .mclk (mclk), // input
673  .hclk (hclk), // input
674  .mrst (mrst), // input
675  .hrst (hrst), // input
676  .cmd_ad (cmd_ad), // input[7:0]
677  .cmd_stb (cmd_stb), // input
678  .status_ad (status_ad_mux[32 +: 8]), // output[7:0]
679  .status_rq (status_rq_mux[4]), // output
680  .status_start (status_start_mux[4]), // input
681  .fifo_rst0 (fifo_rst[0]), // output
682  .fifo_ren0 (fifo_ren[0]), // output
683  .fifo_rdata0 (fifo_rdata[0 +: 64]), // input[63:0]
684  .eof_written0 (eof_written[0]), // output
685  .pre_flush0 (flush_hclk[0]), // input
686  .fifo_flush0 (fifo_flush[0]), // input
687  .fifo_count0 (fifo_count[0 +: 8]), // input[7:0]
688  .fifo_rst1 (fifo_rst[1]), // output
689  .fifo_ren1 (fifo_ren[1]), // output
690  .fifo_rdata1 (fifo_rdata[64 +: 64]), // input[63:0]
691  .eof_written1 (eof_written[1]), // output
692  .pre_flush1 (flush_hclk[1]), // input
693  .fifo_flush1 (fifo_flush[1]), // input
694  .fifo_count1 (fifo_count[8 +: 8]), // input[7:0]
695  .fifo_rst2 (fifo_rst[2]), // output
696  .fifo_ren2 (fifo_ren[2]), // output
697  .fifo_rdata2 (fifo_rdata[128 +: 64]), // input[63:0]
698  .eof_written2 (eof_written[2]), // output
699  .pre_flush2 (flush_hclk[2]), // input
700  .fifo_flush2 (fifo_flush[2]), // input
701  .fifo_count2 (fifo_count[16 +: 8]), // input[7:0]
702  .fifo_rst3 (fifo_rst[3]), // output
703  .fifo_ren3 (fifo_ren[3]), // output
704  .fifo_rdata3 (fifo_rdata[192 +: 64]), // input[63:0]
705  .eof_written3 (eof_written[3]), // output
706  .pre_flush3 (flush_hclk[3]), // input
707  .fifo_flush3 (fifo_flush[3]), // input
708  .fifo_count3 (fifo_count[24 +: 8]), // input[7:0]
709  .afi_awaddr (afi0_awaddr), // output[31:0]
710  .afi_awvalid (afi0_awvalid), // output
711  .afi_awready (afi0_awready), // input
712  .afi_awid (afi0_awid), // output[5:0]
713  .afi_awlock (afi0_awlock), // output[1:0]
714  .afi_awcache (afi0_awcache), // output[3:0]
715  .afi_awprot (afi0_awprot), // output[2:0]
716  .afi_awlen (afi0_awlen), // output[3:0]
717  .afi_awsize (afi0_awsize), // output[2:0]
718  .afi_awburst (afi0_awburst), // output[1:0]
719  .afi_awqos (afi0_awqos), // output[3:0]
720  .afi_wdata (afi0_wdata), // output[63:0]
721  .afi_wvalid (afi0_wvalid), // output
722  .afi_wready (afi0_wready), // input
723  .afi_wid (afi0_wid), // output[5:0]
724  .afi_wlast (afi0_wlast), // output
725  .afi_wstrb (afi0_wstrb), // output[7:0]
726  .afi_bvalid (afi0_bvalid), // input
727  .afi_bready (afi0_bready), // output
728  .afi_bid (afi0_bid), // input[5:0]
729  .afi_bresp (afi0_bresp), // input[1:0]
730  .afi_wcount (afi0_wcount), // input[7:0]
731  .afi_wacount (afi0_wacount), // input[5:0]
733 `ifdef DEBUG_RING
734  ,.debug_do (debug_ring[4]), // output
735  .debug_sl (debug_sl), // input
736  .debug_di (debug_ring[5]) // input
737 `endif
738  );
739  assign afi1_clk = hclk;
740  assign afi1_awaddr = 0;
741  assign afi1_awvalid = 0;
742  assign afi1_awid = 0;
743  assign afi1_awlock = 0;
744  assign afi1_awcache = 0;
745  assign afi1_awprot = 0;
746  assign afi1_awlen = 0;
747  assign afi1_awsize = 0;
748  assign afi1_awburst = 0;
749  assign afi1_awqos = 0;
750  assign afi1_wdata = 0;
751  assign afi1_wvalid = 0;
752  assign afi1_wid = 0;
753  assign afi1_wlast = 0;
754  assign afi1_wstrb = 0;
755  assign afi1_bready = 0;
756  assign afi1_wrissuecap1en = 0;
757  assign status_rq_mux[5] = 0;
758  assign status_ad_mux[40 +: 8] = 8'b0;
759  end
760  endgenerate
761 
762 
763 
764 endmodule
765 
766 
1925CMPRS_AFIMUX_MODE'h2
[7:0] 147fifo_count1
1876CMPRS_CBIT_QBANK_BITS3
Definition: compressor393.v:74
[7:0] 11026db_in7
[ 5:0] 1985afi0_bid
[7:0] 2720cmd_ad
Definition: jp_channel.v:136
1898CMPRS_CBIT_CMODE_JP4DIFFHDR4'h8
Definition: compressor393.v:98
1902CMPRS_CBIT_CMODE_MONO44'he
[ 3:0] 1996afi1_awcache
[ 7:0] 178afi_wstrb
1887CMPRS_CBIT_RUN_RST2'h0
Definition: compressor393.v:86
2747eof_written_mclk
Definition: jp_channel.v:181
2748stuffer_done_mclk
Definition: jp_channel.v:182
[ 7:0] 2012afi1_wcount
1913CMPRS_FRMT_MBRM1_BITS13
[NUM_FRAME_BITS-1:0] 2750frame_num_compressed
Definition: jp_channel.v:188
[4 * NUM_FRAME_BITS-1:0] 1964frame_num_compressed
[7:0] 11011db_in2
[3:0] 1961eof_written_mclk
[ 1:0] 1986afi0_bresp
[63:0] 2002afi1_wdata
1892CMPRS_CBIT_CMODE_JP464'h2
Definition: compressor393.v:92
[LAST_FRAME_BITS-1:0] 2734frame_number_src
Definition: jp_channel.v:158
2020status_ad_muxwire[47:0]
2027eof_writtenwire[3:0]
[3:0] 1946buf_we
1867TABLE_QUANTIZATION_INDEX0
Definition: compressor393.v:64
2021status_rq_muxwire[5:0]
1911CMPRS_FRMT_MBCM1_BITS13
1863CMPRS_COLOR_SATURATION3
Definition: compressor393.v:60
[ 7:0] 1987afi0_wcount
[ 5:0] 2010afi1_bid
[3:0] 1945buf_wpage_nxt
1903CMPRS_CBIT_FRAMES_SINGLE0
[ 1:0] 1995afi1_awlock
[63:0] 1977afi0_wdata
[7:0] 2759fifo_count
Definition: jp_channel.v:200
[3:0] 1944xfer_reset_page_rd
[ 1:0] 2011afi1_bresp
[ 5:0] 1980afi0_wid
[63:0] 150fifo_rdata2
[31:0] 1960ts_data
1880CMPRS_CBIT_CMODE_BITS4
Definition: compressor393.v:78
1901CMPRS_CBIT_CMODE_MONO14'hb
[7:0] 2722status_ad
Definition: jp_channel.v:138
[31:0] 162afi_awaddr
[ 1:0] 170afi_awsize
2018DEBUG_RING_LENGTH5 + ((CMPRS_NUM_AFI_CHN > 1)?1:0
[63:0] 2729buf_din
Definition: jp_channel.v:148
[63:0] 136fifo_rdata0
Definition: cmprs_afi_mux.v:96
[7:0] 2746ts_data
Definition: jp_channel.v:179
[7:0] 131status_ad
Definition: cmprs_afi_mux.v:89
[ 1:0] 1970afi0_awlock
[ 7:0] 1982afi0_wstrb
1878CMPRS_CBIT_DCSUB_BITS1
Definition: compressor393.v:76
[ 3:0] 1998afi1_awlen
1888CMPRS_CBIT_RUN_STANDALONE2'h2
Definition: compressor393.v:88
1854CMPRS_HIFREQ_REG_BASE'h14
Definition: compressor393.v:50
[ 1:0] 171afi_awburst
1900CMPRS_CBIT_CMODE_JP4DIFFHDRDIV24'ha
reg [LAST_FRAME_BITS-1:0] 2740frame_number_finished
Definition: jp_channel.v:168
1849CMPRS_BASE_INC'h10
Definition: compressor393.v:44
2019debug_ringwire[DEBUG_RING_LENGTH:0]
[4*FRAME_HEIGHT_BITS-1:0] 1954line_unfinished_dst
1897CMPRS_CBIT_CMODE_JP4DIFF4'h7
Definition: compressor393.v:97
[FRAME_HEIGHT_BITS-1:0] 2736line_unfinished_dst
Definition: jp_channel.v:163
[3:0] 1948page_ready
2023fifo_rstwire[3:0]
[ 5:0] 2005afi1_wid
1850CMPRS_AFIMUX_RADDR0'h40
Definition: compressor393.v:45
[ 1:0] 182afi_bresp
[15:0] 2744statistics_do
Definition: jp_channel.v:175
2024fifo_renwire[3:0]
1899CMPRS_CBIT_CMODE_JP4DIFFDIV24'h9
Definition: compressor393.v:99
1855CMPRS_AFIMUX_REG_ADDR0'h18
Definition: compressor393.v:51
jp_channel_i jp_channel[generate]
1896CMPRS_CBIT_CMODE_JP4DC4'h6
Definition: compressor393.v:96
[7:0] 11005db_in0
2028fifo_flushwire[3:0]
1891CMPRS_CBIT_CMODE_MONO64'h1
Definition: compressor393.v:91
[ 3:0] 2001afi1_awqos
[ 2:0] 168afi_awprot
2030fifo_countwire[31:0]
[4*LAST_FRAME_BITS-1:0] 1958frame_number_finished
[3:0] 1956frame_done_dst
[63:0] 2754fifo_rdata
Definition: jp_channel.v:194
[63:0] 173afi_wdata
[ 7:0] 2007afi1_wstrb
1882CMPRS_CBIT_FRAMES_BITS1
Definition: compressor393.v:80
1930AFI_MUX_BUF_LATENCY4'd2
[3:0] 1953frame_done_src
[3:0] 1950frame_start_dst
[2:0] 2742hfc_sel
Definition: jp_channel.v:173
[ 5:0] 176afi_wid
[ 1:0] 1999afi1_awsize
1894CMPRS_CBIT_CMODE_JPEG204'h4
Definition: compressor393.v:94
[7:0] 11023db_in6
[7:0] 154fifo_count2
[ 2:0] 1972afi0_awprot
[ 1:0] 1974afi0_awsize
2730page_ready_chn
Definition: jp_channel.v:151
[ 5:0] 181afi_bid
1893CMPRS_CBIT_CMODE_JP46DC4'h3
Definition: compressor393.v:93
[31:0] 1991afi1_awaddr
1856CMPRS_AFIMUX_REG_ADDR1'h1c
Definition: compressor393.v:52
[4*LAST_FRAME_BITS-1:0] 1955frame_number_dst
[7:0] 11020db_in5
1852CMPRS_AFIMUX_MASK'h7f0
Definition: compressor393.v:47
[ 5:0] 165afi_awid
[3:0] 1963vsync_late
[7:0] 11014db_in3
[3:0] 1949next_page
cmprs_afi1_mux_i cmprs_afi_mux[generate]
[7:0] 161fifo_count3
[ 3:0] 167afi_awcache
[ 5:0] 1994afi1_awid
[ 7:0] 183afi_wcount
[3:0] 1962stuffer_done_mclk
1895CMPRS_CBIT_CMODE_JP44'h5
Definition: compressor393.v:95
[7:0] 11017db_in4
2735frame_done_src
Definition: jp_channel.v:159
[ 2:0] 1997afi1_awprot
[ 1:0] 1975afi0_awburst
2738frame_done_dst
Definition: jp_channel.v:165
[ 3:0] 1971afi0_awcache
2029flush_hclkwire[3:0]
1859CMPRS_MASK'h7f8
Definition: compressor393.v:56
1927CMPRS_AFIMUX_SA_LEN'h8
[7:0] 1938cmd_ad
[7:0] 11008db_in1
2726xfer_reset_page_rd
Definition: jp_channel.v:144
1926CMPRS_AFIMUX_STATUS_CNTRL'h4
[ 5:0] 1969afi0_awid
[7:0] 129cmd_ad
Definition: cmprs_afi_mux.v:87
[ 5:0] 2013afi1_wacount
[ 3:0] 172afi_awqos
1853CMPRS_STATUS_REG_BASE'h10
Definition: compressor393.v:49
[7:0] 11029db_out
1884CMPRS_CBIT_BAYER_BITS2
Definition: compressor393.v:82
[3:0] 1943cmprs_irq
1851CMPRS_AFIMUX_RADDR1'h50
Definition: compressor393.v:46
[7:0] 140fifo_count0
1889CMPRS_CBIT_RUN_ENABLE2'h3
Definition: compressor393.v:89
[FRAME_HEIGHT_BITS-1:0] 2733line_unfinished_src
Definition: jp_channel.v:157
[255:0] 1947buf_din
[3:0] 1957suspend
[ 5:0] 1988afi0_wacount
[63:0] 143fifo_rdata1
2022status_start_muxwire[5:0]
[ 3:0] 1976afi0_awqos
[4*FRAME_HEIGHT_BITS-1:0] 1951line_unfinished_src
[3:0] 1959ts_pre_stb
[63:0] 157fifo_rdata3
[ 5:0] 184afi_wacount
[ 1:0] 2000afi1_awburst
reg [ 3:0] 169afi_awlen
[ 1:0] 166afi_awlock
[7:0] 1940status_ad
2732frame_start_dst
Definition: jp_channel.v:154
status_router8_i status_router8
[31:0] 1966afi0_awaddr
2026fifo_eofwire[3:0]
1890CMPRS_CBIT_CMODE_JPEG184'h0
Definition: compressor393.v:90
[LAST_FRAME_BITS-1:0] 2737frame_number_dst
Definition: jp_channel.v:164
1848CMPRS_GROUP_ADDR'h600
Definition: compressor393.v:43
2025fifo_rdatawire[255:0]
[4*LAST_FRAME_BITS-1:0] 1952frame_number_src
[ 3:0] 1973afi0_awlen
1886CMPRS_CBIT_FOCUS_BITS2
Definition: compressor393.v:84