Changeset 34 for trunk/MultiChannelUSB
- Timestamp:
- Sep 7, 2009, 12:04:30 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/Paella.v
r31 r34 99 99 .usb_pktend(usb_pktend), 100 100 .usb_addr(usb_addr), 101 101 102 .clk(CLK_50MHz), 102 103 .aclr(usb_fifo_aclr), 103 .tx_wrreq(usb_fifo_tx_wrreq), 104 105 .tx_full(usb_fifo_tx_full), 106 // .tx_wrreq(usb_fifo_tx_wrreq), 107 // .tx_wrreq((~usb_fifo_tx_full) & (state1 == 3'd5)), 108 .tx_wrreq((~usb_fifo_tx_full) & usb_fifo_tx_wrreq), 109 .tx_data(usb_fifo_tx_data), 110 // .tx_data(osc_counter), 111 112 .rx_empty(usb_fifo_rx_empty), 104 113 .rx_rdreq(usb_fifo_rx_rdreq), 105 .tx_data(usb_fifo_tx_data), 106 .tx_full(usb_fifo_tx_full), 107 .rx_empty(usb_fifo_rx_empty), 108 .rx_data(usb_fifo_rx_data), 114 .rx_q(usb_fifo_rx_data), 115 109 116 .led(usb_fifo_led) 110 117 ); 111 118 112 reg [ 9:0] osc_counter;119 reg [10:0] osc_counter; 113 120 reg osc_reset; 114 121 reg osc_byte_num; … … 204 211 endcase 205 212 end 206 213 /* 207 214 always @(posedge CLK_50MHz) 208 215 begin … … 267 274 endcase 268 275 269 if (&hst_byte_num) 270 begin 271 if (&hst_addr) 272 begin 273 state1 <= 3'd1; 274 end 275 else 276 begin 277 hst_addr <= hst_addr + 12'd1; 278 end 276 if ((&hst_byte_num) & (&hst_addr)) 277 begin 278 state1 <= 3'd1; 279 end 280 else if (&hst_byte_num) 281 begin 282 hst_addr <= hst_addr + 12'd1; 279 283 end 280 284 281 285 hst_byte_num <= hst_byte_num + 2'd1; 286 end 287 end 288 289 4: 290 begin 291 usb_fifo_rx_rdreq <= 1'b0; 292 usb_fifo_tx_wrreq <= 1'b0; 293 usb_fifo_tx_data <= osc_counter; 294 state1 <= 3'd5; 295 end 296 297 5: 298 begin 299 if (~usb_fifo_tx_full) 300 begin 301 usb_fifo_tx_wrreq <= 1'b1; 302 state1 <= 3'd6; 303 end 304 end 305 306 6: 307 begin 308 usb_fifo_tx_wrreq <= 1'b0; 309 if (&osc_counter) 310 begin 311 state1 <= 3'd1; 312 end 313 else 314 begin 315 osc_counter <= osc_counter + 11'd1; 316 state1 <= 3'd4; 282 317 end 283 318 end … … 290 325 if(~usb_fifo_tx_full) 291 326 begin 327 usb_fifo_tx_data <= osc_counter; 328 osc_counter <= osc_counter + 11'd1; 329 if (&osc_counter) state1 <= 3'd1; 330 292 331 case (osc_byte_num) 293 332 1'd0: usb_fifo_tx_data <= osc_q[7:0]; 294 333 1'd1: usb_fifo_tx_data <= osc_q[15:8]; 295 334 endcase 296 297 if (osc_byte_num) 298 begin 299 if (&osc_counter) 300 begin 301 state1 <= 3'd1; 302 end 303 else 304 begin 305 osc_addr <= osc_addr + 10'd1; 306 osc_counter <= osc_counter + 10'd1; 307 end 335 336 if ((osc_byte_num) & (&osc_counter)) 337 begin 338 state1 <= 3'd1; 339 end 340 else if (osc_byte_num) 341 begin 342 osc_addr <= osc_addr + 10'd1; 343 osc_counter <= osc_counter + 10'd1; 308 344 end 309 345 310 346 osc_byte_num <= ~osc_byte_num; 347 311 348 end 312 349 end … … 320 357 end 321 358 322 /* 359 */ 323 360 always @(posedge CLK_50MHz) 324 361 begin 325 362 case(state1) 326 0: 327 begin 363 1: 364 begin 365 usb_fifo_rx_rdreq <= 1'b0; 328 366 usb_fifo_tx_wrreq <= 1'b0; 329 counter <= 32'd0; 330 state1 <= 3'd1; 331 end 332 1: 333 begin 334 if((~usb_fifo_tx_full) & (counter < 32'd512)) 335 begin 336 counter <= counter + 32'd1; 337 state1 <= 3'd2; 338 usb_fifo_tx_data <= 1; 339 usb_fifo_tx_wrreq <= 1'b1; 340 end 341 else 367 hst_reset <= 1'b0; 368 osc_reset <= 1'b0; 369 state1 <= 3'd2; 370 end 371 372 2: 373 begin 374 usb_fifo_rx_rdreq <= ~usb_fifo_rx_empty; 375 if (~usb_fifo_rx_empty) 376 begin 377 case (usb_fifo_rx_data) 378 8'h30: 379 begin 380 hst_reset <= 1'b1; 381 state1 <= 3'd1; 382 end 383 8'h31: 384 begin 385 hst_addr <= 12'd0; 386 hst_byte_num <= 2'd0; 387 state1 <= 3'd3; 388 end 389 8'h32: 390 begin 391 led_reg <= 1'b1; 392 osc_reset <= 1'b1; 393 state1 <= 3'd1; 394 end 395 8'h33: 396 begin 397 led_reg <= 1'b0; 398 osc_addr <= osc_start_addr; 399 osc_counter <= 11'd0; 400 osc_byte_num <= 1'd0; 401 state1 <= 3'd4; 402 end 403 404 endcase 405 end 406 end 407 4: 408 begin 409 usb_fifo_tx_data <= osc_counter; 410 usb_fifo_tx_wrreq <= 1'b1; 411 osc_counter <= osc_counter + 11'd1; 412 state1 <= 3'd5; 413 end 414 5: 415 begin 416 if (~usb_fifo_tx_full) 417 begin 418 usb_fifo_tx_data <= osc_counter; 419 if (osc_counter == 11'd0) //(&osc_counter) 420 begin 421 state1 <= 3'd6; 422 end 423 else 424 begin 425 osc_counter <= osc_counter + 11'd1; 426 end 427 end 428 end 429 6: 430 begin 431 if (~usb_fifo_tx_full) 342 432 begin 343 433 usb_fifo_tx_wrreq <= 1'b0; 344 end345 end346 347 2:348 begin349 if((~usb_fifo_tx_full) & (counter < 32'd512))350 begin351 counter <= counter + 32'd1;352 434 state1 <= 3'd1; 353 usb_fifo_tx_data <= 0; 354 usb_fifo_tx_wrreq <= 1'b1; 355 end 356 else 357 begin 358 usb_fifo_tx_wrreq <= 1'b0; 359 end 360 end 361 362 default: state1 <= 3'd0; 435 end 436 end 437 438 439 default: state1 <= 3'd1; 363 440 endcase 364 441 end 365 */ 442 366 443 always @ (posedge adc_clk) 367 444 begin
Note:
See TracChangeset
for help on using the changeset viewer.