source: trunk/MultiChannelUSB/adc_lvds.v@ 41

Last change on this file since 41 was 41, checked in by demin, 15 years ago

add one real ADC channel

File size: 1.2 KB
Line 
1module adc_lvds
2 (
3 input wire lvds_dco,
4 input wire lvds_fco,
5 input wire [2:0] lvds_d,
6
7 output wire adc_clk,
8 output wire [11:0] adc_db,
9 output wire [11:0] adc_dc,
10 output wire [11:0] adc_dd
11 );
12
13
14 wire [2:0] int_data_h, int_data_l;
15 reg [11:0] int_data_sr [2:0];
16 reg [11:0] int_data [2:0];
17 reg int_fco;
18
19 integer i;
20
21 altddio_in #(
22 .intended_device_family("Cyclone III"),
23 .invert_input_clocks("OFF"),
24 .lpm_type("altddio_in"),
25 .width(3)) altddio_in_unit (
26 .datain(lvds_d),
27 .inclock(lvds_dco),
28 .aclr(1'b0),
29 .dataout_h(int_data_h),
30 .dataout_l(int_data_l),
31 .aset(1'b0),
32 .inclocken(1'b1),
33 .sclr(1'b0),
34 .sset(1'b0));
35
36 always @ (posedge lvds_dco)
37 begin
38 for(i = 0; i < 3; i = i + 1)
39 begin
40 int_data_sr[i] <= {int_data_sr[i][9:0], int_data_h[i], int_data_l[i]};
41 end
42
43 // one clock delay for FCO
44 int_fco <= lvds_fco;
45
46 if((lvds_fco) & (~int_fco))
47 begin
48 for(i = 0; i < 3; i = i + 1)
49 begin
50 int_data[i] <= {int_data_sr[i][9:0], int_data_h[i], int_data_l[i]};
51 end
52 end
53 end
54
55 assign adc_clk = int_fco;
56 assign adc_db = int_data[0];
57 assign adc_dc = int_data[1];
58 assign adc_dd = int_data[2];
59
60endmodule
Note: See TracBrowser for help on using the repository browser.