-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop.v
108 lines (94 loc) · 1.94 KB
/
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
module TOP (
LEDS,
VCCINT_EN,
VCCAUX_EN,
VCCAUX_PG,
VCCAUXIO_EN,
VCCAUXIO_PG,
VCC_MGTA_EN,
VCC_MGTA_PG,
VTT_MGTA_EN,
VTT_MGTA_PG,
VCCO_34_EN,
VCCO_34_PG,
VCCO_32_EN,
VCCO_32_PG,
VCCO_16_13_EN,
VCCO_16_13_PG,
VCCO_12_EN,
VCCO_12_PG
);
output wire [3:0] LEDS;
output wire VCCINT_EN;
output wire VCCAUX_EN;
input wire VCCAUX_PG;
output wire VCCAUXIO_EN;
input wire VCCAUXIO_PG;
output wire VCC_MGTA_EN;
input wire VCC_MGTA_PG;
output wire VTT_MGTA_EN;
input wire VTT_MGTA_PG;
output wire VCCO_34_EN;
input wire VCCO_34_PG;
output wire VCCO_32_EN;
input wire VCCO_32_PG;
output wire VCCO_16_13_EN;
input wire VCCO_16_13_PG;
output wire VCCO_12_EN;
input wire VCCO_12_PG;
wire clk;
OSCH # (
.NOM_FREQ("2.08")) mainclk (
.STDBY(1'b0),
.OSC(clk),
.SEDSTDBY()
);
reg stage0 = 0;
wire stage0_pg;
reg stage1 = 0;
wire stage1_pg;
reg stage2 = 0;
wire stage2_pg;
reg stage3 = 0;
wire stage3_pg;
reg [14:0] counter = 15'h0;
always @ (posedge clk) begin
counter <= counter + 1'h1;
stage0 <= stage0;
stage1 <= stage1;
stage2 <= stage2;
if (counter[14] == 1) begin
counter <= 15'h0;
if (stage2 && stage2_pg && !stage3) begin
stage3 <= 1;
end else if (stage1 && stage1_pg && !stage2) begin
stage2 <= 1;
end else if (stage0 && stage0_pg && !stage1) begin
stage1 <= 1;
end else if (!stage0) begin
stage0 <= 1;
end
end
end
assign LEDS[0] = stage0_pg;
assign LEDS[1] = stage1_pg;
assign LEDS[2] = stage2_pg;
assign LEDS[3] = stage3_pg;
// STAGE 0
assign VCCINT_EN = stage0;
assign stage0_pg = 1;
// STAGE 1
assign VCCAUX_EN = stage1;
assign VCC_MGTA_EN = stage1;
assign stage1_pg = VCCAUX_PG && VCC_MGTA_PG;
// STAGE 2
assign VCCAUXIO_EN = stage2;
assign VTT_MGTA_EN = stage2;
assign stage2_pg = VCCAUXIO_PG && VTT_MGTA_PG;
// STAGE 3
assign VCCO_34_EN = stage3;
assign VCCO_32_EN = stage3;
assign VCCO_16_13_EN = stage3;
assign VCCO_12_EN = stage3;
assign stage3_pg = VCCO_34_PG && VCCO_32_PG && VCCO_16_13_PG && VCCO_12_PG;
endmodule