Commit a17b36ec authored by Andrey Filippov's avatar Andrey Filippov

more work on JPEG tail, version 0x039300ca

parent 4b42ed42
This diff is collapsed.
...@@ -66,20 +66,25 @@ module bit_stuffer_27_32#( ...@@ -66,20 +66,25 @@ module bit_stuffer_27_32#(
reg [31:0] dmask2_rom; // data mask (sync with data2) - 1 use new data, 0 - use old data. Use small ROM? reg [31:0] dmask2_rom; // data mask (sync with data2) - 1 use new data, 0 - use old data. Use small ROM?
reg [1:0] stage; // delayed ds or flush reg [1:0] stage; // delayed ds or flush
reg [1:0] ds_stage; //reg [1:0] ds_stage;
reg [2:0] flush_stage; reg [2:0] flush_stage;
// reg flush_pend;
// wire flush_ackn = flush_pend && !flush_stage[0] && !stage[0];
// probably just a single unconditional flush_in delay (not to appear next after ds) will work
wire [4:0] pre_bits_out_w = dlen2[4:0] + 5'h7; wire [4:0] pre_bits_out_w = dlen2[4:0] + 5'h7;
assign d_out = data3[DATA3_LEN-1 -: 32]; assign d_out = data3[DATA3_LEN-1 -: 32];
always @ (posedge xclk) begin always @ (posedge xclk) begin
// if (rst) flush_pend <= 0;
// else flush_pend <= flush_in || (flush_pend && !stage[0]);
if (rst) stage <= 0; if (rst) stage <= 0;
else stage <= {stage[0], ds | flush_in}; else stage <= {stage[0], ds | flush_in};
if (rst) ds_stage <= 0; // if (rst) ds_stage <= 0;
else ds_stage <= {ds_stage[0], ds}; // else ds_stage <= {ds_stage[0], ds};
if (rst) flush_stage <= 0; if (rst) flush_stage <= 0;
else flush_stage <= {flush_stage[1:0], flush_in}; else flush_stage <= {flush_stage[1:0], flush_in};
...@@ -152,20 +157,23 @@ module bit_stuffer_27_32#( ...@@ -152,20 +157,23 @@ module bit_stuffer_27_32#(
endcase endcase
// barrel shifter stage 3 (0/1), combined with output/hold register // barrel shifter stage 3 (0/1), combined with output/hold register
if (rst) data3 <= 'bx; if (rst) data3 <= 'bx;
else if (ds_stage[1]) begin // else if (ds_stage[1]) begin
else if (stage[1]) begin // flush causes shift too
data3[DATA3_LEN-1 -: 32] <= (~dmask2_rom & (dlen2[5] ? {data3[DATA3_LEN-1-32 : 0],6'b0}: data3[DATA3_LEN-1 -: 32])) | data3[DATA3_LEN-1 -: 32] <= (~dmask2_rom & (dlen2[5] ? {data3[DATA3_LEN-1-32 : 0],6'b0}: data3[DATA3_LEN-1 -: 32])) |
( dmask2_rom & (dlen2[0] ? {1'b0,data2[DATA2_LEN-1 -: 31]} : data2[DATA2_LEN-1 -: 32])); ( dmask2_rom & (dlen2[0] ? {1'b0,data2[DATA2_LEN-1 -: 31]} : data2[DATA2_LEN-1 -: 32]));
data3[DATA3_LEN-1-32: 0] <= dlen2[0] ? data2[DATA2_LEN-31-1 : 0] : {data2[DATA2_LEN-32-1 : 0], 1'b0}; data3[DATA3_LEN-1-32: 0] <= dlen2[0] ? data2[DATA2_LEN-31-1 : 0] : {data2[DATA2_LEN-32-1 : 0], 1'b0};
end end
// dv <= (ds_stage[1] && dlen2[5]) || (flush_stage[1] && !(|data3[DATA3_LEN-1 -: 32]));
// dv <= (ds_stage[1] && dlen1[5]) || (flush_stage[1] && !(|data3[DATA3_LEN-1 -: 32])); // dv <= (ds_stage[0] && dlen1[5]) || (flush_stage[1] && (|data3[DATA3_LEN-1 -: 32]));
// dv <= (ds_stage[0] && dlen1[5]) || (flush_stage[1] && !(|data3[DATA3_LEN-1 -: 32])); dv <= (stage[0] && dlen1[5]) || (flush_stage[1] && (|data3[DATA3_LEN-1 -: 32])); // both ds and flush-caused (full 32-bit out if available)
dv <= (ds_stage[0] && dlen1[5]) || (flush_stage[1] && (|data3[DATA3_LEN-1 -: 32]));
// no difference in number of cells // no difference in number of cells
// if (rst ) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes // if (rst ) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes
// else if (ds_stage[1]) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes // else if (ds_stage[1]) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes
if (rst || ds_stage[1]) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes // if (rst || ds_stage[1]) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes
// bytes_out valid with dv
if (rst || stage[0]) bytes_out <= 0; // if the dv was caused by 32 bits full - output 4 bytes
else if (flush_stage[1]) bytes_out <= pre_bits_out_w[4:3]; else if (flush_stage[1]) bytes_out <= pre_bits_out_w[4:3];
flush_out <= flush_stage[2]; flush_out <= flush_stage[2];
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
* contains all the components and scripts required to completely simulate it * contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs. * with at least one of the Free Software programs.
*/ */
parameter FPGA_VERSION = 32'h039300c9; //parallel - trying more ...-0.123/32 79.82% parameter FPGA_VERSION = 32'h039300ca; //parallel - and more ... -0.267/46, 80.42%
// parameter FPGA_VERSION = 32'h039300c9; //parallel - trying more ...-0.123/32 79.82%
// parameter FPGA_VERSION = 32'h039300c8; //parallel - trying to fix "premature..." -0.121/21, 80.2% // parameter FPGA_VERSION = 32'h039300c8; //parallel - trying to fix "premature..." -0.121/21, 80.2%
// parameter FPGA_VERSION = 32'h039300c7; //parallel - disable SoF when channel disabled: met, 80.32% // parameter FPGA_VERSION = 32'h039300c7; //parallel - disable SoF when channel disabled: met, 80.32%
// parameter FPGA_VERSION = 32'h039300c6; //parallel - same -0.132 /31, 80.73% // parameter FPGA_VERSION = 32'h039300c6; //parallel - same -0.132 /31, 80.73%
......
...@@ -61,10 +61,23 @@ ...@@ -61,10 +61,23 @@
// parameter SENSOR12BITS_NROWA = 1, // number of "blank rows" from last hact to end of vact // parameter SENSOR12BITS_NROWA = 1, // number of "blank rows" from last hact to end of vact
// parameter nAV = 24, //240; // clocks from ARO to VACT (actually from en_dclkd) // parameter nAV = 24, //240; // clocks from ARO to VACT (actually from en_dclkd)
// parameter SENSOR12BITS_NBPF = 20, //16; // bpf length // parameter SENSOR12BITS_NBPF = 20, //16; // bpf length
parameter SENSOR_IMAGE_TYPE0 = "RUN1", //"NORM", // "RUN1", "HIST_TEST"
parameter SENSOR_IMAGE_TYPE1 = "RUN1",
parameter SENSOR_IMAGE_TYPE2 = "NORM", // "RUN1", // "NORM", // "RUN1",
parameter SENSOR_IMAGE_TYPE3 = "NORM", // "RUN1", // parameter SENSOR_IMAGE_TYPE0 = "RUN1", //"NORM", // "RUN1", "HIST_TEST"
// parameter SENSOR_IMAGE_TYPE1 = "RUN1",
// parameter SENSOR_IMAGE_TYPE2 = "NORM", // "RUN1", // "NORM", // "RUN1",
// parameter SENSOR_IMAGE_TYPE3 = "NORM", // "RUN1",
// parameter SENSOR_IMAGE_TYPE0 = "NORM1",
// parameter SENSOR_IMAGE_TYPE1 = "NORM2",
// parameter SENSOR_IMAGE_TYPE2 = "NORM3",
// parameter SENSOR_IMAGE_TYPE3 = "NORM4",
parameter SENSOR_IMAGE_TYPE0 = "NORM1",
parameter SENSOR_IMAGE_TYPE1 = "NORM2",
parameter SENSOR_IMAGE_TYPE2 = "NORM3", // 4",
parameter SENSOR_IMAGE_TYPE3 = "NORM3",
parameter SIMULATE_CMPRS_CMODE0 = CMPRS_CBIT_CMODE_JPEG18, parameter SIMULATE_CMPRS_CMODE0 = CMPRS_CBIT_CMODE_JPEG18,
parameter SIMULATE_CMPRS_CMODE1 = CMPRS_CBIT_CMODE_JPEG18, parameter SIMULATE_CMPRS_CMODE1 = CMPRS_CBIT_CMODE_JPEG18,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2293,7 +2293,7 @@ set_logger_params_file "/home/eyesis/git/x393-neon/attic/imu_config.bin" ...@@ -2293,7 +2293,7 @@ set_logger_params_file "/home/eyesis/git/x393-neon/attic/imu_config.bin"
write_control_register 0x480 0x400 # disable sensor chn 2 ##### write_control_register 0x480 0x400 # disable sensor chn 2
......
...@@ -173,6 +173,14 @@ initial begin ...@@ -173,6 +173,14 @@ initial begin
if (SENSOR_IMAGE_TYPE == "NORM") $readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data); if (SENSOR_IMAGE_TYPE == "NORM") $readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "RUN1") $readmemh({`ROOTPATH,"/input_data/sensor_run1.dat"},sensor_data); else if (SENSOR_IMAGE_TYPE == "RUN1") $readmemh({`ROOTPATH,"/input_data/sensor_run1.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "HIST_TEST") $readmemh({`ROOTPATH,"/input_data/sensor_hist_test.dat"},sensor_data); else if (SENSOR_IMAGE_TYPE == "HIST_TEST") $readmemh({`ROOTPATH,"/input_data/sensor_hist_test.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM1") $readmemh({`ROOTPATH,"/input_data/sensor_01.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM2") $readmemh({`ROOTPATH,"/input_data/sensor_02.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM3") $readmemh({`ROOTPATH,"/input_data/sensor_03.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM4") $readmemh({`ROOTPATH,"/input_data/sensor_04.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM5") $readmemh({`ROOTPATH,"/input_data/sensor_05.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM6") $readmemh({`ROOTPATH,"/input_data/sensor_06.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM7") $readmemh({`ROOTPATH,"/input_data/sensor_07.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM8") $readmemh({`ROOTPATH,"/input_data/sensor_08.dat"},sensor_data);
else begin else begin
$display ("WARNING: Unrecognized sensor image :'%s', using default 'NORM': input_data/sensor.dat",SENSOR_IMAGE_TYPE); $display ("WARNING: Unrecognized sensor image :'%s', using default 'NORM': input_data/sensor.dat",SENSOR_IMAGE_TYPE);
$readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data); $readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data);
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment