fix some errors

This commit is contained in:
SikongJueluo 2024-05-16 17:33:39 +08:00
parent 74425d1c28
commit 5eebe6e922
No known key found for this signature in database
GPG Key ID: D2D3D29A993716EA
4 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,6 @@
module crop #(
parameter IN_WIDTH = 1936,
parameter IN_HEIGHT = 1088,
parameter OFFSET_X = 8,
parameter OFFSET_Y = 4,
parameter OUT_WIDTH = 640,
@ -64,9 +66,9 @@ module crop #(
end
end
if (cnt_x >= (OFFSET_X + OUT_WIDTH)) begin
if (cnt_x >= IN_WIDTH) begin
cnt_x <= 0;
if (cnt_y >= (OFFSET_Y + OUT_HEIGHT)) begin
if (cnt_y >= IN_HEIGHT) begin
cnt_y <= 0;
end
else begin

View File

@ -54,7 +54,7 @@ module chanels_to_RGB #(
case (state)
READ_DATA: begin
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;
@ -65,7 +65,7 @@ module chanels_to_RGB #(
SEND_DATA: begin
fifo_en <= 1;
fifo_in <= {data_cal[0][OUT_DEPTH - 1:0], data_cal[1][OUT_DEPTH - 1:0],data_cal[2][OUT_DEPTH - 1:0]};
fifo_in <= {data_cal[0][OUT_DEPTH - 1:0], data_cal[1][OUT_DEPTH - 1:0], data_cal[2][OUT_DEPTH - 1:0]};
end
endcase
end

2
isp.v
View File

@ -58,7 +58,7 @@ module isp #(
.clk(clk),
.reset(reset),
.in_en(rgb_en),
.data_in({im_red, im_green, im_blue}),
.data_in({im_blue, im_green, im_red}),
.out_que(scale_in_que),
.out_en(scale_in_en),

View File

@ -126,7 +126,7 @@ int sc_main(int argc, char* argv[]) {
for (int y = 0; y < IM_HEIGHT; y++) {
for (int x = 0; x < IM_WIDTH; x++) {
image[y * IM_WIDTH + x] = (uint16_t)buf[i] + ((uint16_t)buf[i + 1] << 8);
i++;
i += 2;
}
}
cout << "Finish Reading data" << endl;