fix offset bug

This commit is contained in:
SikongJueluo
2024-05-18 21:10:17 +08:00
parent caa0588b9b
commit f9bd17b3de
4 changed files with 23 additions and 20 deletions

View File

@@ -20,7 +20,7 @@ module chanels_to_RGB #(
localparam SEND_DATA = 1;
reg [1:0] state, nextState;
reg [31:0] data_cal [2:0]; // 用于保存运算结果防止溢出
reg [15:0] data_cal [2:0]; // 用于保存运算结果防止溢出
reg fifo_en;
reg [3 * OUT_DEPTH - 1:0] fifo_in; // 输入fifo中缓存
wire fifo_empty, fifo_que;
@@ -56,9 +56,9 @@ module chanels_to_RGB #(
fifo_en <= 0;
if (in_en) begin
data_cal[0] <= data_in[0] * OUT_DEPTH / IN_DEPTH;
data_cal[1] <= data_in[1] * OUT_DEPTH / IN_DEPTH;
data_cal[2] <= data_in[2] * OUT_DEPTH / IN_DEPTH;
data_cal[0] <= data_in[0] >> (IN_DEPTH - OUT_DEPTH);
data_cal[1] <= data_in[1] >> (IN_DEPTH - OUT_DEPTH);
data_cal[2] <= data_in[2] >> (IN_DEPTH - OUT_DEPTH);
end
end