-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop.v
64 lines (51 loc) · 983 Bytes
/
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
module top(
input clk,
input resetn,
output tmds_clk_n,
output tmds_clk_p,
output [2:0] tmds_d_n,
output [2:0] tmds_d_p
);
Gowin_rPLL u_pll (
.clkin(clk),
.clkout(clk_p5),
.lock(pll_lock)
);
Gowin_CLKDIV u_div_5 (
.clkout(clk_p),
.hclkin(clk_p5),
.resetn(pll_lock)
);
Reset_Sync u_Reset_Sync (
.resetn(sys_resetn),
.ext_reset(resetn & pll_lock),
.clk(clk_p)
);
svo_hdmi svo_hdmi_inst (
.clk(clk_p),
.resetn(sys_resetn),
// video clocks
.clk_pixel(clk_p),
.clk_5x_pixel(clk_p5),
.locked(pll_lock),
// output signals
.tmds_clk_n(tmds_clk_n),
.tmds_clk_p(tmds_clk_p),
.tmds_d_n(tmds_d_n),
.tmds_d_p(tmds_d_p)
);
endmodule
module Reset_Sync (
input clk,
input ext_reset,
output resetn
);
reg [3:0] reset_cnt = 0;
always @(posedge clk or negedge ext_reset) begin
if (~ext_reset)
reset_cnt <= 4'b0;
else
reset_cnt <= reset_cnt + !resetn;
end
assign resetn = &reset_cnt;
endmodule