Changeset 2321 for Deliverables/D2.2/8051-toolstick/src/ASM/ASMInterpret.ml
- Timestamp:
- Sep 3, 2012, 4:44:08 PM (9 years ago)
- Location:
- Deliverables/D2.2/8051-toolstick
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051-toolstick/src/ASM/ASMInterpret.ml
r1708 r2321 387 387 "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" 388 388 389 (* timings taken from SIEMENS*)389 (* timings taken from C8051F33x.pdf; higher figure taken for variable time ops *) 390 390 391 391 let fetch pmem pc = … … 400 400 (a10,a9,a8,true),(false,false,false,true) -> 401 401 let pc,b1 = next pc in 402 `ACALL (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 2402 `ACALL (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 3 403 403 | (false,false,true,false),(true,r1,r2,r3) -> 404 404 `ADD (`A,`REG (r1,r2,r3)), pc, 1 405 405 | (false,false,true,false),(false,true,false,true) -> 406 406 let pc,b1 = next pc in 407 `ADD (`A,`DIRECT b1), pc, 1407 `ADD (`A,`DIRECT b1), pc, 2 408 408 | (false,false,true,false),(false,true,true,i1) -> 409 `ADD (`A,`INDIRECT i1), pc, 1409 `ADD (`A,`INDIRECT i1), pc, 2 410 410 | (false,false,true,false),(false,true,false,false) -> 411 411 let pc,b1 = next pc in 412 `ADD (`A,`DATA b1), pc, 1412 `ADD (`A,`DATA b1), pc, 2 413 413 | (false,false,true,true),(true,r1,r2,r3) -> 414 414 `ADDC (`A,`REG (r1,r2,r3)), pc, 1 415 415 | (false,false,true,true),(false,true,false,true) -> 416 416 let pc,b1 = next pc in 417 `ADDC (`A,`DIRECT b1), pc, 1417 `ADDC (`A,`DIRECT b1), pc, 2 418 418 | (false,false,true,true),(false,true,true,i1) -> 419 `ADDC (`A,`INDIRECT i1), pc, 1419 `ADDC (`A,`INDIRECT i1), pc, 2 420 420 | (false,false,true,true),(false,true,false,false) -> 421 421 let pc,b1 = next pc in 422 `ADDC (`A,`DATA b1), pc, 1422 `ADDC (`A,`DATA b1), pc, 2 423 423 | (a10,a9,a8,false),(false,false,false,true) -> 424 424 let pc,b1 = next pc in 425 `AJMP (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 2425 `AJMP (`ADDR11 (mk_word11 a10 a9 a8 b1)), pc, 3 426 426 | (false,true,false,true),(true,r1,r2,r3) -> 427 427 `ANL (`U1 (`A, `REG (r1,r2,r3))), pc, 1 428 428 | (false,true,false,true),(false,true,false,true) -> 429 429 let pc,b1 = next pc in 430 `ANL (`U1 (`A, `DIRECT b1)), pc, 1430 `ANL (`U1 (`A, `DIRECT b1)), pc, 2 431 431 | (false,true,false,true),(false,true,true,i1) -> 432 `ANL (`U1 (`A, `INDIRECT i1)), pc, 1432 `ANL (`U1 (`A, `INDIRECT i1)), pc, 2 433 433 | (false,true,false,true),(false,true,false,false) -> 434 434 let pc,b1 = next pc in 435 `ANL (`U1 (`A, `DATA b1)), pc, 1435 `ANL (`U1 (`A, `DATA b1)), pc, 2 436 436 | (false,true,false,true),(false,false,true,false) -> 437 437 let pc,b1 = next pc in 438 `ANL (`U2 (`DIRECT b1,`A)), pc, 1438 `ANL (`U2 (`DIRECT b1,`A)), pc, 2 439 439 | (false,true,false,true),(false,false,true,true) -> 440 440 let pc,b1 = next pc in 441 441 let pc,b2 = next pc in 442 `ANL (`U2 (`DIRECT b1,`DATA b2)), pc, 2442 `ANL (`U2 (`DIRECT b1,`DATA b2)), pc, 3 443 443 | (true,false,false,false),(false,false,true,false) -> 444 444 let pc,b1 = next pc in … … 450 450 let pc,b1 = next pc in 451 451 let pc,b2 = next pc in 452 `CJNE (`U1 (`A, `DIRECT b1), `REL b2), pc, 2452 `CJNE (`U1 (`A, `DIRECT b1), `REL b2), pc, 4 453 453 | (true,false,true,true),(false,true,false,false) -> 454 454 let pc,b1 = next pc in 455 455 let pc,b2 = next pc in 456 `CJNE (`U1 (`A, `DATA b1), `REL b2), pc, 2456 `CJNE (`U1 (`A, `DATA b1), `REL b2), pc, 4 457 457 | (true,false,true,true),(true,r1,r2,r3) -> 458 458 let pc,b1 = next pc in 459 459 let pc,b2 = next pc in 460 `CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2), pc, 2460 `CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2), pc, 4 461 461 | (true,false,true,true),(false,true,true,i1) -> 462 462 let pc,b1 = next pc in 463 463 let pc,b2 = next pc in 464 `CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2), pc, 2464 `CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2), pc, 5 465 465 | (true,true,true,false),(false,true,false,false) -> 466 466 `CLR `A, pc, 1 … … 469 469 | (true,true,false,false),(false,false,true,false) -> 470 470 let pc,b1 = next pc in 471 `CLR (`BIT b1), pc, 1471 `CLR (`BIT b1), pc, 2 472 472 | (true,true,true,true),(false,true,false,false) -> 473 473 `CPL `A, pc, 1 … … 476 476 | (true,false,true,true),(false,false,true,false) -> 477 477 let pc,b1 = next pc in 478 `CPL (`BIT b1), pc, 1478 `CPL (`BIT b1), pc, 2 479 479 | (true,true,false,true),(false,true,false,false) -> 480 480 `DA `A, pc, 1 … … 485 485 | (false,false,false,true),(false,true,false,true) -> 486 486 let pc,b1 = next pc in 487 `DEC (`DIRECT b1), pc, 1487 `DEC (`DIRECT b1), pc, 2 488 488 | (false,false,false,true),(false,true,true,i1) -> 489 `DEC (`INDIRECT i1), pc, 1489 `DEC (`INDIRECT i1), pc, 2 490 490 | (true,false,false,false),(false,true,false,false) -> 491 `DIV (`A, `B), pc, 4491 `DIV (`A, `B), pc, 8 492 492 | (true,true,false,true),(true,r1,r2,r3) -> 493 493 let pc,b1 = next pc in 494 `DJNZ (`REG(r1,r2,r3), `REL b1), pc, 2494 `DJNZ (`REG(r1,r2,r3), `REL b1), pc, 3 495 495 | (true,true,false,true),(false,true,false,true) -> 496 496 let pc,b1 = next pc in 497 497 let pc,b2 = next pc in 498 `DJNZ (`DIRECT b1, `REL b2), pc, 2498 `DJNZ (`DIRECT b1, `REL b2), pc, 4 499 499 | (false,false,false,false),(false,true,false,false) -> 500 500 `INC `A, pc, 1 … … 503 503 | (false,false,false,false),(false,true,false,true) -> 504 504 let pc,b1 = next pc in 505 `INC (`DIRECT b1), pc, 1505 `INC (`DIRECT b1), pc, 2 506 506 | (false,false,false,false),(false,true,true,i1) -> 507 `INC (`INDIRECT i1), pc, 1507 `INC (`INDIRECT i1), pc, 2 508 508 | (true,false,true,false),(false,false,true,true) -> 509 `INC `DPTR, pc, 2509 `INC `DPTR, pc, 1 510 510 | (false,false,true,false),(false,false,false,false) -> 511 511 let pc,b1 = next pc in 512 512 let pc,b2 = next pc in 513 `JB (`BIT b1, `REL b2), pc, 2513 `JB (`BIT b1, `REL b2), pc, 4 514 514 | (false,false,false,true),(false,false,false,false) -> 515 515 let pc,b1 = next pc in 516 516 let pc,b2 = next pc in 517 `JBC (`BIT b1, `REL b2), pc, 2517 `JBC (`BIT b1, `REL b2), pc, 4 518 518 | (false,true,false,false),(false,false,false,false) -> 519 519 let pc,b1 = next pc in 520 `JC (`REL b1), pc, 2520 `JC (`REL b1), pc, 3 521 521 | (false,true,true,true),(false,false,true,true) -> 522 `JMP `IND_DPTR, pc, 2522 `JMP `IND_DPTR, pc, 3 523 523 | (false,false,true,true),(false,false,false,false) -> 524 524 let pc,b1 = next pc in 525 525 let pc,b2 = next pc in 526 `JNB (`BIT b1, `REL b2), pc, 2526 `JNB (`BIT b1, `REL b2), pc, 4 527 527 | (false,true,false,true),(false,false,false,false) -> 528 528 let pc,b1 = next pc in 529 `JNC (`REL b1), pc, 2529 `JNC (`REL b1), pc, 3 530 530 | (false,true,true,true),(false,false,false,false) -> 531 531 let pc,b1 = next pc in 532 `JNZ (`REL b1), pc, 2532 `JNZ (`REL b1), pc, 3 533 533 | (false,true,true,false),(false,false,false,false) -> 534 534 let pc,b1 = next pc in 535 `JZ (`REL b1), pc, 2535 `JZ (`REL b1), pc, 3 536 536 | (false,false,false,true),(false,false,true,false) -> 537 537 let pc,b1 = next pc in 538 538 let pc,b2 = next pc in 539 `LCALL (`ADDR16 (mk_word b1 b2)), pc, 2539 `LCALL (`ADDR16 (mk_word b1 b2)), pc, 4 540 540 | (false,false,false,false),(false,false,true,false) -> 541 541 let pc,b1 = next pc in 542 542 let pc,b2 = next pc in 543 `LJMP (`ADDR16 (mk_word b1 b2)), pc, 2543 `LJMP (`ADDR16 (mk_word b1 b2)), pc, 4 544 544 | (true,true,true,false),(true,r1,r2,r3) -> 545 545 `MOV (`U1 (`A, `REG(r1,r2,r3))), pc, 1 546 546 | (true,true,true,false),(false,true,false,true) -> 547 547 let pc,b1 = next pc in 548 `MOV (`U1 (`A, `DIRECT b1)), pc, 1548 `MOV (`U1 (`A, `DIRECT b1)), pc, 2 549 549 | (true,true,true,false),(false,true,true,i1) -> 550 `MOV (`U1 (`A, `INDIRECT i1)), pc, 1550 `MOV (`U1 (`A, `INDIRECT i1)), pc, 2 551 551 | (false,true,true,true),(false,true,false,false) -> 552 552 let pc,b1 = next pc in 553 `MOV (`U1 (`A, `DATA b1)), pc, 1553 `MOV (`U1 (`A, `DATA b1)), pc, 2 554 554 | (true,true,true,true),(true,r1,r2,r3) -> 555 555 `MOV (`U2 (`REG(r1,r2,r3), `A)), pc, 1 … … 559 559 | (false,true,true,true),(true,r1,r2,r3) -> 560 560 let pc,b1 = next pc in 561 `MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))), pc, 1561 `MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))), pc, 2 562 562 | (true,true,true,true),(false,true,false,true) -> 563 563 let pc,b1 = next pc in 564 `MOV (`U3 (`DIRECT b1, `A)), pc, 1564 `MOV (`U3 (`DIRECT b1, `A)), pc, 2 565 565 | (true,false,false,false),(true,r1,r2,r3) -> 566 566 let pc,b1 = next pc in … … 569 569 let pc,b1 = next pc in 570 570 let pc,b2 = next pc in 571 `MOV (`U3 (`DIRECT b1, `DIRECT b2)), pc, 2571 `MOV (`U3 (`DIRECT b1, `DIRECT b2)), pc, 3 572 572 | (true,false,false,false),(false,true,true,i1) -> 573 573 let pc,b1 = next pc in … … 578 578 `MOV (`U3 (`DIRECT b1, `DATA b2)), pc, 3 579 579 | (true,true,true,true),(false,true,true,i1) -> 580 `MOV (`U2 (`INDIRECT i1, `A)), pc, 1580 `MOV (`U2 (`INDIRECT i1, `A)), pc, 2 581 581 | (true,false,true,false),(false,true,true,i1) -> 582 582 let pc,b1 = next pc in … … 584 584 | (false,true,true,true),(false,true,true,i1) -> 585 585 let pc,b1 = next pc in 586 `MOV (`U2 (`INDIRECT i1, `DATA b1)), pc, 1586 `MOV (`U2 (`INDIRECT i1, `DATA b1)), pc, 2 587 587 | (true,false,true,false),(false,false,true,false) -> 588 588 let pc,b1 = next pc in 589 `MOV (`U5 (`C, `BIT b1)), pc, 1589 `MOV (`U5 (`C, `BIT b1)), pc, 2 590 590 | (true,false,false,true),(false,false,true,false) -> 591 591 let pc,b1 = next pc in … … 594 594 let pc,b1 = next pc in 595 595 let pc,b2 = next pc in 596 `MOV (`U4 (`DPTR, `DATA16(mk_word b1 b2))), pc, 2596 `MOV (`U4 (`DPTR, `DATA16(mk_word b1 b2))), pc, 3 597 597 | (true,false,false,true),(false,false,true,true) -> 598 `MOVC (`A, `A_DPTR), pc, 2598 `MOVC (`A, `A_DPTR), pc, 3 599 599 | (true,false,false,false),(false,false,true,true) -> 600 `MOVC (`A, `A_PC), pc, 2600 `MOVC (`A, `A_PC), pc, 3 601 601 | (true,true,true,false),(false,false,true,i1) -> 602 `MOVX (`U1 (`A, `EXT_INDIRECT i1)), pc, 2602 `MOVX (`U1 (`A, `EXT_INDIRECT i1)), pc, 3 603 603 | (true,true,true,false),(false,false,false,false) -> 604 `MOVX (`U1 (`A, `EXT_IND_DPTR)), pc, 2604 `MOVX (`U1 (`A, `EXT_IND_DPTR)), pc, 3 605 605 | (true,true,true,true),(false,false,true,i1) -> 606 `MOVX (`U2 (`EXT_INDIRECT i1, `A)), pc, 2606 `MOVX (`U2 (`EXT_INDIRECT i1, `A)), pc, 3 607 607 | (true,true,true,true),(false,false,false,false) -> 608 `MOVX (`U2 (`EXT_IND_DPTR, `A)), pc, 2608 `MOVX (`U2 (`EXT_IND_DPTR, `A)), pc, 3 609 609 | (true,false,true,false),(false,true,false,false) -> 610 610 `MUL(`A, `B), pc, 4 … … 615 615 | (false,true,false,false),(false,true,false,true) -> 616 616 let pc,b1 = next pc in 617 `ORL (`U1(`A, `DIRECT b1)), pc, 1617 `ORL (`U1(`A, `DIRECT b1)), pc, 2 618 618 | (false,true,false,false),(false,true,true,i1) -> 619 `ORL (`U1(`A, `INDIRECT i1)), pc, 1619 `ORL (`U1(`A, `INDIRECT i1)), pc, 2 620 620 | (false,true,false,false),(false,true,false,false) -> 621 621 let pc,b1 = next pc in 622 `ORL (`U1(`A, `DATA b1)), pc, 1622 `ORL (`U1(`A, `DATA b1)), pc, 2 623 623 | (false,true,false,false),(false,false,true,false) -> 624 624 let pc,b1 = next pc in 625 `ORL (`U2(`DIRECT b1, `A)), pc, 1625 `ORL (`U2(`DIRECT b1, `A)), pc, 2 626 626 | (false,true,false,false),(false,false,true,true) -> 627 627 let pc,b1 = next pc in 628 628 let pc,b2 = next pc in 629 `ORL (`U2 (`DIRECT b1, `DATA b2)), pc, 2629 `ORL (`U2 (`DIRECT b1, `DATA b2)), pc, 3 630 630 | (false,true,true,true),(false,false,true,false) -> 631 631 let pc,b1 = next pc in … … 641 641 `PUSH (`DIRECT b1), pc, 2 642 642 | (false,false,true,false),(false,false,true,false) -> 643 `RET, pc, 2643 `RET, pc, 5 644 644 | (false,false,true,true),(false,false,true,false) -> 645 `RETI, pc, 2645 `RETI, pc, 5 646 646 | (false,false,true,false),(false,false,true,true) -> 647 647 `RL `A, pc, 1 … … 656 656 | (true,true,false,true),(false,false,true,false) -> 657 657 let pc,b1 = next pc in 658 `SETB (`BIT b1), pc, 1658 `SETB (`BIT b1), pc, 2 659 659 | (true,false,false,false),(false,false,false,false) -> 660 660 let pc,b1 = next pc in 661 `SJMP (`REL b1), pc, 2661 `SJMP (`REL b1), pc, 3 662 662 | (true,false,false,true),(true,r1,r2,r3) -> 663 663 `SUBB (`A, `REG(r1,r2,r3)), pc, 1 664 664 | (true,false,false,true),(false,true,false,true) -> 665 665 let pc,b1 = next pc in 666 `SUBB (`A, `DIRECT b1), pc, 1666 `SUBB (`A, `DIRECT b1), pc, 2 667 667 | (true,false,false,true),(false,true,true,i1) -> 668 `SUBB (`A, `INDIRECT i1), pc, 1668 `SUBB (`A, `INDIRECT i1), pc, 2 669 669 | (true,false,false,true),(false,true,false,false) -> 670 670 let pc,b1 = next pc in 671 `SUBB (`A, `DATA b1), pc, 1671 `SUBB (`A, `DATA b1), pc, 2 672 672 | (true,true,false,false),(false,true,false,false) -> 673 673 `SWAP `A, pc, 1 … … 676 676 | (true,true,false,false),(false,true,false,true) -> 677 677 let pc,b1 = next pc in 678 `XCH (`A, `DIRECT b1), pc, 1678 `XCH (`A, `DIRECT b1), pc, 2 679 679 | (true,true,false,false),(false,true,true,i1) -> 680 `XCH (`A, `INDIRECT i1), pc, 1680 `XCH (`A, `INDIRECT i1), pc, 2 681 681 | (true,true,false,true),(false,true,true,i1) -> 682 `XCHD(`A, `INDIRECT i1), pc, 1682 `XCHD(`A, `INDIRECT i1), pc, 2 683 683 | (false,true,true,false),(true,r1,r2,r3) -> 684 684 `XRL(`U1(`A, `REG(r1,r2,r3))), pc, 1 685 685 | (false,true,true,false),(false,true,false,true) -> 686 686 let pc,b1 = next pc in 687 `XRL(`U1(`A, `DIRECT b1)), pc, 1687 `XRL(`U1(`A, `DIRECT b1)), pc, 2 688 688 | (false,true,true,false),(false,true,true,i1) -> 689 `XRL(`U1(`A, `INDIRECT i1)), pc, 1689 `XRL(`U1(`A, `INDIRECT i1)), pc, 2 690 690 | (false,true,true,false),(false,true,false,false) -> 691 691 let pc,b1 = next pc in 692 `XRL(`U1(`A, `DATA b1)), pc, 1692 `XRL(`U1(`A, `DATA b1)), pc, 2 693 693 | (false,true,true,false),(false,false,true,false) -> 694 694 let pc,b1 = next pc in 695 `XRL(`U2(`DIRECT b1, `A)), pc, 1695 `XRL(`U2(`DIRECT b1, `A)), pc, 2 696 696 | (false,true,true,false),(false,false,true,true) -> 697 697 let pc,b1 = next pc in 698 698 let pc,b2 = next pc in 699 `XRL(`U2(`DIRECT b1, `DATA b2)), pc, 2699 `XRL(`U2(`DIRECT b1, `DATA b2)), pc, 3 700 700 | (true,false,true,false),(false,true,false,true) -> 701 701 (* undefined opcode *) assert false
Note: See TracChangeset
for help on using the changeset viewer.