Gowin Vol.3 第3部第2章 リスト5

`timescale 1ns / 1ps
`default_nettype none

module bayer_encoder #(
parameter int DATA_WIDTH = 10
)(
input wire clk,
input wire reset,

input wire vsync_i,
input wire de_i,
input wire [DATA_WIDTH-1:0] data_i,

output logic de_o,
output logic [DATA_WIDTH-1:0] data_r_o,
output logic [DATA_WIDTH-1:0] data_g_o,
output logic [DATA_WIDTH-1:0] data_b_o
);
logic de_w;

logic [DATA_WIDTH-1:0] data0_w;
logic [DATA_WIDTH-1:0] data1_w;
logic [DATA_WIDTH-1:0] data2_w;

logic de_r_o, de_g_o, de_b_o;
assign de_o = de_r_o;

linebuffer #(
.DATA_WIDTH(10),
.MAX_DATA_LENGTH(640)
)
linebuffer0
(
.clk(clk),

.vsync_i(vsync_i),
.de_i(de_i),
.data_i(data_i),

.de_o(de_w),
.data0_o(data0_w),
.data1_o(data1_w),
.data2_o(data2_w)
);

filter3x3
#(
.K00(0), .K10(1),
.K01(0), .K11(0)
)
filter3x3_R0 (
.clk(clk),

.vsync_i(vsync_i),
.de_i(de_w),
.data0_i(data0_w),
.data1_i(data1_w),
.data2_i(data2_w),
.de_o(de_r_o),
.data_o(data_r_o)
);

filter3x3
#(
.K00(1), .K10(0),
.K01(0), .K11(1)
)
filter3x3_G0 (
.clk(clk),

.vsync_i(vsync_i),
.de_i(de_w),
.data0_i(data0_w),
.data1_i(data1_w),
.data2_i(data2_w),
.de_o(de_g_o),
.data_o(data_g_o)
);

filter3x3
#(
.K00(0), .K10(0),
.K01(1), .K11(0)
)
filter3x3_B0 (
.clk(clk),

.vsync_i(vsync_i),
.de_i(de_w),
.data0_i(data0_w),
.data1_i(data1_w),
.data2_i(data2_w),

.de_o(de_b_o),
.data_o(data_b_o)
);

endmodule

`default_nettype wire