outputcmprs_en_extend,// @mclk keep compressor enabled for graceful shutdown
inputcmprs_run,// @mclk enable propagation of vsync_late to frame_start_dst in bonded(sync to src) mode
inputcmprs_standalone,// @mclk single-cycle: generate a single frame_start_dst in unbonded (not synchronized) mode.
// cmprs_run should be off
inputsigle_frame_buf,// memory controller uses a single frame buffer (frame_number_* == 0), use other sync
inputvsync_late,// @xclk delayed start of frame, @xclk. In 353 it was 16 lines after VACT active
// source channel should already start, some delay give time for sequencer commands
// that should arrive before it
inputframe_started,// @xclk started first macroblock (checking for broken frames)
outputframe_start_dst,// @mclk - trigger receive (tiled) memory channel (it will take care of single/repetitive
// this output either follows vsync_late (reclocks it) or generated in non-bonded mode
// (compress from memory)
input[FRAME_HEIGHT_BITS-1:0]line_unfinished_src,// number of the current (unfinished ) line, in the source (sensor) channel (RELATIVE TO FRAME, NOT WINDOW?)
input[LAST_FRAME_BITS-1:0]frame_number_src,// current frame number (for multi-frame ranges) in the source (sensor) channel
inputframe_done_src,// single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// frame_done_src is later than line_unfinished_src/ frame_number_src changes
// Used withe a single-frame buffers
input[FRAME_HEIGHT_BITS-1:0]line_unfinished,// number of the current (unfinished ) line in this (compressor) channel
input[LAST_FRAME_BITS-1:0]frame_number,// current frame number (for multi-frame ranges) in this (compressor channel
inputframe_done,// input - single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
outputregsuspend,// suspend reading data for this channel - waiting for the source data
outputregbroken_frame// next frame start came before previous frame was read to compressor
);
wirevsync_late_mclk;// single mclk cycle, reclocked from vsync_late
wireframe_started_mclk;
regbonded_mode;
regframe_start_dst_r;
regframes_differ;// src and dest point to different frames (single-frame buffer mode), disregard line_unfinished_*
regframes_numbers_differ;// src and dest point to different frames (multi-frame buffer mode), disregard line_unfinished_*
regline_numbers_sync;// src unfinished line number is > this unfinished line number
regreading_frame;// compressor is reading frame data (make sure input is done before starting next frame, otherwise make it a broken frame
inputvsync_late,// delayed start of frame, @xclk. In 353 it was 16 lines after VACT active
// source channel should already start, some delay give time for sequencer commands
// that should arrive before it
outputframe_start_dst,// @mclk - trigger receive (tiledc) memory channel (it will take care of single/repetitive
// these output either follows vsync_late (reclocks it) or generated in non-bonded mode
// (compress from memory)
input[FRAME_HEIGHT_BITS-1:0]line_unfinished_src,// number of the current (unfinished ) line, in the source (sensor) channel (RELATIVE TO FRAME, NOT WINDOW?)
input[LAST_FRAME_BITS-1:0]frame_number_src,// current frame number (for multi-frame ranges) in the source (sensor) channel
inputframe_done_src,// single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// frame_done_src is later than line_unfinished_src/ frame_number_src changes
// Used withe a single-frame buffers
input[FRAME_HEIGHT_BITS-1:0]line_unfinished_dst,// number of the current (unfinished ) line in this (compressor) channel
input[LAST_FRAME_BITS-1:0]frame_number_dst,// current frame number (for multi-frame ranges) in this (compressor channel
inputframe_done_dst,// single-cycle pulse when the full frame (window) was transferred to/from DDR3 memory
// use as 'eot_real' in 353
outputsuspend// suspend reading data for this channel - waiting for the source data
);
// Control signals to be defined
wireframe_en;// if 0 - will reset logic immediately (but not page number)
wireframe_go;// start frame: if idle, will start reading data (if available),
wireframe_go=frame_en;// start frame: if idle, will start reading data (if available),
// if running - will not restart a new frame if 0.
wire[4:0]left_marg;// left margin (for not-yet-implemented) mono JPEG (8 lines tile row) can need 7 bits (mod 32 - tile)
wire[12:0]n_blocks_in_row_m1;// number of macroblocks in a macroblock row minus 1
wire[12:0]n_block_rows_m1;// number of macroblock rows in a frame minus 1
wire[CMPRS_FRMT_LMARG_BITS-1:0]left_marg;// left margin (for not-yet-implemented) mono JPEG (8 lines tile row) can need 7 bits (mod 32 - tile)
wire[CMPRS_FRMT_MBCM1_BITS-1:0]n_blocks_in_row_m1;// number of macroblocks in a macroblock row minus 1
wire[CMPRS_FRMT_MBRM1_BITS-1:0]n_block_rows_m1;// number of macroblock rows in a frame minus 1
wireignore_color;// zero Cb/Cr components (TODO: maybe include into converter_type?)
// s ynthesis attribute use_sync_set of stuffer is no;
// s ynthesis attribute use_sync_reset of stuffer is no;
// s ynthesis attribute use_clock_enable of stuffer is no;
// TODO:
// 1: Add FIFO buffer - with hclk on the read side
// 2: Get rid of imgptr - read addresses from the AFI module
// 3 Add multi-word status transmitter or just status transmit module for each compressor channel (29 bits are OK to read in multiple of 32-byte blocks
// Or make FIFO outside of the stuffer?
modulestuffer393(
inputclk,// 2x pixel clock
...
...
@@ -51,9 +55,10 @@ module stuffer393 (
input[31:0]sec,// [31:0] number of seconds
input[19:0]usec,// [19:0] number of microseconds
outputrdy,// enable huffman encoder to proceed. Used as CE for many huffman encoder registers
// outputs @ negedge clk
outputreg[15:0]q,// [15:0] output data
outputregqv,// output data valid
outputdone,// reset by !en, goes high after some delay after flushing
outputdone,// reset by !en, goes high after some delay after flushing
outputreg[23:0]imgptr,// [23:0]image pointer in 32-byte chunks