Changeset 63
- Timestamp:
- Sep 23, 2009, 9:46:50 PM (15 years ago)
- Location:
- trunk/MultiChannelUSB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/Paella.v
r59 r63 7 7 inout wire [6:0] CON_A, 8 8 inout wire [15:0] CON_B, 9 in out wire [12:0] CON_C,9 input wire [12:0] CON_C, 10 10 input wire [1:0] CON_BCLK, 11 11 input wire [1:0] CON_CCLK, … … 51 51 assign CON_A = 7'bz; 52 52 assign CON_B = 16'bz; 53 assign CON_C = 13'bz;54 53 assign USB_PA0 = 1'bz; 55 54 assign USB_PA1 = 1'bz; … … 129 128 wire [1:0] uwt_flag [3:0]; 130 129 130 wire [16:0] osc_thrs [3:0]; 131 wire adc_pola [3:0]; 132 133 assign osc_thrs[0] = 16'd40; 134 assign osc_thrs[1] = 16'd300; 135 assign osc_thrs[2] = 16'd40; 136 assign osc_thrs[3] = 16'd1650; 137 138 assign adc_pola[0] = 1'b1; 139 assign adc_pola[1] = 1'b1; 140 assign adc_pola[2] = 1'b1; 141 assign adc_pola[3] = 1'b0; 142 131 143 assign adc_clk[0] = ADC_FCO; 132 144 assign adc_clk[1] = ADC_FCO; 133 145 assign adc_clk[2] = ADC_FCO; 134 135 assign adc_clk[3] = CON_B[0]; 136 assign adc_data[3] = CON_B[12:1]; 146 147 assign adc_clk[3] = ADC_FCO; 148 /* 149 assign adc_clk[3] = CON_CCLK[0]; 150 assign adc_data[3] = CON_C[11:0]; 151 */ 152 adc_para adc_para_unit ( 153 .lvds_dco(ADC_DCO), 154 .lvds_fco(ADC_FCO), 155 .para_data_ready(CON_CCLK[0]), 156 .para_data(CON_C[11:0]), 157 .adc_data(adc_data[3])); 158 137 159 /* 138 160 wire adc_pll_clk; … … 147 169 148 170 test test_unit( 149 . inclk0(CLK_50MHz),171 .clk(CLK_50MHz), 150 172 .tst_clk(tst_adc_clk), 151 173 .tst_data(tst_adc_data)); … … 168 190 */ 169 191 170 adc_lvds adc_lvds_unit ( 192 adc_lvds #( 193 .size(3), 194 .width(12)) adc_lvds_unit ( 171 195 .lvds_dco(ADC_DCO), 172 196 // .lvds_dco(adc_pll_clk), 173 197 .lvds_fco(ADC_FCO), 174 198 .lvds_d(ADC_D), 175 .adc_d b(adc_data[2]),176 .adc_dc(adc_data[1]),177 .adc_dd(adc_data[0]));199 .adc_data({ adc_data[0], 200 adc_data[1], 201 adc_data[2]})); 178 202 179 203 genvar i; 180 204 generate 181 for (i = 2; i < 4; i = i + 1)205 for (i = 1; i < 4; i = i + 1) 182 206 begin : MCA_CHAIN 183 207 adc_fifo adc_fifo_unit ( 184 208 .adc_clk(adc_clk[i]), 185 209 .adc_data(adc_data[i]), 210 .polarity(adc_pola[i]), 186 211 .clk(CLK_50MHz), 187 212 .ready(adc_data_ready[i]), … … 203 228 .reset(hst_reset[i]), 204 229 .data_ready(adc_data_ready[i]), 205 //.data(raw_data[i]),206 .data(uwt_data[i]),230 .data(raw_data[i]), 231 // .data(uwt_data[i]), 207 232 .address(hst_addr[i]), 208 233 .q(hst_q[i])); … … 222 247 .raw_data(raw_data[i]), 223 248 .uwt_data(uwt_data[i]), 224 .threshold( 16'd40),249 .threshold(osc_thrs[i]), 225 250 .address(osc_addr[i]), 226 251 .start_address(osc_start_addr[i]), -
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.