Skip to content

Commit

Permalink
Lint clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zephray committed Jan 22, 2024
1 parent a9ba6e1 commit 065aae1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion rtl/bayer_dithering.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
`default_nettype none
module bayer_dithering (
input wire clk,
input wire rst,
input wire [31:0] vin,
output reg [15:0] vout,
input wire [2:0] x_pos,
Expand Down
5 changes: 3 additions & 2 deletions rtl/blue_noise_dithering.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
`default_nettype none
module blue_noise_dithering (
input wire clk,
input wire rst,
input wire [31:0] vin,
output reg [15:0] vout,
input wire [3:0] x_pos,
input wire [5:0] y_pos
);
parameter COLORMODE = "DES";

wire [15:0] vo_dithered;
wire [7:0] b0, b1, b2, b3;
/* verilator lint_off UNUSEDSIGNAL */
// Lower 4 bits are not used
wire [7:0] c0, c1, c2, c3;
/* verilator lint_on UNUSEDSIGNAL */

wire [9:0] addr_hi = {y_pos, x_pos};

Expand Down
11 changes: 9 additions & 2 deletions rtl/caster.v
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ module caster(
output wire [10:0] dbg_scan_h_cnt
);

/* verilator lint_off UNUSEDPARAM */
// Only used if bayer dithering is selected
parameter COLORMODE = "MONO";
/* verilator lint_on UNUSEDPARAM */

// Screen timing
parameter SIMULATION = "TRUE";
Expand All @@ -71,7 +74,9 @@ module caster(
localparam SCAN_WAITING = 2'd1;
localparam SCAN_RUNNING = 2'd2;

/* verilator lint_off WIDTH */
localparam OP_INIT_LENGTH = (SIMULATION == "FALSE") ? 255 : 2;
/* verilator lint_on WIDTH */

// Internal design specific
localparam VS_DELAY = 8; // wait 8 clocks after VS is vaild
Expand Down Expand Up @@ -357,6 +362,9 @@ module caster(

// Image dithering
wire [15:0] s2_pixel_ordered_dithered;

`ifndef USE_BLUE_NOISE
// Position for bayer dithering
wire [2:0] x_pos;
wire [2:0] y_pos;

Expand Down Expand Up @@ -397,6 +405,7 @@ module caster(
assign y_pos = scan_v_cnt[2:0];
end
endgenerate
`endif

// Degamma
wire [31:0] s2_pixel_linear;
Expand All @@ -413,7 +422,6 @@ module caster(
`ifdef USE_BLUE_NOISE
blue_noise_dithering blue_noise_dithering (
.clk(clk),
.rst(rst),
.vin(s2_pixel_linear),
.vout(s2_pixel_ordered_dithered),
.x_pos(scan_h_cnt[3:0]),
Expand All @@ -424,7 +432,6 @@ module caster(
.COLORMODE(COLORMODE)
) bayer_dithering (
.clk(clk),
.rst(rst),
.vin(s2_pixel_linear),
.vout(s2_pixel_ordered_dithered),
.x_pos(x_pos),
Expand Down
6 changes: 5 additions & 1 deletion rtl/error_diffusion_kernel.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright Modos / Wenting Zhang 2023
// Copyright Modos / Wenting Zhang 2024
//
// This source describes Open Hardware and is licensed under the CERN-OHL-P v2
//
Expand Down Expand Up @@ -35,8 +35,10 @@ module error_diffusion_kernel #(
);

// Add input pixel with error
/* verilator lint_off UNUSEDSIGNAL */
wire [ERROR_BITS+1-1:0] err_adder =
$signed(err_left_in) + $signed(err_line_buffer_in);
/* verilator lint_on UNUSEDSIGNAL */
wire [ERROR_BITS+1-1:0] pix_adder =
$signed({{(ERROR_BITS-INPUT_BITS+1){1'b0}}, pixel_in}) +
$signed(err_adder[ERROR_BITS+1-1:1]);
Expand Down Expand Up @@ -78,10 +80,12 @@ module error_diffusion_kernel #(
$signed(pix_adder) - $signed({2'b0, pix_qlinear});

// Distribute error
/* verilator lint_off UNUSEDSIGNAL */
wire [ERROR_BITS+4-1:0] err_r_mult = $signed(quant_err) * 8;
wire [ERROR_BITS+4-1:0] err_bl_mult = $signed(quant_err) * 3;
wire [ERROR_BITS+4-1:0] err_b_mult = $signed(quant_err) * 4;
wire [ERROR_BITS+4-1:0] err_br_mult = $signed(quant_err) * 1;
/* verilator lint_on UNUSEDSIGNAL */
// Divide only by 8 (instead of 16) to get 10p1 fixed point format
wire [ERROR_BITS+1-1:0] err_r_div = err_r_mult[ERROR_BITS+4-1:3];
wire [ERROR_BITS+1-1:0] err_bl_div = err_bl_mult[ERROR_BITS+4-1:3];
Expand Down
3 changes: 2 additions & 1 deletion sim/rtl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ else
VERILATOR := $(VERILATOR_ROOT)/bin/verilator
endif
VFLAGS := -Wall -Wno-fatal -MMD --trace -cc \
-I../rtl
-I../rtl \
-Wno-PINCONNECTEMPTY
ifeq ($(VERBOSE), 1)
VFLAGS += +define+VERBOSE=1
endif
Expand Down

0 comments on commit 065aae1

Please sign in to comment.