-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimple_top.v
134 lines (118 loc) · 3.72 KB
/
simple_top.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
module ov5640_top(
// DDR Interface
output [12:0] DDR2_0_addr,
output [ 2:0] DDR2_0_ba,
output DDR2_0_cas_n,
output DDR2_0_ck_n,
output DDR2_0_ck_p,
output DDR2_0_cke,
output DDR2_0_cs_n,
output [ 1:0] DDR2_0_dm,
inout [15:0] DDR2_0_dq,
inout [ 1:0] DDR2_0_dqs_n,
inout [ 1:0] DDR2_0_dqs_p,
output DDR2_0_odt,
output DDR2_0_ras_n,
output DDR2_0_we_n,
// System clock and reset
input sys_clock,
input reset,
// VGA Interface
output [ 3:0] vga_blue,
output [ 3:0] vga_green,
output [ 3:0] vga_red,
output vga_hsync,
output vga_vsync,
// Camera Interface
input OV5640_PCLK,
output OV5640_XCLK,
input OV5640_VSYNC,
input OV5640_HREF,
input [ 7:0] OV5640_D,
output OV5640_RESET,
output OV5640_PWDN,
inout IIC_0_scl_io,
inout IIC_0_sda_io
);
////////////////////////////////////////////////////////////////////////////////
// Wires
////////////////////////////////////////////////////////////////////////////////
wire [ 3:0] frame_in_tkeep;
wire [31:0] frame_in_tdata;
wire [23:0] data_out;
wire frame_in_tlast;
wire frame_in_tready;
wire frame_in_tuser;
wire frame_in_tvalid;
wire [5:0] w_vga_green;
wire [5:0] w_vga_red;
wire [5:0] w_vga_blue;
////////////////////////////////////////////////////////////////////////////////
// Outputs
////////////////////////////////////////////////////////////////////////////////
// Force powerdown and reset to enable the camera
assign OV5640_RESET = 1'b1;
assign OV5640_PWDN = 1'b0;
// Output the top four bits per channel
assign vga_blue = w_vga_blue[5:2];
assign vga_red = w_vga_red[5:2];
assign vga_green = w_vga_green[5:2];
////////////////////////////////////////////////////////////////////////////////
// Instantiations
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////
// Primary Block Design
////////////////////////////////////////
design_1_wrapper (
.DDR2_0_addr (DDR2_0_addr),
.DDR2_0_ba (DDR2_0_ba),
.DDR2_0_cas_n (DDR2_0_cas_n),
.DDR2_0_ck_n (DDR2_0_ck_n),
.DDR2_0_ck_p (DDR2_0_ck_p),
.DDR2_0_cke (DDR2_0_cke),
.DDR2_0_cs_n (DDR2_0_cs_n),
.DDR2_0_dm (DDR2_0_dm),
.DDR2_0_dq (DDR2_0_dq),
.DDR2_0_dqs_n (DDR2_0_dqs_n),
.DDR2_0_dqs_p (DDR2_0_dqs_p),
.DDR2_0_odt (DDR2_0_odt),
.DDR2_0_ras_n (DDR2_0_ras_n),
.DDR2_0_we_n (DDR2_0_we_n),
.IIC_0_scl_io (IIC_0_scl_io),
.IIC_0_sda_io (IIC_0_sda_io),
.frame_in_tdata (frame_in_tdata),
.frame_in_tkeep (frame_in_tkeep),
.frame_in_tlast (frame_in_tlast),
.frame_in_tready(frame_in_tready),
.frame_in_tuser (frame_in_tuser),
.frame_in_tvalid(frame_in_tvalid),
.s2mm_fsync_0 (OV5640_VSYNC),
.pclk (OV5640_PCLK),
.reset (reset),
.sys_clock (sys_clock),
.vga_blue (w_vga_blue),
.vga_clk (),
.vga_de (),
.vga_dps (),
.vga_green (w_vga_green),
.vga_hsync (vga_hsync),
.vga_red (w_vga_red),
.vga_vsync (vga_vsync),
.xclk (OV5640_XCLK));
// Pack incoming pixels into 32-bits
assign frame_in_tdata = {8'b0, data_out};
assign frame_in_tkeep = 4'b1111;
assign frame_in_tuser = 4'b0001;
////////////////////////////////////////
// Capture Input from OV5640 Camera
////////////////////////////////////////
ov5640_capture capture(
.pclk (OV5640_PCLK),
.vsync (OV5640_VSYNC),
.href (OV5640_HREF),
.d (OV5640_D),
.dout (data_out),
.valid (frame_in_tvalid),
.last (frame_in_tlast)
);
endmodule