Commit 654584f3 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

More development of the Verilog and Python code for LWIR sensors

parent 1ccb2eee
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -129,6 +129,8 @@ module cmprs_cmd_decode#(
        parameter CMPRS_CBIT_BAYER_BITS =     2, // number of bits to control compressor Bayer shift mode
        parameter CMPRS_CBIT_FOCUS =         23, // bit # to control compressor focus display mode
        parameter CMPRS_CBIT_FOCUS_BITS =     2, // number of bits to control compressor focus display mode
        parameter CMPRS_CBIT_ROWS_LSB =      28, // bit # Four height LSBs in raw mode 
        parameter CMPRS_CBIT_ROWS_LSB_BITS =  4, // number of bits to control four height LSBs in raw mode
        // compressor bit-fields decode
        parameter CMPRS_CBIT_RUN_RST =        2'h0, // reset compressor, stop immediately
//      parameter CMPRS_CBIT_RUN_DISABLE =    2'h1, // disable compression of the new frames, finish any already started
@@ -205,6 +207,7 @@ module cmprs_cmd_decode#(
    output reg             [ 2:0] cmprs_qpage, // [2:0] - quantizator page number (0..7)
    output reg                    cmprs_dcsub, // subtract dc level before DCT, restore later
    output reg             [ 1:0] cmprs_fmode, //[1:0] - focus mode
    output reg             [ 3:0] raw_rows_lsb,    // Four LSBs of the window height - used in raw mode
    output reg             [ 1:0] bayer_shift, // additional shift to bayer mosaic
                                  
    output reg                    ignore_color,
@@ -246,6 +249,7 @@ module cmprs_cmd_decode#(
    reg          cmprs_dcsub_mclk; // subtract dc level before DCT, restore later
    reg   [ 3:0] cmprs_mode_mclk;  // [3:0] - compressor mode
    reg   [ 1:0] cmprs_fmode_mclk; //[1:0] - focus mode
    reg   [ 3:0] rows_lsb_mclk;     // [3:0] - Four LSBs of the window height - used in raw mode
    reg   [ 1:0] bayer_shift_mclk; // additional shift to bayer mosaic
    
    reg   [30:0] format_mclk; // left margin and macroblock rows/columns
@@ -256,6 +260,8 @@ module cmprs_cmd_decode#(
    reg          cmprs_dcsub_xclk; // subtract dc level before DCT, restore later
    reg   [ 3:0] cmprs_mode_xclk;  // [3:0] - compressor mode
    reg   [ 1:0] cmprs_fmode_xclk; //[1:0] - focus mode
    reg   [ 3:0] rows_lsb_xclk;  // Four LSBs of the window height - used in raw mode
    
    reg   [ 1:0] bayer_shift_xclk; // additional shift to bayer mosaic
    
    reg   [30:0] format_xclk; // left margin and macroblock rows/columns
@@ -312,6 +318,9 @@ module cmprs_cmd_decode#(
        if      (mrst)                                 cmprs_fmode_mclk <=  0;
        else if (ctrl_we_r && di_r[CMPRS_CBIT_FOCUS])  cmprs_fmode_mclk <=  di_r[CMPRS_CBIT_FOCUS-1 -:CMPRS_CBIT_FOCUS_BITS];

        if      (mrst)                                    rows_lsb_mclk <=  4'h0f;
        else if (ctrl_we_r && di_r[CMPRS_CBIT_ROWS_LSB])  rows_lsb_mclk <=  di_r[CMPRS_CBIT_ROWS_LSB-1 -:CMPRS_CBIT_ROWS_LSB_BITS];
        
        if      (mrst)                                 bayer_shift_mclk <=  0;
        else if (ctrl_we_r && di_r[CMPRS_CBIT_BAYER])  bayer_shift_mclk <=  di_r[CMPRS_CBIT_BAYER-1 -:CMPRS_CBIT_BAYER_BITS];
        
@@ -343,6 +352,7 @@ module cmprs_cmd_decode#(
        cmprs_dcsub_xclk <=     cmprs_dcsub_mclk;
        cmprs_mode_xclk <=      cmprs_mode_mclk;
        cmprs_fmode_xclk <=     cmprs_fmode_mclk;
        rows_lsb_xclk <=        rows_lsb_mclk;
        bayer_shift_xclk <=     bayer_shift_mclk;
    end
    
@@ -356,6 +366,7 @@ module cmprs_cmd_decode#(
        cmprs_qpage <=        cmprs_qpage_xclk;
        cmprs_dcsub <=        cmprs_dcsub_xclk;
        cmprs_fmode <=        cmprs_fmode_xclk;
        raw_rows_lsb <=       rows_lsb_xclk;
        bayer_shift <=        bayer_shift_xclk;
        
        left_marg <=          format_xclk[CMPRS_FRMT_LMARG +: CMPRS_FRMT_LMARG_BITS];
+4 −2
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ module cmprs_raw_buf_iface #(
    input         cmprs_run_mclk,     // 0 - off or stopping, reset frame_pre_run
//    input  [ 4:0] left_marg,          // left margin (for not-yet-implemented) mono JPEG (8 lines tile row) can need 7 bits (mod 32 - tile)
    input  [12:0] n_blocks_in_row_m1, // number of macroblocks in a macroblock row minus 1
    input  [12:0] n_block_rows_m1,    // number of macroblock rows in a frame minus 1
//    input  [12:0] n_block_rows_m1,    // number of macroblock rows in a frame minus 1
    input  [16:0] n_block_rows_m1,    // number of macroblock rows in a frame minus 1
    input             stuffer_running, // @xclk, active while bit stuffer or trailer are running
    input             raw_be16,           // 0: bytes 0-1-2-3-4-5..., 1: bytes 1-0-3-2-5-4...
    output     [11:0] buf_ra,             // buffer read address (2 MSB - page number)
@@ -206,7 +207,8 @@ module cmprs_raw_buf_iface #(
        
        quad_last <= mode_valid && !(|quads_left); // valid from 2 after frame_pre_start_r or after quad_r[3]

        if      (frame_pre_start_r)                             rows_left <=  {n_block_rows_m1, 4'b1111};
//        if      (frame_pre_start_r)                             rows_left <=  {n_block_rows_m1, 4'b1111};
        if      (frame_pre_start_r)                             rows_left <=  n_block_rows_m1; //n_block_rows_m1 now combines n_block_rows_m1 and tile vstep ?
        else if ((quad_r[2] && quad_last))                      rows_left <=  rows_left - 1;
        
        rows_last <= {rows_last[0], mode_valid & ~(|rows_left)};
+5 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ module compressor393 # (
        parameter CMPRS_CBIT_BAYER_BITS =      2, // number of bits to control compressor Bayer shift mode
        parameter CMPRS_CBIT_FOCUS =          23, // bit # to control compressor focus display mode
        parameter CMPRS_CBIT_FOCUS_BITS =      2, // number of bits to control compressor focus display mode
        parameter CMPRS_CBIT_ROWS_LSB =       28, // bit # Four height LSBs in raw mode 
        parameter CMPRS_CBIT_ROWS_LSB_BITS =   4, // number of bits to control four height LSBs in raw mode
        
        // compressor bit-fields decode
        parameter CMPRS_CBIT_RUN_RST =         2'h0, // reset compressor, stop immediately
//      parameter CMPRS_CBIT_RUN_DISABLE =     2'h1, // disable compression of the new frames, finish any already started
@@ -382,6 +385,8 @@ module compressor393 # (
                .CMPRS_CBIT_BAYER_BITS           (CMPRS_CBIT_BAYER_BITS),
                .CMPRS_CBIT_FOCUS                (CMPRS_CBIT_FOCUS),
                .CMPRS_CBIT_FOCUS_BITS           (CMPRS_CBIT_FOCUS_BITS),
                .CMPRS_CBIT_ROWS_LSB             (CMPRS_CBIT_ROWS_LSB),
                .CMPRS_CBIT_ROWS_LSB_BITS        (CMPRS_CBIT_ROWS_LSB_BITS),
                .CMPRS_CBIT_RUN_RST              (CMPRS_CBIT_RUN_RST),
                .CMPRS_CBIT_RUN_STANDALONE       (CMPRS_CBIT_RUN_STANDALONE),
                .CMPRS_CBIT_RUN_ENABLE           (CMPRS_CBIT_RUN_ENABLE),
+8 −3
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ module jp_channel#(
        parameter CMPRS_CBIT_BAYER_BITS =     2, // number of bits to control compressor Bayer shift mode
        parameter CMPRS_CBIT_FOCUS =         23, // bit # to control compressor focus display mode
        parameter CMPRS_CBIT_FOCUS_BITS =     2, // number of bits to control compressor focus display mode
        parameter CMPRS_CBIT_ROWS_LSB =      28, // bit # Four height LSBs in raw mode 
        parameter CMPRS_CBIT_ROWS_LSB_BITS =  4, // number of bits to control four height LSBs in raw mode
        // compressor bit-fields decode
        parameter CMPRS_CBIT_RUN_RST =        2'h0, // reset compressor, stop immediately
//      parameter CMPRS_CBIT_RUN_DISABLE =    2'h1, // disable compression of the new frames, finish any already started
@@ -253,7 +255,7 @@ module jp_channel#(
    wire    [CMPRS_CSAT_CR_BITS-1:0] m_cr;               // [9:0] scale for CR - default 0.713 (10'hb6)

    wire   [ 1:0] cmprs_fmode;        // focusing/overlay mode

    wire   [ 3:0] raw_rows_lsb;       // four LSBs of window height in raw mode, 0 means 'h10, 'hf means f
    //TODO: assign next 5 values from converter_type[2:0]
    wire   [ 5:0] mb_w_m1;            // macroblock width minus 1
    wire   [ 5:0] mb_h_m1;            // macroblock height -1
@@ -701,6 +703,8 @@ module jp_channel#(
        .CMPRS_CBIT_BAYER_BITS           (CMPRS_CBIT_BAYER_BITS),
        .CMPRS_CBIT_FOCUS                (CMPRS_CBIT_FOCUS),
        .CMPRS_CBIT_FOCUS_BITS           (CMPRS_CBIT_FOCUS_BITS),
        .CMPRS_CBIT_ROWS_LSB             (CMPRS_CBIT_ROWS_LSB),
        .CMPRS_CBIT_ROWS_LSB_BITS        (CMPRS_CBIT_ROWS_LSB_BITS),
        .CMPRS_CBIT_RUN_RST              (CMPRS_CBIT_RUN_RST),
        .CMPRS_CBIT_RUN_STANDALONE       (CMPRS_CBIT_RUN_STANDALONE),
        .CMPRS_CBIT_RUN_ENABLE           (CMPRS_CBIT_RUN_ENABLE),
@@ -761,6 +765,7 @@ module jp_channel#(
        .cmprs_qpage        (cmprs_qpage),         // output[2:0] reg 
        .cmprs_dcsub        (subtract_dc),         // output reg 
        .cmprs_fmode        (cmprs_fmode),         // output[1:0] reg
        .raw_rows_lsb       (raw_rows_lsb),        // output[3:0] reg 
        .bayer_shift        (bayer_phase),         // output[1:0] reg 
        .ignore_color       (ignore_color),        // output reg 
        .four_blocks        (),                    // output reg Not used?
@@ -888,7 +893,7 @@ module jp_channel#(
        .frame_go           (frame_go_raw),       // input
        .cmprs_run_mclk     (cmprs_run_mclk),     // input
        .n_blocks_in_row_m1 (n_blocks_in_row_m1), // input[12:0] 
        .n_block_rows_m1    (n_block_rows_m1),    // input[12:0] 
        .n_block_rows_m1    ({n_block_rows_m1,raw_rows_lsb}), // input[12:0] 
        .stuffer_running    (stuffer_running),    // input
        .raw_be16           (raw_be16),           // input
        .buf_ra             (raw_buf_ra),         // output[11:0] 
+4 −1
Original line number Diff line number Diff line
@@ -35,7 +35,10 @@
 * contains all the components and scripts required to completely simulate it
 * with at least one of the Free Software programs.
 */
        parameter FPGA_VERSION =          32'h03930107;      // parallel - 17.4 - restored delay after linear, fixed bug, all met
         parameter FPGA_VERSION =          32'h03930120;      //
 
 
//        parameter FPGA_VERSION =          32'h03930107;      // parallel - 17.4 - restored delay after linear, fixed bug, all met
//        parameter FPGA_VERSION =          32'h03930110;      //A serial - 17.4 - restored delay after linear, fixed bug, timing met
//        parameter FPGA_VERSION =          32'h03930110;      // serial - 17.4 - restored delay after linear, fixed bug, timing failed
//        parameter FPGA_VERSION =          32'h03930107;      // parallel - 17.4 - restored delay after linear, fixed bug, all met
Loading