Changeset 63 for trunk/MultiChannelUSB/adc_lvds.v
- Timestamp:
- Sep 23, 2009, 9:46:50 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/adc_lvds.v
r58 r63 1 1 module adc_lvds 2 #( 3 parameter size = 3, // number of channels 4 parameter width = 12 // channel resolution 5 ) 2 6 ( 3 input wire lvds_dco,4 input wire lvds_fco,5 input wire [2:0] lvds_d,7 input wire lvds_dco, 8 input wire lvds_fco, 9 input wire [2:0] lvds_d, 6 10 7 output reg [11:0] adc_db, 8 output reg [11:0] adc_dc, 9 output reg [11:0] adc_dd 11 output wire [size*width-1:0] adc_data 10 12 ); 11 13 12 wire [2:0] int_data_h, int_data_l; 13 reg [11:0] int_data_next [2:0]; 14 reg [11:0] int_data_reg [2:0]; 14 wire [size-1:0] int_data_h, int_data_l; 15 reg [width-1:0] int_data_next [size-1:0]; 16 reg [width-1:0] int_data_reg [size-1:0]; 17 18 reg [width-1:0] int_adc_data [size-1:0]; 19 20 integer i; 21 genvar j; 15 22 16 23 altddio_in #( … … 18 25 .invert_input_clocks("ON"), 19 26 .lpm_type("altddio_in"), 20 .width( 3)) altddio_in_unit (27 .width(size)) altddio_in_unit ( 21 28 .datain(lvds_d), 22 29 .inclock(lvds_dco), … … 31 38 always @ (posedge lvds_dco) 32 39 begin 33 int_data_reg[0] <= int_data_next[0]; 34 int_data_reg[1] <= int_data_next[1]; 35 int_data_reg[2] <= int_data_next[2]; 40 for (i = 0; i < size; i = i + 1) 41 begin 42 int_data_reg[i] <= int_data_next[i]; 43 end 36 44 end 37 45 38 46 always @ (posedge lvds_fco) 39 47 begin 40 adc_db <= int_data_next[0]; 41 adc_dc <= int_data_next[1]; 42 adc_dd <= int_data_next[2]; 48 for (i = 0; i < size; i = i + 1) 49 begin 50 int_adc_data[i] <= int_data_next[i]; 51 end 43 52 end 44 53 45 54 always @* 46 55 begin 47 int_data_next[0] = {int_data_reg[0][9:0], int_data_l[0], int_data_h[0]}; 48 int_data_next[1] = {int_data_reg[1][9:0], int_data_l[1], int_data_h[1]}; 49 int_data_next[2] = {int_data_reg[2][9:0], int_data_l[2], int_data_h[2]}; 56 for (i = 0; i < size; i = i + 1) 57 begin 58 int_data_next[i] = {int_data_reg[i][9:0], int_data_l[i], int_data_h[i]}; 59 end 50 60 end 51 61 62 generate 63 for (j = 1; j < size; j = j + 1) 64 begin : ADC_LVDS_OUTPUT 65 assign adc_data[j*width+width-1:j*width] = int_adc_data[j]; 66 end 67 endgenerate 68 52 69 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.