Last change
on this file since 84 was 84, checked in by demin, 15 years ago |
improve timings in all components
|
File size:
1.4 KB
|
Line | |
---|
1 | module adc_fifo
|
---|
2 | (
|
---|
3 | input wire adc_clk,
|
---|
4 | input wire [11:0] adc_data,
|
---|
5 |
|
---|
6 | input wire clk,
|
---|
7 | output wire data_ready,
|
---|
8 | output wire [11:0] data
|
---|
9 | );
|
---|
10 |
|
---|
11 | wire [11:0] int_q;
|
---|
12 | reg [11:0] int_data;
|
---|
13 |
|
---|
14 | reg [1:0] state;
|
---|
15 | reg int_rdreq, int_data_ready;
|
---|
16 | wire int_wrfull, int_rdempty;
|
---|
17 |
|
---|
18 | dcfifo #(
|
---|
19 | .intended_device_family("Cyclone III"),
|
---|
20 | .lpm_numwords(16),
|
---|
21 | .lpm_showahead("ON"),
|
---|
22 | .lpm_type("dcfifo"),
|
---|
23 | .lpm_width(12),
|
---|
24 | .lpm_widthu(4),
|
---|
25 | .rdsync_delaypipe(4),
|
---|
26 | .wrsync_delaypipe(4),
|
---|
27 | .overflow_checking("ON"),
|
---|
28 | .underflow_checking("ON"),
|
---|
29 | .use_eab("ON"),
|
---|
30 | .write_aclr_synch("OFF")) fifo_unit (
|
---|
31 | .aclr(1'b0),
|
---|
32 | .data(adc_data),
|
---|
33 | .rdclk(clk),
|
---|
34 | .rdreq((~int_rdempty) & int_rdreq),
|
---|
35 | .wrclk(adc_clk),
|
---|
36 | .wrreq(~int_wrfull),
|
---|
37 | .q(int_q),
|
---|
38 | .rdempty(int_rdempty),
|
---|
39 | .wrfull(int_wrfull),
|
---|
40 | .rdfull(),
|
---|
41 | .rdusedw(),
|
---|
42 | .wrempty(),
|
---|
43 | .wrusedw());
|
---|
44 |
|
---|
45 | always @(posedge clk)
|
---|
46 | begin
|
---|
47 | case (state)
|
---|
48 | 2'd0:
|
---|
49 | begin
|
---|
50 | int_rdreq <= 1'b1;
|
---|
51 | int_data_ready <= 1'b0;
|
---|
52 | state <= 2'd1;
|
---|
53 | end
|
---|
54 |
|
---|
55 | 2'd1:
|
---|
56 | begin
|
---|
57 | if (~int_rdempty)
|
---|
58 | begin
|
---|
59 | int_data <= int_q;
|
---|
60 | int_rdreq <= 1'b0;
|
---|
61 | int_data_ready <= 1'b1;
|
---|
62 | state <= 2'd0;
|
---|
63 | end
|
---|
64 | end
|
---|
65 |
|
---|
66 | 2'd2:
|
---|
67 | begin
|
---|
68 | int_data_ready <= 1'b0;
|
---|
69 | state <= 2'd3;
|
---|
70 | end
|
---|
71 |
|
---|
72 | 2'd3:
|
---|
73 | begin
|
---|
74 | state <= 2'd0;
|
---|
75 | end
|
---|
76 |
|
---|
77 | endcase
|
---|
78 | end
|
---|
79 |
|
---|
80 | assign data_ready = int_data_ready;
|
---|
81 | assign data = int_data;
|
---|
82 |
|
---|
83 | endmodule
|
---|
Note:
See
TracBrowser
for help on using the repository browser.