Add patent-style non-zero initial NEAR for first strip

This commit is contained in:
2026-04-17 09:13:56 +08:00
parent 2e06705c86
commit 50539f4abb
5 changed files with 93 additions and 74 deletions

View File

@@ -70,7 +70,8 @@ module tb_jls_near_ctrl;
rst = 1'b0;
// ratio=2 targets 1/4 of source bits. A 256-pixel 8-bit strip has
// 2048 source bits and 512 target bits.
// 2048 source bits and 512 target bits. The patent-inspired controller
// now starts the first strip from a non-zero initial NEAR for ratio=2.
@(posedge clk);
image_ratio = 4'd2;
image_start_valid = 1'b1;
@@ -84,7 +85,7 @@ module tb_jls_near_ctrl;
strip_done_valid = 1'b0;
@(posedge clk);
#1;
if (current_near !== 6'd4 || actual_bits_cumulative !== 48'd800 ||
if (current_near !== 8'd64 || actual_bits_cumulative !== 48'd800 ||
target_bits_cumulative !== 48'd512) begin
$fatal(1, "ratio=2 first strip update mismatch");
end
@@ -96,7 +97,7 @@ module tb_jls_near_ctrl;
strip_done_valid = 1'b0;
@(posedge clk);
#1;
if (current_near !== 6'd8 || actual_bits_cumulative !== 48'd1120 ||
if (current_near !== 8'd127 || actual_bits_cumulative !== 48'd1120 ||
target_bits_cumulative !== 48'd1024) begin
$fatal(1, "ratio=2 second strip update mismatch");
end
@@ -108,7 +109,7 @@ module tb_jls_near_ctrl;
strip_done_valid = 1'b0;
@(posedge clk);
#1;
if (current_near !== 6'd4 || actual_bits_cumulative !== 48'd1200 ||
if (current_near !== 8'd64 || actual_bits_cumulative !== 48'd1200 ||
target_bits_cumulative !== 48'd1536) begin
$fatal(1, "ratio=2 third strip update mismatch");
end

View File

@@ -32,7 +32,7 @@ module tb_jls_scan_ctrl;
logic image_last_pixel;
logic [12:0] active_pic_col;
logic [3:0] active_ratio;
logic [5:0] current_near;
logic [7:0] current_near;
// Forwarded encode pixel event.
logic enc_pixel_valid;
@@ -50,7 +50,7 @@ module tb_jls_scan_ctrl;
logic original_image_first_strip;
logic [12:0] strip_width;
logic [12:0] strip_height;
logic [5:0] strip_near;
logic [7:0] strip_near;
logic strip_finish_valid;
logic strip_finish_ready;
logic original_image_last_strip;
@@ -122,7 +122,7 @@ module tb_jls_scan_ctrl;
image_last_pixel = 1'b0;
active_pic_col = 13'd4;
active_ratio = 4'd2;
current_near = 6'd7;
current_near = 8'd7;
enc_pixel_ready = 1'b1;
strip_start_ready = 1'b1;
strip_finish_ready = 1'b1;
@@ -178,7 +178,7 @@ module tb_jls_scan_ctrl;
if (original_image_first_strip !== 1'b1) begin
$fatal(1, "original_image_first_strip should be high in this smoke");
end
if (strip_width !== 13'd4 || strip_height !== 13'd4 || strip_near !== 6'd0) begin
if (strip_width !== 13'd4 || strip_height !== 13'd4 || strip_near !== 8'd16) begin
$fatal(1, "strip start fields mismatch");
end
end