-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathADC2UART_top.sv
177 lines (123 loc) · 2.94 KB
/
ADC2UART_top.sv
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
module ADC2UART_top(
input clk_50,
input delaySwitch,
input triggerSlopeSwitch,
input triggerSwitch,
output AD_SCLK,
output AD_SDIO,
input ADA_DCO,
output ADA_OE,
output ADA_SPI_CS,
input ADB_DCO,
output ADB_OE,
output ADB_SPI_CS,
input [13:0] ADC_DA,
input [13:0] ADC_DB,
output FPGA_CLK_A_N,
output FPGA_CLK_A_P,
output FPGA_CLK_B_N,
output FPGA_CLK_B_P,
output [6:0] hex0,
output [6:0] hex1,
output [6:0] hex2,
output [6:0] hex3,
output [3:0] led,
input UART_RX,
output UART_TX
);
assign ADA_OE = 1'b0;
assign ADB_OE = 1'b0;
assign AD_SCLK = 1'b0;
assign AD_SDIO = 1'b1;
assign ADA_SPI_CS = 1'b1;
assign ADB_SPI_CS = 1'b1;
wire reset_n;
wire sys_clk;
wire sys_clk_90deg;
wire sys_clk_180deg;
wire sys_clk_270deg;
wire pll_locked;
assign FPGA_CLK_A_P = sys_clk_180deg;
assign FPGA_CLK_A_N = ~sys_clk_180deg;
assign FPGA_CLK_B_P = sys_clk_270deg;
assign FPGA_CLK_B_N = ~sys_clk_270deg;
//assign reset_n = 1'b0;
wire acquire;
lpm_pll adc_pll(
.refclk(clk_50),
.outclk_0(sys_clk),
.outclk_1(sys_clk_90deg),
.outclk_2(sys_clk_180deg),
.outclk_3(sys_clk_270deg),
.locked(pll_locked),
.rst(acquire)
);
wire [13:0] ADC_A;
wire [13:0] ADC_B;
adcSync sync_a(
.sys_clk(sys_clk),
.DCO(ADA_DCO),
.ADCin(ADC_DA),
.ADCout(ADC_A)
);
adcSync sync_b(
.sys_clk(sys_clk),
.DCO(ADB_DCO),
.ADCin(ADC_DB),
.ADCout(ADC_B)
);
//------------------------------------------------------------------------------------------------
wire [13:0] waveform [1000];
wire [13:0] FIRwaveform[1000];
wire [15:0] waveNumber;
wire trigSlope;
wire trigSource;
wire delay;
ADC_handler ADC_handle(
.sys_clk(sys_clk),
.ADC_A(ADC_A),
.ADC_B(ADC_B),
.trigSlope(trigSlope),
.trigSource(trigSource),
.delay(delay),
//.acquire(acquire),
.waveform(waveform),
.waveNumber(waveNumber),
.FIRwaveform(FIRwaveform)
);
//------------------------------------------------------------------------------------------------
// UART control
wire delayUART;
wire trigSourceUART;
wire trigSlopeUART;
UART_handler UART_handle(
.clk_50(clk_50),
.UART_RX(UART_RX),
.UART_TX(UART_TX),
.waveNumber(waveNumber),
.waveform(waveform),
.FIRwaveform(FIRwaveform),
.delayUART(delayUART),
.trigSourceUART(trigSourceUART),
.trigSlopeUART(trigSlopeUART),
.acquire(acquire)
);
assign delay = delaySwitch || delayUART;
assign trigSlope = triggerSlopeSwitch || trigSlopeUART;
assign trigSource = triggerSwitch || trigSourceUART;
//------------------------------------------------------------------------------------------------
// seven segment counter control
bin2dec sevenSegCounter(
.clk(sys_clk),
.in(waveNumber),
.d1(hex0),
.d2(hex1),
.d3(hex2),
.d4(hex3)
);
tenCount legCounter(
.clk(sys_clk),
.in(waveNumber),
.out(led)
);
endmodule