-
Notifications
You must be signed in to change notification settings - Fork 0
/
ADPLL_5_3.v
68 lines (49 loc) · 1.81 KB
/
ADPLL_5_3.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
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
module ADPLL_5_3(
//////////// CLOCK //////////
input CLOCK_50_B5B,
//////////// KEY //////////
input CPU_RESET_n,
input [3:0] KEY,
//////////// SW //////////
input [9:0] SW,
//////////// SEG7 //////////
output [6:0] HEX0,
output [6:0] HEX1,
//////////// GPIO, GPIO connect to GPIO Default //////////
inout [35:0] GPIO,
output Clock1,
output Clock2
);
//=======================================================
// REG/WIRE declarations
//=======================================================
wire [31:0] Control_Signal;
reg input_Clk;
wire C_INFO;
reg [31:0] counter = 0;
localparam CLOCK_DIVIDER = 200; //
//no function generator so we have to do this
always @(posedge CLOCK_50_B5B) begin
if (counter == (CLOCK_DIVIDER)) begin
input_Clk <= ~input_Clk; // invert the slow clock signal every 50 cycles
counter <= 0;
end else begin
counter <= counter + 1;
end
end
//assign input_Clk = GPIO[10];
assign C_INFO = SW[4];//Multiply frequency if 1 target if 0
//=======================================================
// Structural coding
//=======================================================
User_Input Unit2(CLOCK_50_B5B,CPU_RESET_n,KEY,SW,HEX0,HEX1,GPIO,Control_Signal);
ADPLL Unit1 (SW[0], SW[1], SW[2], ~CPU_RESET_n ,input_Clk,C_INFO,Control_Signal,CLOCK_50_B5B,Clock1,Clock2);
assign GPIO[4] = input_Clk; //orange
//assign GPIO[19] = (SW[3])? Clock2:Clock1;
assign GPIO[19] = Clock1; //white
assign GPIO[21] = Clock2; //yellow
//assign GPIO[2] = CLOCK_50_B5B;
endmodule