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