ISP/isp.v

98 lines
2.3 KiB
Coq
Raw Normal View History

2024-05-09 22:56:32 +08:00
`timescale 1ns/1ps
module isp #(
2024-05-10 20:13:58 +08:00
parameter IN_WIDTH = 1936,
parameter IN_HEIGHT = 1088,
parameter OUT_WIDTH = 640,
parameter OUT_HEIGHT = 480,
parameter COLOR_DEPTH = 8,
2024-05-10 20:13:58 +08:00
parameter RAW_TYPE = 3 // 0:grbg 1:rggb 2:bggr 3:gbrg
2024-05-09 22:56:32 +08:00
) (
2024-05-10 20:13:58 +08:00
// 基本信号
input wire clk,
input wire reset,
2024-05-09 23:23:23 +08:00
2024-05-10 20:13:58 +08:00
// 数据输入信号
input wire data_en,
input reg [15:0] data_in [2:0], // 数据输入线012分别表示第一三行
2024-05-10 20:13:58 +08:00
output reg data_que, // 数据请求线高电平请求三个数据直到读取完才拉低
output wire out_clk,
output wire out_en,
output reg [3 * COLOR_DEPTH - 1:0] data_out
2024-05-09 22:56:32 +08:00
);
2024-05-11 21:53:35 +08:00
// 三通道合成RGB图像
wire rgb_en;
2024-05-15 16:43:41 +08:00
wire [15:0] im_red, im_green, im_blue;
2024-05-10 20:13:58 +08:00
2024-05-11 21:53:35 +08:00
// 任意比例缩放图像
2024-05-13 16:52:13 +08:00
reg scale_in_en;
2024-05-11 21:53:35 +08:00
wire scale_in_que; // scaler 请求数据
2024-05-13 16:52:13 +08:00
reg [3 * COLOR_DEPTH - 1:0] scale_in_data;
2024-05-11 21:53:35 +08:00
2024-05-13 10:49:15 +08:00
// 写入RAM
2024-05-14 21:25:59 +08:00
// wire RAM_in_en;
// wire RAM_in_que; // RAM 请求数据
// wire [3 * COLOR_DEPTH - 1:0] RAM_in_data;
2024-05-13 10:49:15 +08:00
always @(clk)
out_clk <= clk;
2024-05-14 21:00:19 +08:00
2024-05-11 21:53:35 +08:00
demosaic2 #(
2024-05-15 16:43:41 +08:00
.IM_WIDTH(IN_WIDTH),
.IM_HEIGHT(IN_HEIGHT),
.RAW_TYPE(RAW_TYPE)
2024-05-11 21:53:35 +08:00
) CFA (
2024-05-10 20:13:58 +08:00
.clk(clk),
.reset(reset),
.data_en(data_en),
.data_in(data_in),
.data_que(data_que),
2024-05-11 21:53:35 +08:00
.out_en(rgb_en),
.out_r(im_red),
.out_g(im_green),
.out_b(im_blue)
);
chanels_to_RGB merge_toRGB(
.clk(clk),
.reset(reset),
.in_en(rgb_en),
2024-05-16 17:33:39 +08:00
.data_in({im_blue, im_green, im_red}),
2024-05-11 21:53:35 +08:00
.out_que(scale_in_que),
2024-05-13 11:29:03 +08:00
.out_en(scale_in_en),
2024-05-11 21:53:35 +08:00
.data_out(scale_in_data)
);
crop #(
.OUT_WIDTH(OUT_WIDTH),
.OUT_HEIGHT(OUT_HEIGHT),
.COLOR_DEPTH(COLOR_DEPTH)
) crop_process (
2024-05-13 10:49:15 +08:00
.clk(clk),
.reset(reset),
2024-05-13 16:52:13 +08:00
.in_en(scale_in_en),
.in_que(scale_in_que),
2024-05-13 10:49:15 +08:00
.data_in(scale_in_data),
2024-05-14 21:25:59 +08:00
.out_en(out_en),
.data_out(data_out)
2024-05-13 10:49:15 +08:00
);
2024-05-14 21:00:19 +08:00
// RGB_to_RAM write_to_RAM (
// .clk(clk),
// .reset(reset),
2024-05-12 22:09:23 +08:00
2024-05-14 21:00:19 +08:00
// .in_en(RAM_in_en),
// .in_que(RAM_in_que),
// .data_in(RAM_in_data),
2024-05-11 21:53:35 +08:00
2024-05-14 21:00:19 +08:00
// .write_que(out_que),
// .write_en(out_en),
// .data_write(data_out)
// );
2024-05-09 22:56:32 +08:00
2024-05-10 21:41:47 +08:00
endmodule