Debian Codegraph @

examples/gw5a/clock-PLLA.v

raw
1 `default_nettype none
2 module clock_pll(input wire clk, input wire rst, output wire write_clk, output wire pixel_clk);
3 wire lock;
4 wire clkout1;
5 wire clkout2;
6 wire clkout3;
7 wire clkout4;
8 wire clkout5;
9 wire clkout6;
10 wire clkfbout;
11 wire [7:0] mdrdo;
12 wire gw_gnd;
13
14 assign gw_gnd = 1'b0;
15
16 PLLA PLLA_inst (
17 .LOCK(lock),
18 .CLKOUT0(pixel_clk),
19 .CLKOUT1(clkout1),
20 .CLKOUT2(clkout2),
21 .CLKOUT3(clkout3),
22 .CLKOUT4(clkout4),
23 .CLKOUT5(clkout5),
24 .CLKOUT6(clkout6),
25 .CLKFBOUT(clkfbout),
26 .MDRDO(mdrdo),
27 .CLKIN(clk),
28 .CLKFB(gw_gnd),
29 .RESET(!rst),
30 .PLLPWD(gw_gnd),
31 .RESET_I(gw_gnd),
32 .RESET_O(gw_gnd),
33 .PSSEL({gw_gnd,gw_gnd,gw_gnd}),
34 .PSDIR(gw_gnd),
35 .PSPULSE(gw_gnd),
36 .SSCPOL(gw_gnd),
37 .SSCON(gw_gnd),
38 .SSCMDSEL({gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd}),
39 .SSCMDSEL_FRAC({gw_gnd,gw_gnd,gw_gnd}),
40 .MDCLK(gw_gnd),
41 .MDOPC({gw_gnd,gw_gnd}),
42 .MDAINC(gw_gnd),
43 .MDWDI({gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd,gw_gnd})
44 );
45
46 defparam PLLA_inst.FCLKIN = `PLL_FCLKIN;
47 defparam PLLA_inst.IDIV_SEL = `PLL_IDIV_SEL_LCD;
48 defparam PLLA_inst.FBDIV_SEL = `PLL_FBDIV_SEL_LCD;
49 defparam PLLA_inst.ODIV0_SEL = `PLL_ODIV0_SEL;
50 defparam PLLA_inst.ODIV1_SEL = 8;
51 defparam PLLA_inst.ODIV2_SEL = 8;
52 defparam PLLA_inst.ODIV3_SEL = 8;
53 defparam PLLA_inst.ODIV4_SEL = 8;
54 defparam PLLA_inst.ODIV5_SEL = 8;
55 defparam PLLA_inst.ODIV6_SEL = 8;
56 defparam PLLA_inst.MDIV_SEL = 16;
57 defparam PLLA_inst.MDIV_FRAC_SEL = 0;
58 defparam PLLA_inst.ODIV0_FRAC_SEL = 0;
59 defparam PLLA_inst.CLKOUT0_EN = "TRUE";
60 defparam PLLA_inst.CLKOUT1_EN = "FALSE";
61 defparam PLLA_inst.CLKOUT2_EN = "FALSE";
62 defparam PLLA_inst.CLKOUT3_EN = "FALSE";
63 defparam PLLA_inst.CLKOUT4_EN = "FALSE";
64 defparam PLLA_inst.CLKOUT5_EN = "FALSE";
65 defparam PLLA_inst.CLKOUT6_EN = "FALSE";
66 defparam PLLA_inst.CLKFB_SEL = "INTERNAL";
67 defparam PLLA_inst.CLKOUT0_DT_DIR = 1'b1;
68 defparam PLLA_inst.CLKOUT1_DT_DIR = 1'b1;
69 defparam PLLA_inst.CLKOUT2_DT_DIR = 1'b1;
70 defparam PLLA_inst.CLKOUT3_DT_DIR = 1'b1;
71 defparam PLLA_inst.CLKOUT0_DT_STEP = 0;
72 defparam PLLA_inst.CLKOUT1_DT_STEP = 0;
73 defparam PLLA_inst.CLKOUT2_DT_STEP = 0;
74 defparam PLLA_inst.CLKOUT3_DT_STEP = 0;
75 defparam PLLA_inst.CLK0_IN_SEL = 1'b0;
76 defparam PLLA_inst.CLK0_OUT_SEL = 1'b0;
77 defparam PLLA_inst.CLK1_IN_SEL = 1'b0;
78 defparam PLLA_inst.CLK1_OUT_SEL = 1'b0;
79 defparam PLLA_inst.CLK2_IN_SEL = 1'b0;
80 defparam PLLA_inst.CLK2_OUT_SEL = 1'b0;
81 defparam PLLA_inst.CLK3_IN_SEL = 1'b0;
82 defparam PLLA_inst.CLK3_OUT_SEL = 1'b0;
83 defparam PLLA_inst.CLK4_IN_SEL = 2'b00;
84 defparam PLLA_inst.CLK4_OUT_SEL = 1'b0;
85 defparam PLLA_inst.CLK5_IN_SEL = 1'b0;
86 defparam PLLA_inst.CLK5_OUT_SEL = 1'b0;
87 defparam PLLA_inst.CLK6_IN_SEL = 1'b0;
88 defparam PLLA_inst.CLK6_OUT_SEL = 1'b0;
89 defparam PLLA_inst.DYN_DPA_EN = "FALSE";
90 defparam PLLA_inst.CLKOUT0_PE_COARSE = 0;
91 defparam PLLA_inst.CLKOUT0_PE_FINE = 0;
92 defparam PLLA_inst.CLKOUT1_PE_COARSE = 0;
93 defparam PLLA_inst.CLKOUT1_PE_FINE = 0;
94 defparam PLLA_inst.CLKOUT2_PE_COARSE = 0;
95 defparam PLLA_inst.CLKOUT2_PE_FINE = 0;
96 defparam PLLA_inst.CLKOUT3_PE_COARSE = 0;
97 defparam PLLA_inst.CLKOUT3_PE_FINE = 0;
98 defparam PLLA_inst.CLKOUT4_PE_COARSE = 0;
99 defparam PLLA_inst.CLKOUT4_PE_FINE = 0;
100 defparam PLLA_inst.CLKOUT5_PE_COARSE = 0;
101 defparam PLLA_inst.CLKOUT5_PE_FINE = 0;
102 defparam PLLA_inst.CLKOUT6_PE_COARSE = 0;
103 defparam PLLA_inst.CLKOUT6_PE_FINE = 0;
104 defparam PLLA_inst.DYN_PE0_SEL = "FALSE";
105 defparam PLLA_inst.DYN_PE1_SEL = "FALSE";
106 defparam PLLA_inst.DYN_PE2_SEL = "FALSE";
107 defparam PLLA_inst.DYN_PE3_SEL = "FALSE";
108 defparam PLLA_inst.DYN_PE4_SEL = "FALSE";
109 defparam PLLA_inst.DYN_PE5_SEL = "FALSE";
110 defparam PLLA_inst.DYN_PE6_SEL = "FALSE";
111 defparam PLLA_inst.DE0_EN = "FALSE";
112 defparam PLLA_inst.DE1_EN = "FALSE";
113 defparam PLLA_inst.DE2_EN = "FALSE";
114 defparam PLLA_inst.DE3_EN = "FALSE";
115 defparam PLLA_inst.DE4_EN = "FALSE";
116 defparam PLLA_inst.DE5_EN = "FALSE";
117 defparam PLLA_inst.DE6_EN = "FALSE";
118 defparam PLLA_inst.RESET_I_EN = "FALSE";
119 defparam PLLA_inst.RESET_O_EN = "FALSE";
120 defparam PLLA_inst.ICP_SEL = 6'bXXXXXX;
121 defparam PLLA_inst.LPF_RES = 3'bXXX;
122 defparam PLLA_inst.LPF_CAP = 2'b00;
123 defparam PLLA_inst.SSC_EN = "FALSE";
124
125 // ~70kHz for memory write
126 // temporary solution
127 localparam DIVIDER = 455;
128 reg [8:0] counter;
129 reg clk_div;
130 assign write_clk = |counter;
131
132 always @(negedge clk) begin
133 clk_div <= counter == 0;
134 end
135
136 always @(posedge clk or negedge rst) begin
137 if (!rst) begin
138 counter <= 0;
139 clk_div <= 0;
140 end else begin
141 if (counter == DIVIDER - 1) begin
142 counter <= 0;
143 end else begin
144 counter <= counter + 1;
145 end
146 end
147 end
148 endmodule
149 // vim: set et sw=4 ts=4: