Changeset 107 for sandbox/MultiChannelUSB
- Timestamp:
- Jan 17, 2011, 5:56:35 PM (14 years ago)
- Location:
- sandbox/MultiChannelUSB
- Files:
-
- 9 added
- 6 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/MultiChannelUSB/Paella.qsf
r101 r107 42 42 set_global_assignment -name ORIGINAL_QUARTUS_VERSION 9.0 43 43 set_global_assignment -name PROJECT_CREATION_TIME_DATE "14:14:14 AUGUST 28, 2009" 44 set_global_assignment -name LAST_QUARTUS_VERSION 9.044 set_global_assignment -name LAST_QUARTUS_VERSION "9.1 SP2" 45 45 set_global_assignment -name DEVICE_FILTER_PACKAGE "ANY QFP" 46 46 set_global_assignment -name DEVICE_FILTER_PIN_COUNT 240 … … 49 49 set_global_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION OFF 50 50 set_global_assignment -name MISC_FILE Paella.dpf 51 set_global_assignment -name MISC_FILE "C:/altera/project_12/Paella.dpf" 52 set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top 53 set_global_assignment -name VERILOG_FILE cic_pipeline.v 54 set_global_assignment -name VERILOG_FILE cic_filter.v 51 55 set_global_assignment -name VERILOG_FILE Paella.v 52 set_global_assignment -name VERILOG_FILE adc_fifo.v53 56 set_global_assignment -name VERILOG_FILE adc_lvds.v 54 set_global_assignment -name VERILOG_FILE adc_para.v 55 set_global_assignment -name VERILOG_FILE adc_pll.v 57 set_global_assignment -name VERILOG_FILE sys_pll.v 56 58 set_global_assignment -name VERILOG_FILE control.v 59 set_global_assignment -name VERILOG_FILE uwt_bior31.v 57 60 set_global_assignment -name VERILOG_FILE analyser.v 61 set_global_assignment -name VERILOG_FILE amplitude.v 62 set_global_assignment -name VERILOG_FILE delay.v 63 set_global_assignment -name VERILOG_FILE coincidence.v 58 64 set_global_assignment -name VERILOG_FILE counter.v 59 set_global_assignment -name VERILOG_FILE histogram.v 65 set_global_assignment -name VERILOG_FILE histogram32.v 66 set_global_assignment -name VERILOG_FILE histogram16.v 60 67 set_global_assignment -name VERILOG_FILE trigger.v 61 68 set_global_assignment -name VERILOG_FILE oscilloscope.v … … 63 70 set_global_assignment -name VERILOG_FILE usb_fifo.v 64 71 set_global_assignment -name VERILOG_FILE i2c_fifo.v 65 set_global_assignment -name VERILOG_FILE uwt_bior31.v66 72 set_global_assignment -name VERILOG_FILE test.v 67 set_global_assignment -name VERILOG_FILE test_pll.v 68 set_global_assignment -name VERILOG_FILE sys_pll.v 73 set_global_assignment -name MIF_FILE test.mif 69 74 set_global_assignment -name USE_TIMEQUEST_TIMING_ANALYZER OFF 70 75 set_global_assignment -name ENABLE_CLOCK_LATENCY ON -
sandbox/MultiChannelUSB/Paella.v
r101 r107 83 83 usb_fifo usb_unit 84 84 ( 85 .usb_cl k(USB_IFCLK),85 .usb_clock(USB_IFCLK), 86 86 .usb_data(USB_PB), 87 87 .usb_full(~USB_FLAGB), … … 93 93 .usb_addr(usb_addr), 94 94 95 .cl k(sys_clock),95 .clock(sys_clock), 96 96 97 97 .tx_full(usb_tx_full), … … 104 104 ); 105 105 106 wire [11:0] osc_mux_data [4:0]; 107 108 wire [11:0] trg_mux_data; 109 wire trg_flag; 110 111 wire [2:0] coi_data; 112 wire coi_flag; 113 114 wire [7*12-1:0] int_mux_data [N-1:0]; 115 106 116 wire ana_dead [N-1:0]; 107 117 wire ana_good [N-1:0]; … … 109 119 wire [11:0] ana_base [N-1:0]; 110 120 121 wire amp_good [N-1:0]; 122 wire [11:0] amp_data [N-1:0]; 123 111 124 wire cnt_good [N-1:0]; 112 113 wire [11:0] osc_mux_data [N-1:0]; 114 115 wire [11:0] trg_mux_data; 116 wire trg_flag; 117 118 wire [83:0] int_mux_data [N-1:0]; 125 wire [15:0] cnt_bits_wire; 119 126 120 127 wire sys_clock, sys_frame; 121 128 122 wire [11:0] adc_data [N-1:0]; 123 wire [11:0] int_data [N-1:0]; 129 wire [11:0] adc_data [N-1:0]; 124 130 wire [11:0] sys_data [N-1:0]; 131 wire [11:0] tst_data; 132 125 133 wire [11:0] cmp_data; 126 wire [11:0] nowhere;134 wire [11:0] del_data; 127 135 128 136 wire [31:0] uwt_d1 [N-1:0]; 129 137 wire [31:0] uwt_a1 [N-1:0]; 130 wire [31:0] uwt_peak1 [N-1:0];131 138 wire [31:0] uwt_d2 [N-1:0]; 132 139 wire [31:0] uwt_a2 [N-1:0]; 133 wire [31:0] uwt_peak2 [N-1:0];134 140 wire [31:0] uwt_d3 [N-1:0]; 135 141 wire [31:0] uwt_a3 [N-1:0]; 136 wire [31:0] uwt_peak3 [N-1:0];137 142 138 143 wire [1:0] uwt_flag1 [N-1:0]; … … 140 145 wire [1:0] uwt_flag3 [N-1:0]; 141 146 147 wire [11:0] cic_mux_data; 148 wire [13:0] cic_lfsr; 149 wire [24:0] cic_data1 [N-1:0]; 150 wire [24:0] cic_data2 [N-1:0]; 151 wire [24:0] cic_data3 [N-1:0]; 152 142 153 wire i2c_reset; 143 144 /*145 adc_para adc_para_unit (146 .lvds_dco(ADC_DCO),147 .lvds_fco(ADC_FCO),148 .para_good(CON_CCLK[0]),149 .para_data(CON_C[11:0]),150 .adc_data(adc_data[2]));151 */152 153 wire adc_pll_clk;154 155 /*156 adc_pll adc_pll_unit(157 .inclk0(ADC_FCO),158 .c0(adc_pll_clk));159 */160 154 161 155 sys_pll sys_pll_unit( … … 164 158 165 159 test test_unit( 166 .clk(ADC_FCO), 167 .data(adc_data[2])); 168 // .data(nowhere)); 160 .clock(ADC_FCO), 161 .data(tst_data)); 169 162 170 163 adc_lvds #( 171 164 .size(3), 172 165 .width(12)) adc_lvds_unit ( 166 .clock(sys_clock), 173 167 .lvds_dco(ADC_DCO), 174 // .lvds_dco(adc_pll_clk),175 168 .lvds_fco(ADC_FCO), 176 .lvds_d(ADC_D[2:0]), 177 // .adc_data({ adc_data[2], 178 .adc_data({ nowhere, 179 adc_data[1], 180 adc_data[0] })); 181 182 /* 183 assign cmp_data = CON_B[11:0]; 184 assign sys_clock = ADC_DCO; 185 assign sys_frame = ADC_FCO; 186 */ 169 .lvds_d(ADC_D), 170 .test(tst_data), 171 .trig({CON_B[9:0], TRG[1:0]}), 172 .adc_frame(sys_frame), 173 .adc_data({cmp_data, adc_data[2], adc_data[1], adc_data[0]})); 187 174 188 175 wire [15:0] cfg_bits [31:0]; 189 176 wire [511:0] int_cfg_bits; 190 177 191 wire [3 1:0] cfg_mux_selector;178 wire [39:0] cfg_mux_selector; 192 179 193 180 wire cfg_reset; 194 181 195 wire [ 8:0] bus_ssel;182 wire [11:0] bus_ssel; 196 183 wire bus_wren; 197 184 wire [31:0] bus_addr; 198 185 wire [15:0] bus_mosi; 199 wire [15:0] bus_miso [ 7:0];200 wire [ 8:0] bus_busy;186 wire [15:0] bus_miso [10:0]; 187 wire [11:0] bus_busy; 201 188 202 189 wire [15:0] mrg_bus_miso; 203 190 wire mrg_bus_busy; 204 191 205 wire [1 27:0] int_bus_miso;192 wire [11*16-1:0] int_bus_miso; 206 193 207 194 genvar j; … … 229 216 begin : MUX_DATA 230 217 assign int_mux_data[j] = { 231 {ana_good[j], 11'd0}, 232 ana_data[j], 233 ana_base[j], 234 uwt_a3[j][20:9], 235 uwt_a2[j][17:6], 236 uwt_a1[j][14:3], 218 {4'd0, uwt_flag3[j][1], 7'd0}, 219 {4'd0, uwt_flag3[j][0], 7'd0}, 220 {12'd0}, 221 // {4'd0, amp_good[j], 7'd0}, 222 cic_data1[j][14:3], 223 cic_data2[j][18:7], 224 cic_data3[j][22:11], 225 // {8'd0, cic_lfsr[3:0]}, 226 // {8'd0, cic_lfsr[5:2]}, 227 // uwt_a3[j][20:9], 237 228 sys_data[j]}; 238 229 end 239 230 endgenerate 240 231 241 assign cfg_mux_selector = {cfg_bits[ 3], cfg_bits[2]};232 assign cfg_mux_selector = {cfg_bits[4][7:0], cfg_bits[3], cfg_bits[2]}; 242 233 243 234 lpm_mux #( 244 .lpm_size( 21),235 .lpm_size(7*3), 245 236 .lpm_type("LPM_MUX"), 246 237 .lpm_width(12), 247 238 .lpm_widths(5)) trg_mux_unit ( 248 .sel(cfg_ mux_selector[28:24]),239 .sel(cfg_bits[4][12:8]), 249 240 .data({int_mux_data[2], int_mux_data[1], int_mux_data[0]}), 250 241 .result(trg_mux_data)); 251 242 252 243 generate 253 for (j = 0; j < 3; j = j + 1)244 for (j = 0; j < 5; j = j + 1) 254 245 begin : OSC_CHAIN 255 246 256 247 lpm_mux #( 257 .lpm_size( 21),248 .lpm_size(7*3), 258 249 .lpm_type("LPM_MUX"), 259 250 .lpm_width(12), … … 278 269 .frame(sys_frame), 279 270 .reset(cfg_bits[0][1]), 280 .cfg_data(cfg_bits[ 4][0]),271 .cfg_data(cfg_bits[5][12]), 281 272 .trg_flag(trg_flag), 282 .osc_data({cmp_data , osc_mux_data[2], osc_mux_data[1], osc_mux_data[0]}),273 .osc_data({cmp_data[3:0], osc_mux_data[4], osc_mux_data[3], osc_mux_data[2], osc_mux_data[1], osc_mux_data[0]}), 283 274 .ram_wren(RAM_WE), 284 275 .ram_addr(RAM_ADDR), … … 291 282 .bus_busy(bus_busy[1])); 292 283 293 294 adc_fifo #(.W(48)) adc_fifo_unit (295 . adc_clock(ADC_FCO),296 . adc_data({CON_B[11:0], adc_data[2], adc_data[1], adc_data[0]}),297 . sys_clock(sys_clock),298 . sys_frame(sys_frame),299 . sys_data({cmp_data, int_data[2], int_data[1], int_data[0]}));300 301 284 cic1 #(.size(3), .width(12)) cic3_unit ( 285 .clock(sys_clock), 286 .frame(sys_frame), 287 .reset(1'b0), 288 .inp_data({sys_data[2], sys_data[1], sys_data[0]}), 289 .out_data2({cic_data2[2], cic_data2[1], cic_data2[0]}), 290 .out_data3({cic_data3[2], cic_data3[1], cic_data3[0]}), 291 .out_data({cic_data1[2], cic_data1[1], cic_data1[0]})); 292 302 293 generate 303 294 for (j = 0; j < 3; j = j + 1) 304 295 begin : MCA_CHAIN 305 296 306 assign sys_data[j] = (cfg_bits[1][4*j]) ? ( int_data[j] ^ 12'hfff) : (int_data[j]);297 assign sys_data[j] = (cfg_bits[1][4*j]) ? (adc_data[j] ^ 12'hfff) : (adc_data[j]); 307 298 308 299 uwt_bior31 #(.L(1)) uwt_1_unit ( … … 313 304 .d(uwt_d1[j]), 314 305 .a(uwt_a1[j]), 315 .peak(uwt_peak1[j]),316 306 .flag(uwt_flag1[j])); 317 307 … … 323 313 .d(uwt_d2[j]), 324 314 .a(uwt_a2[j]), 325 .peak(uwt_peak2[j]),326 315 .flag(uwt_flag2[j])); 327 316 … … 333 322 .d(uwt_d3[j]), 334 323 .a(uwt_a3[j]), 335 .peak(uwt_peak3[j]),336 324 .flag(uwt_flag3[j])); 337 325 … … 341 329 .reset(cfg_bits[0][2+j]), 342 330 .cfg_data({cfg_bits[7+2*j][12:0], cfg_bits[6+2*j][11:0]}), 343 .uwt_flag(uwt_flag 3[j]),344 .uwt_data(uwt_ peak3[j]),331 .uwt_flag(uwt_flag2[j]), 332 .uwt_data(uwt_a2[j][17:6]), 345 333 .ana_dead(ana_dead[j]), 346 334 .ana_good(ana_good[j]), … … 348 336 .ana_base(ana_base[j])); 349 337 350 histogram histogram_unit (338 amplitude amplitude_unit ( 351 339 .clock(sys_clock), 352 340 .frame(sys_frame), 353 .reset(cfg_bits[0][5+j]), 354 .hst_good((ana_good[j]) & (cnt_good[j])), 355 .hst_data(ana_data[j]), 356 .bus_ssel(bus_ssel[2+j]), 357 .bus_wren(bus_wren), 358 .bus_addr(bus_addr[12:0]), 359 .bus_mosi(bus_mosi), 360 .bus_miso(bus_miso[2+j]), 361 .bus_busy(bus_busy[2+j])); 362 363 counter counter_unit ( 364 .clock(sys_clock), 365 .frame((sys_frame) & (~ana_dead[j])), 366 .reset(cfg_bits[0][8+j]), 367 .cfg_data(cfg_bits[12+j]), 368 .bus_ssel(bus_ssel[5+j]), 369 .bus_wren(bus_wren), 370 .bus_addr(bus_addr[1:0]), 371 .bus_mosi(bus_mosi), 372 .bus_miso(bus_miso[5+j]), 373 .bus_busy(bus_busy[5+j]), 374 .cnt_good(cnt_good[j])); 375 341 .reset(cfg_bits[0][2+j]), 342 .cfg_data(cfg_bits[12][11:0]), 343 // .cfg_data(10'd5), 344 .uwt_flag(uwt_flag3[j]), 345 .uwt_data(uwt_a3[j][20:9]), 346 .amp_good(amp_good[j]), 347 .amp_data(amp_data[j])); 376 348 end 377 349 endgenerate 350 351 histogram32 histogram32_unit ( 352 .clock(sys_clock), 353 .frame(sys_frame), 354 .reset(cfg_bits[0][5]), 355 .hst_good((ana_good[0]) & (cnt_good[0]) & (cfg_bits[13][1])), 356 .hst_data(ana_data[0]), 357 /* 358 .hst_good((amp_good[j]) & (cnt_good[j]) & (cfg_bits[13][1])), 359 .hst_data(amp_data[j]), 360 */ 361 .bus_ssel(bus_ssel[2]), 362 .bus_wren(bus_wren), 363 .bus_addr(bus_addr[12:0]), 364 .bus_mosi(bus_mosi), 365 .bus_miso(bus_miso[2]), 366 .bus_busy(bus_busy[2])); 367 368 counter hst_counter_unit ( 369 .clock(sys_clock), 370 .frame((sys_frame) & (~ana_dead[0])), 371 // .frame(sys_frame), 372 .reset(cfg_bits[0][8]), 373 .setup(cfg_bits[13][0]), 374 .count(cfg_bits[13][1]), 375 .bus_ssel(bus_ssel[5]), 376 .bus_wren(bus_wren), 377 .bus_addr(bus_addr[1:0]), 378 .bus_mosi(bus_mosi), 379 .bus_miso(bus_miso[5]), 380 .bus_busy(bus_busy[5]), 381 .cnt_good(cnt_good[0])); 382 378 383 379 384 i2c_fifo i2c_unit( … … 390 395 .i2c_scl(I2C_SDA), 391 396 392 .bus_ssel(bus_ssel[ 8]),393 .bus_wren(bus_wren), 394 .bus_mosi(bus_mosi), 395 .bus_busy(bus_busy[ 8]));397 .bus_ssel(bus_ssel[11]), 398 .bus_wren(bus_wren), 399 .bus_mosi(bus_mosi), 400 .bus_busy(bus_busy[11])); 396 401 397 402 generate 398 for (j = 0; j < 8; j = j + 1)403 for (j = 0; j < 11; j = j + 1) 399 404 begin : BUS_OUTPUT 400 405 assign int_bus_miso[j*16+15:j*16] = bus_miso[j]; … … 403 408 404 409 lpm_mux #( 405 .lpm_size( 8),410 .lpm_size(11), 406 411 .lpm_type("LPM_MUX"), 407 412 .lpm_width(16), 408 .lpm_widths( 3)) bus_miso_mux_unit (409 .sel(bus_addr[3 0:28]),413 .lpm_widths(4)) bus_miso_mux_unit ( 414 .sel(bus_addr[31:28]), 410 415 .data(int_bus_miso), 411 416 .result(mrg_bus_miso)); 412 417 413 418 lpm_mux #( 414 .lpm_size( 9),419 .lpm_size(12), 415 420 .lpm_type("LPM_MUX"), 416 421 .lpm_width(1), … … 420 425 .result(mrg_bus_busy)); 421 426 422 /*423 lpm_or #(424 .lpm_size(6),425 .lpm_type("LPM_OR"),426 .lpm_width(16)) bus_miso_or_unit (427 .data(int_bus_miso),428 .result(mrg_bus_miso));429 */430 431 427 lpm_decode #( 432 .lpm_decodes( 9),428 .lpm_decodes(12), 433 429 .lpm_type("LPM_DECODE"), 434 430 .lpm_width(4)) lpm_decode_unit ( 435 431 .data(bus_addr[31:28]), 436 .eq(bus_ssel), 437 .aclr(), 438 .clken(), 439 .clock(), 440 .enable()); 432 .eq(bus_ssel)); 433 441 434 442 435 control control_unit ( -
sandbox/MultiChannelUSB/adc_lvds.v
r98 r107 5 5 ) 6 6 ( 7 input wire clock, 8 7 9 input wire lvds_dco, 8 10 input wire lvds_fco, 9 11 input wire [size-1:0] lvds_d, 10 12 11 output wire [size*width-1:0] adc_data 13 input wire [11:0] test, 14 input wire [11:0] trig, 15 16 output wire adc_frame, 17 output wire [size*width-1+12:0] adc_data 18 12 19 ); 13 20 14 wire [size-1:0] int_data_h, int_data_l; 15 reg [width-1:0] int_data_next [size-1:0]; 16 // reg [2*width:0] int_data_next [size-1:0]; 17 reg [width-1:0] int_data_reg [size-1:0]; 18 // reg [2*width:0] int_data_reg [size-1:0]; 21 reg state, int_rdreq, adc_frame_reg; 22 wire int_wrfull, int_rdempty; 19 23 20 reg [width-1:0] int_adc_data [size-1:0];24 reg [size-1:0] int_data_h, int_data_l; 21 25 22 integer i; 26 reg [size*width-1:0] int_data_reg; 27 wire [size*width-1:0] int_data_wire; 28 29 wire [size*width-1+12:0] int_q_wire; 30 reg [size*width-1+12:0] adc_data_reg; 31 32 23 33 genvar j; 24 34 25 altddio_in #( 35 generate 36 for (j = 0; j < size-1; j = j + 1) 37 begin : INT_DATA 38 assign int_data_wire[j*width+width-1:j*width] = {int_data_reg[j*width+width-3:j*width], int_data_h[j], int_data_l[j]}; 39 // assign int_data_wire[j*width+width-1:j*width] = test; 40 end 41 endgenerate 42 assign int_data_wire[(size-1)*width+width-1:(size-1)*width] = test; 43 44 dcfifo #( 26 45 .intended_device_family("Cyclone III"), 27 .invert_input_clocks("ON"), 28 // .invert_input_clocks("OFF"), 29 .lpm_type("altddio_in"), 30 .width(size)) altddio_in_unit ( 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)); 46 .lpm_numwords(16), 47 .lpm_showahead("ON"), 48 .lpm_type("dcfifo"), 49 .lpm_width(size*width+12), 50 .lpm_widthu(4), 51 .rdsync_delaypipe(4), 52 .wrsync_delaypipe(4), 53 .overflow_checking("ON"), 54 .underflow_checking("ON"), 55 .use_eab("ON")) fifo_unit ( 56 .data({trig, int_data_wire}), 57 .rdclk(clock), 58 .rdreq((~int_rdempty) & int_rdreq), 59 .wrclk(lvds_fco), 60 .wrreq(~int_wrfull), 61 .q(int_q_wire), 62 .rdempty(int_rdempty), 63 .wrfull(int_wrfull), 64 .aclr(), 65 .rdfull(), 66 .rdusedw(), 67 .wrempty(), 68 .wrusedw()); 69 70 always @ (posedge clock) 71 begin 72 case (state) 73 1'b0: 74 begin 75 int_rdreq <= 1'b1; 76 adc_frame_reg <= 1'b0; 77 state <= 1'b1; 78 end 79 80 1'b1: 81 begin 82 if (~int_rdempty) 83 begin 84 int_rdreq <= 1'b0; 85 adc_frame_reg <= 1'b1; 86 adc_data_reg <= int_q_wire; 87 state <= 1'b0; 88 end 89 end 90 endcase 91 end 92 93 always @ (negedge lvds_dco) 94 begin 95 int_data_l <= lvds_d; 96 end 40 97 41 98 always @ (posedge lvds_dco) 42 99 begin 43 for (i = 0; i < size; i = i + 1) 44 begin 45 int_data_reg[i] <= int_data_next[i]; 46 end 100 int_data_h <= lvds_d; 101 int_data_reg <= int_data_wire; 47 102 end 48 103 49 always @ (posedge lvds_fco) 50 begin 51 for (i = 0; i < size; i = i + 1) 52 begin 53 int_adc_data[i] <= int_data_next[i]; 54 // int_data_next[i] = {int_data_reg[i][2*width-2:0], int_data_l[i], int_data_h[i]}; 55 end 56 end 57 58 always @* 59 begin 60 for (i = 0; i < size; i = i + 1) 61 begin 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]}; 64 end 65 end 66 67 generate 68 for (j = 0; j < size; j = j + 1) 69 begin : ADC_LVDS_OUTPUT 70 assign adc_data[j*width+width-1:j*width] = int_adc_data[j]; 71 end 72 endgenerate 104 assign adc_frame = adc_frame_reg; 105 assign adc_data = adc_data_reg; 73 106 74 107 endmodule -
sandbox/MultiChannelUSB/analyser.v
r100 r107 33 33 state_reg <= 3'd0; 34 34 counter_reg <= 5'd0; 35 sample_reg = 20'd0;35 sample_reg <= 20'd0; 36 36 dead_reg <= 1'b0; 37 37 good_reg <= 1'b0; … … 160 160 if (counter_max) 161 161 begin 162 if (uwt_flag[ 0])162 if (uwt_flag[1]) 163 163 begin 164 164 counter_next = 5'd0; -
sandbox/MultiChannelUSB/counter.v
r94 r107 1 1 module counter 2 2 ( 3 input wire clock, frame, reset,3 input wire clock, frame, 4 4 5 input wire [15:0] cfg_data,5 input wire reset, setup, count, 6 6 7 7 input wire bus_ssel, bus_wren, … … 23 23 wire [63:0] reg_bits_wire; 24 24 wire [63:0] cnt_bits_wire; 25 26 reg int_load_reg; 25 27 26 28 integer i; … … 32 34 .lpm_type("LPM_COUNTER"), 33 35 .lpm_width(64)) lpm_counter_component ( 34 .sload( cfg_data[0]),36 .sload(int_load_reg | setup), 35 37 .sclr(reset), 36 38 .clock(clock), 37 39 .data(reg_bits_wire), 38 // .cnt_en(frame & cfg_data[1]), 39 .cnt_en((frame) & (|cnt_bits_wire) & (cfg_data[1])), 40 .q(cnt_bits_wire), 41 .aclr(1'b0), 42 .aload(1'b0), 43 .aset(1'b0), 44 .cin(1'b1), 45 .clk_en(1'b1), 46 .cout(), 47 .eq(), 48 .sset(1'b0), 49 .updown(1'b1)); 40 .cnt_en((frame) & (count) & (|cnt_bits_wire)), 41 .q(cnt_bits_wire)); 50 42 51 43 generate … … 60 52 .clock(clock), 61 53 .data(bus_mosi), 62 .q(reg_bits_wire[j*16+15:j*16]), 63 .aclr(), 64 .aload(), 65 .aset(), 66 .sload(), 67 .sset()); 54 .q(reg_bits_wire[j*16+15:j*16])); 68 55 end 69 56 endgenerate … … 84 71 .lpm_width(2)) lpm_decode_unit ( 85 72 .data(bus_addr), 86 .eq(int_ssel_wire), 87 .aclr(), 88 .clken(), 89 .clock(), 90 .enable()); 73 .eq(int_ssel_wire)); 91 74 92 75 always @(posedge clock) … … 96 79 int_miso_reg <= 16'd0; 97 80 cnt_good_reg <= 1'b0; 81 int_load_reg <= 1'b0; 98 82 end 99 83 else 100 84 begin 101 85 int_miso_reg <= int_miso_wire; 102 cnt_good_reg <= (|cnt_bits_wire) & (cfg_data[1]); 86 cnt_good_reg <= |cnt_bits_wire; 87 int_load_reg <= bus_ssel & bus_wren; 103 88 end 104 89 end -
sandbox/MultiChannelUSB/test.v
r93 r107 1 1 module test 2 2 ( 3 input wire cl k,3 input wire clock, 4 4 output wire [11:0] data 5 5 ); 6 6 7 reg [11:0] int_data; 8 reg [15:0] counter; 9 // reg [5:0] counter; 10 reg [5:0] state; 7 reg [11:0] int_addr; 11 8 12 always @(posedge cl k)9 always @(posedge clock) 13 10 begin 14 case (state) 15 /* 16 0: 17 begin 18 int_data <= 12'd0; 19 state <= 6'd1; 20 end 21 22 1: 23 begin 24 int_data <= 12'd1024; 25 state <= 6'd2; 26 end 11 if (int_addr == 12'd2559) 12 begin 13 int_addr <= 12'd0; 14 end 15 else 16 begin 17 int_addr <= int_addr + 12'd1; 18 end 27 19 28 2:29 begin30 int_data <= 12'd2048;31 state <= 6'd3;32 end33 34 3:35 begin36 int_data <= 12'd3072;37 state <= 6'd4;38 end39 40 4:41 begin42 int_data <= 12'd4095;43 state <= 6'd5;44 end45 46 5:47 begin48 int_data <= 12'd3072;49 state <= 6'd6;50 end51 52 6:53 begin54 int_data <= 12'd2048;55 state <= 6'd7;56 end57 58 7:59 begin60 int_data <= 12'd1024;61 state <= 6'd8;62 end63 64 8:65 begin66 int_data <= 12'd0;67 counter <= counter + 6'd1;68 if (&counter)69 begin70 state <= 6'd0;71 end72 end73 */74 75 6'd0:76 begin77 int_data <= 12'h030;78 state <= 6'd1;79 end80 81 6'd1:82 begin83 int_data <= 12'h034;84 state <= 6'd2;85 end86 87 6'd2:88 begin89 int_data <= 12'h081;90 state <= 6'd3;91 end92 93 6'd3:94 begin95 int_data <= 12'h0f5;96 state <= 6'd4;97 end98 99 6'd4:100 begin101 int_data <= 12'h10a;102 state <= 6'd5;103 end104 105 6'd5:106 begin107 int_data <= 12'h11a;108 state <= 6'd6;109 end110 111 6'd6:112 begin113 int_data <= 12'h124;114 state <= 6'd7;115 end116 117 6'd7:118 begin119 int_data <= 12'h124;120 state <= 6'd8;121 end122 123 6'd8:124 begin125 int_data <= 12'h12b;126 state <= 6'd9;127 end128 129 6'd9:130 begin131 int_data <= 12'h12a;132 state <= 6'd10;133 end134 135 6'd10:136 begin137 int_data <= 12'h12a;138 state <= 6'd11;139 end140 141 6'd11:142 begin143 int_data <= 12'h12b;144 state <= 6'd12;145 end146 147 6'd12:148 begin149 int_data <= 12'h12a;150 state <= 6'd13;151 end152 153 6'd13:154 begin155 int_data <= 12'h12e;156 state <= 6'd14;157 end158 159 6'd14:160 begin161 int_data <= 12'h12b;162 state <= 6'd15;163 end164 165 6'd15:166 begin167 int_data <= 12'h12b;168 state <= 6'd16;169 end170 171 6'd16:172 begin173 int_data <= 12'h12e;174 state <= 6'd17;175 end176 177 6'd17:178 begin179 int_data <= 12'h12b;180 state <= 6'd18;181 end182 183 6'd18:184 begin185 int_data <= 12'h12a;186 state <= 6'd19;187 end188 189 6'd19:190 begin191 int_data <= 12'h12e;192 state <= 6'd20;193 end194 195 6'd20:196 begin197 int_data <= 12'h12b;198 state <= 6'd21;199 end200 201 6'd21:202 begin203 int_data <= 12'h12e;204 state <= 6'd22;205 end206 207 6'd22:208 begin209 int_data <= 12'h12f;210 state <= 6'd23;211 end212 213 6'd23:214 begin215 int_data <= 12'h12f;216 state <= 6'd24;217 end218 219 6'd24:220 begin221 int_data <= 12'h12b;222 state <= 6'd25;223 end224 225 6'd25:226 begin227 int_data <= 12'h12b;228 state <= 6'd26;229 end230 231 6'd26:232 begin233 int_data <= 12'h12b;234 state <= 6'd27;235 end236 237 6'd27:238 begin239 int_data <= 12'h12e;240 state <= 6'd28;241 end242 243 6'd28:244 begin245 int_data <= 12'h12e;246 state <= 6'd29;247 end248 249 6'd29:250 begin251 int_data <= 12'h12e;252 state <= 6'd30;253 end254 255 6'd30:256 begin257 int_data <= 12'h12e;258 state <= 6'd31;259 end260 261 6'd31:262 begin263 int_data <= 12'h12b;264 state <= 6'd32;265 end266 267 6'd32:268 begin269 int_data <= 12'h12b;270 state <= 6'd33;271 end272 273 6'd33:274 begin275 int_data <= 12'h12b;276 state <= 6'd34;277 end278 279 6'd34:280 begin281 int_data <= 12'h12e;282 state <= 6'd35;283 end284 285 6'd35:286 begin287 int_data <= 12'h12e;288 state <= 6'd36;289 end290 291 6'd36:292 begin293 int_data <= 12'h12e;294 state <= 6'd37;295 end296 297 6'd37:298 begin299 int_data <= 12'h12e;300 state <= 6'd38;301 end302 303 6'd38:304 begin305 int_data <= 12'h12f;306 state <= 6'd39;307 end308 309 6'd39:310 begin311 int_data <= 12'h12b;312 state <= 6'd40;313 end314 315 6'd40:316 begin317 int_data <= 12'h12e;318 state <= 6'd41;319 end320 321 6'd41:322 begin323 int_data <= 12'h12f;324 state <= 6'd42;325 end326 327 6'd42:328 begin329 int_data <= 12'h0fb;330 state <= 6'd43;331 end332 333 6'd43:334 begin335 int_data <= 12'h07e;336 state <= 6'd44;337 end338 339 6'd44:340 begin341 int_data <= 12'h070;342 state <= 6'd45;343 end344 345 6'd45:346 begin347 int_data <= 12'h05a;348 state <= 6'd46;349 end350 351 6'd46:352 begin353 int_data <= 12'h045;354 state <= 6'd47;355 end356 357 6'd47:358 begin359 int_data <= 12'h03f;360 state <= 6'd48;361 end362 363 6'd48:364 begin365 int_data <= 12'h03b;366 state <= 6'd49;367 end368 369 6'd49:370 begin371 int_data <= 12'h034;372 state <= 6'd50;373 end374 375 6'd50:376 begin377 int_data <= 12'h035;378 state <= 6'd51;379 end380 381 6'd51:382 begin383 int_data <= 12'h034;384 state <= 6'd52;385 end386 387 6'd52:388 begin389 int_data <= 12'h034;390 state <= 6'd53;391 end392 393 6'd53:394 begin395 int_data <= 12'h030;396 state <= 6'd54;397 end398 399 6'd54:400 begin401 int_data <= 12'h030;402 counter <= counter + 16'd1;403 if (&counter)404 begin405 state <= 6'd0;406 end407 end408 409 default:410 begin411 state <= 6'd0;412 end413 endcase414 20 end 415 21 416 assign data = int_data; 22 altsyncram #( 23 .address_aclr_a("NONE"), 24 .clock_enable_input_a("BYPASS"), 25 .clock_enable_output_a("BYPASS"), 26 .init_file("test_mwd.mif"), 27 .intended_device_family("Cyclone III"), 28 .lpm_hint("ENABLE_RUNTIME_MOD=NO"), 29 .lpm_type("altsyncram"), 30 .numwords_a(2560), 31 .operation_mode("ROM"), 32 .outdata_aclr_a("NONE"), 33 .outdata_reg_a("CLOCK0"), 34 .widthad_a(12), 35 .width_a(12), 36 .width_byteena_a(1)) test_rom_unit ( 37 .clock0(clock), 38 .address_a(int_addr), 39 .q_a(data), 40 .aclr0(1'b0), 41 .aclr1(1'b0), 42 .address_b(1'b1), 43 .addressstall_a(1'b0), 44 .addressstall_b(1'b0), 45 .byteena_a(1'b1), 46 .byteena_b(1'b1), 47 .clock1(1'b1), 48 .clocken0(1'b1), 49 .clocken1(1'b1), 50 .clocken2(1'b1), 51 .clocken3(1'b1), 52 .data_a({12{1'b1}}), 53 .data_b(1'b1), 54 .eccstatus(), 55 .q_b(), 56 .rden_a(1'b1), 57 .rden_b(1'b1), 58 .wren_a(1'b0), 59 .wren_b(1'b0)); 417 60 418 61 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.