1// Copyright (c) 2006 The Regents of The University of Michigan 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions are 6// met: redistributions of source code must retain the above copyright 7// notice, this list of conditions and the following disclaimer; 8// redistributions in binary form must reproduce the above copyright --- 401 unchanged lines hidden (view full) --- 410 fault = xc->setMiscRegWithEffect(RD + PrStart, Rs1 ^ Rs2_or_imm13); 411 }}); 412 0x33: HPriv::wrhpr({{ 413 // XXX Need to protect with format that traps non-priv/priv 414 // access 415 fault = xc->setMiscRegWithEffect(RD + HprStart, Rs1 ^ Rs2_or_imm13); 416 }}); 417 0x34: decode OPF{ |
418 format BasicOperate{ 419 0x01: fmovs({{ 420 Frd.sf = Frs2.sf; 421 //fsr.ftt = fsr.cexc = 0 422 Fsr &= ~(7 << 14); 423 Fsr &= ~(0x1F); 424 }}); 425 0x02: fmovd({{ 426 Frd.df = Frs2.df; 427 //fsr.ftt = fsr.cexc = 0 428 Fsr &= ~(7 << 14); 429 Fsr &= ~(0x1F); 430 }}); 431 0x03: Trap::fmovq({{fault = new FpDisabled;}}); 432 0x05: fnegs({{ 433 //XXX might want to explicitly flip the sign bit 434 //So cases with Nan and +/-0 don't do weird things 435 Frd.sf = -Frs2.sf; 436 //fsr.ftt = fsr.cexc = 0 437 Fsr &= ~(7 << 14); 438 Fsr &= ~(0x1F); 439 }}); 440 0x06: fnegd({{ 441 //XXX might want to explicitly flip the sign bit 442 //So cases with Nan and +/-0 don't do weird things 443 Frd.df = -Frs2.df; 444 //fsr.ftt = fsr.cexc = 0 445 Fsr &= ~(7 << 14); 446 Fsr &= ~(0x1F); 447 }}); 448 0x07: Trap::fnegq({{fault = new FpDisabled;}}); 449 0x09: fabss({{ 450 //XXX this instruction should be tested individually 451 //Clear the sign bit 452 Frd.sf = (float)(~(1 << 31) & ((uint32_t)Frs2.sf)); 453 //fsr.ftt = fsr.cexc = 0 454 Fsr &= ~(7 << 14); 455 Fsr &= ~(0x1F); 456 }}); 457 0x0A: fabsd({{ 458 //XXX this instruction should be tested individually 459 //Clear the sign bit 460 Frd.df = (float)(~((uint64_t)1 << 63) & ((uint64_t)Frs2.df)); 461 //fsr.ftt = fsr.cexc = 0 462 Fsr &= ~(7 << 14); 463 Fsr &= ~(0x1F); 464 }}); 465 0x0B: Trap::fabsq({{fault = new FpDisabled;}}); 466 0x29: fsqrts({{Frd.sf = sqrt(Frs2.sf);}}); 467 0x2A: fsqrtd({{Frd.df = sqrt(Frs2.df);}}); 468 0x2B: Trap::fsqrtq({{fault = new FpDisabled;}}); 469 0x41: fadds({{Frd.sf = Frs1.sf + Frs2.sf;}}); 470 0x42: faddd({{Frd.df = Frs1.df + Frs2.df;}}); 471 0x43: Trap::faddq({{fault = new FpDisabled;}}); 472 0x45: fsubs({{Frd.sf = Frs1.sf - Frs2.sf;}}); 473 0x46: fsubd({{Frd.df = Frs1.df - Frs2.df;}}); 474 0x47: Trap::fsubq({{fault = new FpDisabled;}}); 475 0x49: fmuls({{Frd.sf = Frs1.sf * Frs2.sf;}}); 476 0x4A: fmuld({{Frd.df = Frs1.df * Frs2.df;}}); 477 0x4B: Trap::fmulq({{fault = new FpDisabled;}}); 478 0x4D: fdivs({{Frd.sf = Frs1.sf / Frs2.sf;}}); 479 0x4E: fdivd({{Frd.df = Frs1.df / Frs2.df;}}); 480 0x4F: Trap::fdivq({{fault = new FpDisabled;}}); 481 0x69: fsmuld({{Frd.df = Frs1.sf * Frs2.sf;}}); 482 0x6E: Trap::fdmulq({{fault = new FpDisabled;}}); 483 0x81: fstox({{ 484 Frd.df = (double)static_cast<int64_t>(Frs2.sf); 485 }}); 486 0x82: fdtox({{ 487 Frd.df = (double)static_cast<int64_t>(Frs2.df); 488 }}); 489 0x83: Trap::fqtox({{fault = new FpDisabled;}}); 490 0x84: fxtos({{ 491 Frd.sf = static_cast<float>((int64_t)Frs2.df); 492 }}); 493 0x88: fxtod({{ 494 Frd.df = static_cast<double>((int64_t)Frs2.df); 495 }}); 496 0x8C: Trap::fxtoq({{fault = new FpDisabled;}}); 497 0xC4: fitos({{ 498 Frd.sf = static_cast<float>((int32_t)Frs2.sf); 499 }}); 500 0xC6: fdtos({{Frd.sf = Frs2.df;}}); 501 0xC7: Trap::fqtos({{fault = new FpDisabled;}}); 502 0xC8: fitod({{ 503 Frd.df = static_cast<double>((int32_t)Frs2.sf); 504 }}); 505 0xC9: fstod({{Frd.df = Frs2.sf;}}); 506 0xCB: Trap::fqtod({{fault = new FpDisabled;}}); 507 0xCC: Trap::fitoq({{fault = new FpDisabled;}}); 508 0xCD: Trap::fstoq({{fault = new FpDisabled;}}); 509 0xCE: Trap::fdtoq({{fault = new FpDisabled;}}); 510 0xD1: fstoi({{ 511 Frd.sf = (float)static_cast<int32_t>(Frs2.sf); 512 }}); 513 0xD2: fdtoi({{ 514 Frd.sf = (float)static_cast<int32_t>(Frs2.df); 515 }}); 516 0xD3: Trap::fqtoi({{fault = new FpDisabled;}}); 517 default: Trap::fpop1({{fault = new FpDisabled;}}); 518 } |
519 } 520 0x35: Trap::fpop2({{fault = new FpDisabled;}}); 521 //This used to be just impdep1, but now it's a whole bunch 522 //of instructions 523 0x36: decode OPF{ 524 0x00: Trap::edge8({{fault = new IllegalInstruction;}}); 525 0x01: Trap::edge8n({{fault = new IllegalInstruction;}}); 526 0x02: Trap::edge8l({{fault = new IllegalInstruction;}}); --- 4 unchanged lines hidden (view full) --- 531 0x07: Trap::edge16ln({{fault = new IllegalInstruction;}}); 532 0x08: Trap::edge32({{fault = new IllegalInstruction;}}); 533 0x09: Trap::edge32n({{fault = new IllegalInstruction;}}); 534 0x0A: Trap::edge32l({{fault = new IllegalInstruction;}}); 535 0x0B: Trap::edge32ln({{fault = new IllegalInstruction;}}); 536 0x10: Trap::array8({{fault = new IllegalInstruction;}}); 537 0x12: Trap::array16({{fault = new IllegalInstruction;}}); 538 0x14: Trap::array32({{fault = new IllegalInstruction;}}); |
539 0x18: BasicOperate::alignaddress({{ 540 uint64_t sum = Rs1 + Rs2; 541 Frd = sum & ~7; 542 Gsr = (Gsr & ~7) | (sum & 7); 543 }}); |
544 0x19: Trap::bmask({{fault = new IllegalInstruction;}}); |
545 0x1A: BasicOperate::alignaddresslittle({{ 546 uint64_t sum = Rs1 + Rs2; 547 Frd = sum & ~7; 548 Gsr = (Gsr & ~7) | ((~sum + 1) & 7); 549 }}); |
550 0x20: Trap::fcmple16({{fault = new IllegalInstruction;}}); 551 0x22: Trap::fcmpne16({{fault = new IllegalInstruction;}}); 552 0x24: Trap::fcmple32({{fault = new IllegalInstruction;}}); 553 0x26: Trap::fcmpne32({{fault = new IllegalInstruction;}}); 554 0x28: Trap::fcmpgt16({{fault = new IllegalInstruction;}}); 555 0x2A: Trap::fcmpeq16({{fault = new IllegalInstruction;}}); 556 0x2C: Trap::fcmpgt32({{fault = new IllegalInstruction;}}); 557 0x2E: Trap::fcmpeq32({{fault = new IllegalInstruction;}}); 558 0x31: Trap::fmul8x16({{fault = new IllegalInstruction;}}); 559 0x33: Trap::fmul8x16au({{fault = new IllegalInstruction;}}); 560 0x35: Trap::fmul8x16al({{fault = new IllegalInstruction;}}); 561 0x36: Trap::fmul8sux16({{fault = new IllegalInstruction;}}); 562 0x37: Trap::fmul8ulx16({{fault = new IllegalInstruction;}}); 563 0x38: Trap::fmuld8sux16({{fault = new IllegalInstruction;}}); 564 0x39: Trap::fmuld8ulx16({{fault = new IllegalInstruction;}}); 565 0x3A: Trap::fpack32({{fault = new IllegalInstruction;}}); 566 0x3B: Trap::fpack16({{fault = new IllegalInstruction;}}); 567 0x3D: Trap::fpackfix({{fault = new IllegalInstruction;}}); 568 0x3E: Trap::pdist({{fault = new IllegalInstruction;}}); |
569 0x48: BasicOperate::faligndata({{ 570 uint64_t msbX = (uint64_t)Frs1; 571 uint64_t lsbX = (uint64_t)Frs2; 572 uint64_t msbShift = Gsr<2:0> * 8; 573 uint64_t lsbShift = (8 - Gsr<2:0>) * 8; 574 uint64_t msbMask = ((uint64_t)(-1)) << msbShift; 575 uint64_t lsbMask = ((uint64_t)(-1)) << lsbShift; 576 Frd = ((msbX << msbShift) & msbMask) | 577 ((lsbX << lsbShift) & lsbMask); 578 }}); |
579 0x4B: Trap::fpmerge({{fault = new IllegalInstruction;}}); 580 0x4C: Trap::bshuffle({{fault = new IllegalInstruction;}}); 581 0x4D: Trap::fexpand({{fault = new IllegalInstruction;}}); 582 0x50: Trap::fpadd16({{fault = new IllegalInstruction;}}); 583 0x51: Trap::fpadd16s({{fault = new IllegalInstruction;}}); 584 0x52: Trap::fpadd32({{fault = new IllegalInstruction;}}); 585 0x53: Trap::fpadd32s({{fault = new IllegalInstruction;}}); 586 0x54: Trap::fpsub16({{fault = new IllegalInstruction;}}); 587 0x55: Trap::fpsub16s({{fault = new IllegalInstruction;}}); 588 0x56: Trap::fpsub32({{fault = new IllegalInstruction;}}); 589 0x57: Trap::fpsub32s({{fault = new IllegalInstruction;}}); |
590 0x60: BasicOperate::fzero({{Frd.df = 0;}}); 591 0x61: BasicOperate::fzeros({{Frd.sf = 0;}}); |
592 0x62: Trap::fnor({{fault = new IllegalInstruction;}}); 593 0x63: Trap::fnors({{fault = new IllegalInstruction;}}); 594 0x64: Trap::fandnot2({{fault = new IllegalInstruction;}}); 595 0x65: Trap::fandnot2s({{fault = new IllegalInstruction;}}); |
596 0x66: BasicOperate::fnot2({{ 597 Frd.df = (double)(~((uint64_t)Frs2.df)); 598 }}); 599 0x67: BasicOperate::fnot2s({{ 600 Frd.sf = (float)(~((uint32_t)Frs2.sf)); 601 }}); |
602 0x68: Trap::fandnot1({{fault = new IllegalInstruction;}}); 603 0x69: Trap::fandnot1s({{fault = new IllegalInstruction;}}); |
604 0x6A: BasicOperate::fnot1({{ 605 Frd.df = (double)(~((uint64_t)Frs1.df)); 606 }}); 607 0x6B: BasicOperate::fnot1s({{ 608 Frd.sf = (float)(~((uint32_t)Frs1.sf)); 609 }}); |
610 0x6C: Trap::fxor({{fault = new IllegalInstruction;}}); 611 0x6D: Trap::fxors({{fault = new IllegalInstruction;}}); 612 0x6E: Trap::fnand({{fault = new IllegalInstruction;}}); 613 0x6F: Trap::fnands({{fault = new IllegalInstruction;}}); 614 0x70: Trap::fand({{fault = new IllegalInstruction;}}); 615 0x71: Trap::fands({{fault = new IllegalInstruction;}}); 616 0x72: Trap::fxnor({{fault = new IllegalInstruction;}}); 617 0x73: Trap::fxnors({{fault = new IllegalInstruction;}}); |
618 0x74: BasicOperate::fsrc1({{Frd.df = Frs1.df;}}); 619 0x75: BasicOperate::fsrc1s({{Frd.sf = Frs1.sf;}}); |
620 0x76: Trap::fornot2({{fault = new IllegalInstruction;}}); 621 0x77: Trap::fornot2s({{fault = new IllegalInstruction;}}); |
622 0x78: BasicOperate::fsrc2({{Frd.df = Frs2.df;}}); 623 0x79: BasicOperate::fsrc2s({{Frd.sf = Frs2.sf;}}); |
624 0x7A: Trap::fornot1({{fault = new IllegalInstruction;}}); 625 0x7B: Trap::fornot1s({{fault = new IllegalInstruction;}}); 626 0x7C: Trap::for({{fault = new IllegalInstruction;}}); 627 0x7D: Trap::fors({{fault = new IllegalInstruction;}}); 628 0x7E: Trap::fone({{fault = new IllegalInstruction;}}); 629 0x7F: Trap::fones({{fault = new IllegalInstruction;}}); 630 0x80: Trap::shutdown({{fault = new IllegalInstruction;}}); 631 0x81: Trap::siam({{fault = new IllegalInstruction;}}); --- 215 unchanged lines hidden (view full) --- 847 }}, {{8}}); 848 0x1E: Store::stxa({{Mem = Rd}}, {{64}}); 849 0x1F: LoadStore::swapa({{ 850 uint32_t temp = Rd; 851 Rd = Mem; 852 Mem = temp; 853 }}, {{32}}); 854 format Trap { |
855 0x20: Load::ldf({{Frd.sf = ((float)Mem);}}, {{32}}); |
856 0x21: decode X { 857 0x0: Load::ldfsr({{Fsr = Mem<31:0> | Fsr<63:32>;}}, {{32}}); 858 0x1: Load::ldxfsr({{Fsr = Mem;}}, {{64}}); 859 } 860 0x22: ldqf({{fault = new FpDisabled;}}); |
861 0x23: Load::lddf({{Frd.df = ((double)Mem);}}, {{64}}); 862 0x24: Store::stf({{Mem = ((int32_t)Frd.sf);}}, {{32}}); |
863 0x25: decode X { 864 0x0: Store::stfsr({{Mem = Fsr<31:0>;}}, {{32}}); 865 0x1: Store::stxfsr({{Mem = Fsr;}}, {{64}}); 866 } 867 0x26: stqf({{fault = new FpDisabled;}}); |
868 0x27: Store::stdf({{Mem = ((int64_t)Frd.df);}}, {{64}}); |
869 0x2D: Nop::prefetch({{ }}); |
870 0x30: Load::ldfa({{Frd.sf = ((float)Mem);}}, {{32}}); |
871 0x32: ldqfa({{fault = new FpDisabled;}}); |
872 0x33: Load::lddfa({{Frd.df = ((double)Mem);}}, {{64}}); 873 0x34: Store::stfa({{Mem = ((int32_t)Frd.sf);}}, {{32}}); |
874 0x36: stqfa({{fault = new FpDisabled;}}); 875 //XXX need to work in the ASI thing |
876 0x37: Store::stdfa({{Mem = ((uint64_t)Frd.df);}}, {{64}}); |
877 0x3C: Cas::casa({{ 878 uint64_t val = Mem.uw; 879 if(Rs2.uw == val) 880 Mem.uw = Rd.uw; 881 Rd.uw = val; 882 }}); 883 0x3D: Nop::prefetcha({{ }}); 884 0x3E: Cas::casxa({{ 885 uint64_t val = Mem.udw; 886 if(Rs2 == val) 887 Mem.udw = Rd; 888 Rd = val; 889 }}); 890 } 891 } 892} |