Line | |
---|
1 | module adc_fifo
|
---|
2 | (
|
---|
3 | input wire adc_clk,
|
---|
4 | input wire [11:0] adc_data,
|
---|
5 |
|
---|
6 | input wire aclr,
|
---|
7 | input wire rdclk,
|
---|
8 |
|
---|
9 | output wire ready,
|
---|
10 | output wire [11:0] raw_data,
|
---|
11 | output wire [13:0] uwt_data
|
---|
12 | );
|
---|
13 |
|
---|
14 | wire [31:0] uwt_d1, uwt_a1, uwt_peak1;
|
---|
15 | wire [31:0] uwt_d2, uwt_a2, uwt_peak2;
|
---|
16 | wire [31:0] uwt_d3, uwt_a3, uwt_peak3;
|
---|
17 | wire [1:0] uwt_flag1, uwt_flag2, uwt_flag3;
|
---|
18 |
|
---|
19 | wire [1:0] wrfull;
|
---|
20 |
|
---|
21 | reg state;
|
---|
22 | reg int_rdreq, int_ready;
|
---|
23 | wire int_rdempty;
|
---|
24 |
|
---|
25 | uwt_bior31 #(.L(1)) uwt_1_unit (
|
---|
26 | .clk(adc_clk),
|
---|
27 | .x({20'h00000, adc_data}),
|
---|
28 | .d(uwt_d1),
|
---|
29 | .a(uwt_a1),
|
---|
30 | .peak(uwt_peak1),
|
---|
31 | .flag(uwt_flag1));
|
---|
32 |
|
---|
33 | uwt_bior31 #(.L(2)) uwt_2_unit (
|
---|
34 | .clk(adc_clk),
|
---|
35 | .x(uwt_a1),
|
---|
36 | .d(uwt_d2),
|
---|
37 | .a(uwt_a2),
|
---|
38 | .peak(uwt_peak2),
|
---|
39 | .flag(uwt_flag2));
|
---|
40 |
|
---|
41 | uwt_bior31 #(.L(3)) uwt_3_unit (
|
---|
42 | .clk(adc_clk),
|
---|
43 | .x(uwt_a2),
|
---|
44 | .d(uwt_d3),
|
---|
45 | .a(uwt_a3),
|
---|
46 | .peak(uwt_peak3),
|
---|
47 | .flag(uwt_flag3));
|
---|
48 |
|
---|
49 |
|
---|
50 | fifo32x12 fifo0 (
|
---|
51 | .aclr(aclr),
|
---|
52 | .data(adc_data),
|
---|
53 | .rdclk(rdclk),
|
---|
54 | .rdreq(int_rdreq),
|
---|
55 | .wrclk(adc_clk),
|
---|
56 | .wrreq(~wrfull[0]),
|
---|
57 | .q(raw_data),
|
---|
58 | .rdempty(int_rdempty),
|
---|
59 | .wrfull(wrfull[0]));
|
---|
60 |
|
---|
61 | fifo32x14 fifo1 (
|
---|
62 | .aclr(aclr),
|
---|
63 | .data({uwt_flag3, uwt_peak3[11:0]}),
|
---|
64 | .rdclk(rdclk),
|
---|
65 | .rdreq(int_rdreq),
|
---|
66 | .wrclk(adc_clk),
|
---|
67 | .wrreq(~wrfull[1]),
|
---|
68 | .q(uwt_data),
|
---|
69 | .rdempty(),
|
---|
70 | .wrfull(wrfull[1]));
|
---|
71 |
|
---|
72 | always @ (posedge rdclk)
|
---|
73 | begin
|
---|
74 | case (state)
|
---|
75 | 1'b0:
|
---|
76 | begin
|
---|
77 | if (~int_rdempty)
|
---|
78 | begin
|
---|
79 | int_rdreq <= 1'b1;
|
---|
80 | int_ready <= 1'b1;
|
---|
81 | state <= 1'b1;
|
---|
82 | end
|
---|
83 | end
|
---|
84 |
|
---|
85 | 1'b1:
|
---|
86 | begin
|
---|
87 | int_rdreq <= 1'b0;
|
---|
88 | int_ready <= 1'b0;
|
---|
89 | state <= 1'b0;
|
---|
90 | end
|
---|
91 |
|
---|
92 | default:
|
---|
93 | begin
|
---|
94 | int_rdreq <= 1'b0;
|
---|
95 | int_ready <= 1'b0;
|
---|
96 | state <= 1'b0;
|
---|
97 | end
|
---|
98 | endcase
|
---|
99 | end
|
---|
100 |
|
---|
101 | assign ready = int_ready;
|
---|
102 |
|
---|
103 | endmodule
|
---|
Note:
See
TracBrowser
for help on using the repository browser.