source: trunk/MultiChannelUSB/adc_lvds.v@ 103

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

replace fixed value with parameter in the int_data_next assignment

File size: 1.7 KB
RevLine 
[41]1module adc_lvds
[63]2 #(
3 parameter size = 3, // number of channels
4 parameter width = 12 // channel resolution
5 )
[41]6 (
[63]7 input wire lvds_dco,
8 input wire lvds_fco,
[72]9 input wire [size-1:0] lvds_d,
[41]10
[63]11 output wire [size*width-1:0] adc_data
[41]12 );
13
[63]14 wire [size-1:0] int_data_h, int_data_l;
15 reg [width-1:0] int_data_next [size-1:0];
[98]16// reg [2*width:0] int_data_next [size-1:0];
[63]17 reg [width-1:0] int_data_reg [size-1:0];
[98]18// reg [2*width:0] int_data_reg [size-1:0];
[41]19
[63]20 reg [width-1:0] int_adc_data [size-1:0];
21
22 integer i;
23 genvar j;
24
[41]25 altddio_in #(
26 .intended_device_family("Cyclone III"),
[42]27 .invert_input_clocks("ON"),
[98]28// .invert_input_clocks("OFF"),
[41]29 .lpm_type("altddio_in"),
[63]30 .width(size)) altddio_in_unit (
[41]31 .datain(lvds_d),
32 .inclock(lvds_dco),
33 .aclr(1'b0),
34 .dataout_h(int_data_h),
35 .dataout_l(int_data_l),
36 .aset(1'b0),
37 .inclocken(1'b1),
38 .sclr(1'b0),
39 .sset(1'b0));
40
41 always @ (posedge lvds_dco)
42 begin
[63]43 for (i = 0; i < size; i = i + 1)
44 begin
45 int_data_reg[i] <= int_data_next[i];
46 end
[42]47 end
[41]48
[42]49 always @ (posedge lvds_fco)
50 begin
[63]51 for (i = 0; i < size; i = i + 1)
52 begin
53 int_adc_data[i] <= int_data_next[i];
[98]54// int_data_next[i] = {int_data_reg[i][2*width-2:0], int_data_l[i], int_data_h[i]};
[63]55 end
[41]56 end
57
[42]58 always @*
59 begin
[63]60 for (i = 0; i < size; i = i + 1)
61 begin
[98]62 int_data_next[i] = {int_data_reg[i][width-3:0], int_data_l[i], int_data_h[i]};
63// int_data_next[i] = {int_data_reg[i][2*width-2:0], int_data_l[i], int_data_h[i]};
[63]64 end
[42]65 end
[41]66
[63]67 generate
[72]68 for (j = 0; j < size; j = j + 1)
[63]69 begin : ADC_LVDS_OUTPUT
70 assign adc_data[j*width+width-1:j*width] = int_adc_data[j];
71 end
72 endgenerate
73
[58]74endmodule
Note: See TracBrowser for help on using the repository browser.