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