decoder.isa (3531:51eb743f38f5) decoder.isa (3587:841cf134f321)
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

--- 332 unchanged lines hidden (view full) ---

341 0x26: decode X {
342 0x0: srl({{Rd = Rs1.uw >> (I ? SHCNT32 : Rs2<4:0>);}});
343 0x1: srlx({{Rd = Rs1.udw >> (I ? SHCNT64 : Rs2<5:0>);}});
344 }
345 0x27: decode X {
346 0x0: sra({{Rd = Rs1.sw >> (I ? SHCNT32 : Rs2<4:0>);}});
347 0x1: srax({{Rd = Rs1.sdw >> (I ? SHCNT64 : Rs2<5:0>);}});
348 }
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

--- 332 unchanged lines hidden (view full) ---

341 0x26: decode X {
342 0x0: srl({{Rd = Rs1.uw >> (I ? SHCNT32 : Rs2<4:0>);}});
343 0x1: srlx({{Rd = Rs1.udw >> (I ? SHCNT64 : Rs2<5:0>);}});
344 }
345 0x27: decode X {
346 0x0: sra({{Rd = Rs1.sw >> (I ? SHCNT32 : Rs2<4:0>);}});
347 0x1: srax({{Rd = Rs1.sdw >> (I ? SHCNT64 : Rs2<5:0>);}});
348 }
349 // XXX might want a format rdipr thing here
350 0x28: decode RS1 {
349 0x28: decode RS1 {
351 0xF: decode I {
350 0x00: NoPriv::rdy({{Rd = Y;}});
351 //1 should cause an illegal instruction exception
352 0x02: NoPriv::rdccr({{Rd = Ccr;}});
353 0x03: NoPriv::rdasi({{Rd = Asi;}});
354 0x04: PrivCheck::rdtick({{Rd = Tick;}}, {{Tick<63:>}});
355 0x05: NoPriv::rdpc({{
356 if(Pstate<3:>)
357 Rd = (xc->readPC())<31:0>;
358 else
359 Rd = xc->readPC();}});
360 0x06: NoPriv::rdfprs({{
361 //Wait for all fpops to finish.
362 Rd = Fprs;
363 }});
364 //7-14 should cause an illegal instruction exception
365 0x0F: decode I {
352 0x0: Nop::stbar({{/*stuff*/}});
353 0x1: Nop::membar({{/*stuff*/}});
354 }
366 0x0: Nop::stbar({{/*stuff*/}});
367 0x1: Nop::membar({{/*stuff*/}});
368 }
355 default: rdasr({{
356 Rd = xc->readMiscRegWithEffect(RS1 + AsrStart);
369 0x10: Priv::rdpcr({{Rd = Pcr;}});
370 0x11: PrivCheck::rdpic({{Rd = Pic;}}, {{Pcr<0:>}});
371 //0x12 should cause an illegal instruction exception
372 0x13: NoPriv::rdgsr({{
373 if(Fprs<2:> == 0 || Pstate<4:> == 0)
374 Rd = Gsr;
375 else
376 fault = new FpDisabled;
357 }});
377 }});
378 //0x14-0x15 should cause an illegal instruction exception
379 0x16: Priv::rdsoftint({{Rd = Softint;}});
380 0x17: Priv::rdtick_cmpr({{Rd = TickCmpr;}});
381 0x18: PrivCheck::rdstick({{Rd = Stick}}, {{Stick<63:>}});
382 0x19: Priv::rdstick_cmpr({{Rd = StickCmpr;}});
383 //0x1A-0x1F should cause an illegal instruction exception
358 }
384 }
359 0x29: HPriv::rdhpr({{
360 Rd = xc->readMiscRegWithEffect(RS1 + HprStart);
361 }});
362 0x2A: Priv::rdpr({{
363 Rd = xc->readMiscRegWithEffect(RS1 + PrStart);
364 }});
385 0x29: decode RS1 {
386 0x00: HPriv::rdhprhpstate({{Rd = Hpstate;}});
387 0x01: HPriv::rdhprhtstate({{
388 if(Tl == 0)
389 return new IllegalInstruction;
390 Rd = Htstate;
391 }});
392 //0x02 should cause an illegal instruction exception
393 0x03: HPriv::rdhprhintp({{Rd = Hintp;}});
394 //0x04 should cause an illegal instruction exception
395 0x05: HPriv::rdhprhtba({{Rd = Htba;}});
396 0x06: HPriv::rdhprhver({{Rd = Hver;}});
397 //0x07-0x1E should cause an illegal instruction exception
398 0x1F: HPriv::rdhprhstick_cmpr({{Rd = HstickCmpr;}});
399 }
400 0x2A: decode RS1 {
401 0x00: Priv::rdprtpc({{
402 if(Tl == 0)
403 return new IllegalInstruction;
404 Rd = Tpc;
405 }});
406 0x01: Priv::rdprtnpc({{
407 if(Tl == 0)
408 return new IllegalInstruction;
409 Rd = Tnpc;
410 }});
411 0x02: Priv::rdprtstate({{
412 if(Tl == 0)
413 return new IllegalInstruction;
414 Rd = Tstate;
415 }});
416 0x03: Priv::rdprtt({{
417 if(Tl == 0)
418 return new IllegalInstruction;
419 Rd = Tt;
420 }});
421 0x04: Priv::rdprtick({{Rd = Tick;}});
422 0x05: Priv::rdprtba({{Rd = Tba;}});
423 0x06: Priv::rdprpstate({{Rd = Pstate;}});
424 0x07: Priv::rdprtl({{Rd = Tl;}});
425 0x08: Priv::rdprpil({{Rd = Pil;}});
426 0x09: Priv::rdprcwp({{Rd = Cwp;}});
427 0x0A: Priv::rdprcansave({{Rd = Cansave;}});
428 0x0B: Priv::rdprcanrestore({{Rd = Canrestore;}});
429 0x0C: Priv::rdprcleanwin({{Rd = Cleanwin;}});
430 0x0D: Priv::rdprotherwin({{Rd = Otherwin;}});
431 0x0E: Priv::rdprwstate({{Rd = Wstate;}});
432 //0x0F should cause an illegal instruction exception
433 0x10: Priv::rdprgl({{Rd = Gl;}});
434 //0x11-0x1F should cause an illegal instruction exception
435 }
365 0x2B: BasicOperate::flushw({{
366 if(NWindows - 2 - Cansave == 0)
367 {
368 if(Otherwin)
369 fault = new SpillNOther(Wstate<5:3>);
370 else
371 fault = new SpillNNormal(Wstate<2:0>);
372 }

--- 39 unchanged lines hidden (view full) ---

412 {
413 0x1: movreq({{Rd = (Rs1.sdw == 0) ? Rs2_or_imm10 : Rd;}});
414 0x2: movrle({{Rd = (Rs1.sdw <= 0) ? Rs2_or_imm10 : Rd;}});
415 0x3: movrl({{Rd = (Rs1.sdw < 0) ? Rs2_or_imm10 : Rd;}});
416 0x5: movrne({{Rd = (Rs1.sdw != 0) ? Rs2_or_imm10 : Rd;}});
417 0x6: movrg({{Rd = (Rs1.sdw > 0) ? Rs2_or_imm10 : Rd;}});
418 0x7: movrge({{Rd = (Rs1.sdw >= 0) ? Rs2_or_imm10 : Rd;}});
419 }
436 0x2B: BasicOperate::flushw({{
437 if(NWindows - 2 - Cansave == 0)
438 {
439 if(Otherwin)
440 fault = new SpillNOther(Wstate<5:3>);
441 else
442 fault = new SpillNNormal(Wstate<2:0>);
443 }

--- 39 unchanged lines hidden (view full) ---

483 {
484 0x1: movreq({{Rd = (Rs1.sdw == 0) ? Rs2_or_imm10 : Rd;}});
485 0x2: movrle({{Rd = (Rs1.sdw <= 0) ? Rs2_or_imm10 : Rd;}});
486 0x3: movrl({{Rd = (Rs1.sdw < 0) ? Rs2_or_imm10 : Rd;}});
487 0x5: movrne({{Rd = (Rs1.sdw != 0) ? Rs2_or_imm10 : Rd;}});
488 0x6: movrg({{Rd = (Rs1.sdw > 0) ? Rs2_or_imm10 : Rd;}});
489 0x7: movrge({{Rd = (Rs1.sdw >= 0) ? Rs2_or_imm10 : Rd;}});
490 }
420 0x30: wrasr({{
421 xc->setMiscRegWithEffect(RD + AsrStart, Rs1 ^ Rs2_or_imm13);
422 }});
491 0x30: decode RD {
492 0x00: NoPriv::wry({{Y = Rs1 ^ Rs2_or_imm13;}});
493 //0x01 should cause an illegal instruction exception
494 0x02: NoPriv::wrccr({{Ccr = Rs1 ^ Rs2_or_imm13;}});
495 0x03: NoPriv::wrasi({{Ccr = Rs1 ^ Rs2_or_imm13;}});
496 //0x04-0x05 should cause an illegal instruction exception
497 0x06: NoPriv::wrfprs({{Fprs = Rs1 ^ Rs2_or_imm13;}});
498 //0x07-0x0E should cause an illegal instruction exception
499 0x0F: Trap::softreset({{fault = new SoftwareInitiatedReset;}});
500 0x10: Priv::wrpcr({{Pcr = Rs1 ^ Rs2_or_imm13;}});
501 0x11: PrivCheck::wrpic({{Pic = Rs1 ^ Rs2_or_imm13;}}, {{Pcr<0:>}});
502 //0x12 should cause an illegal instruction exception
503 0x13: NoPriv::wrgsr({{
504 if(Fprs<2:> == 0 || Pstate<4:> == 0)
505 return new FpDisabled;
506 Gsr = Rs1 ^ Rs2_or_imm13;
507 }});
508 0x14: Priv::wrsoftint_set({{SoftintSet = Rs1 ^ Rs2_or_imm13;}});
509 0x15: Priv::wrsoftint_clr({{SoftintClr = Rs1 ^ Rs2_or_imm13;}});
510 0x16: Priv::wrsoftint({{Softint = Rs1 ^ Rs2_or_imm13;}});
511 0x17: Priv::wrtick_cmpr({{TickCmpr = Rs1 ^ Rs2_or_imm13;}});
512 0x18: NoPriv::wrstick({{
513 if(!Hpstate<2:>)
514 return new IllegalInstruction;
515 Stick = Rs1 ^ Rs2_or_imm13;
516 }});
517 0x19: Priv::wrstick_cmpr({{StickCmpr = Rs1 ^ Rs2_or_imm13;}});
518 //0x1A-0x1F should cause an illegal instruction exception
519 }
423 0x31: decode FCN {
424 0x0: Priv::saved({{
425 assert(Cansave < NWindows - 2);
426 assert(Otherwin || Canrestore);
427 Cansave = Cansave + 1;
428 if(Otherwin == 0)
429 Canrestore = Canrestore - 1;
430 else

--- 4 unchanged lines hidden (view full) ---

435 assert(Canrestore < NWindows - 2);
436 Canrestore = Canrestore + 1;
437 if(Otherwin == 0)
438 Cansave = Cansave - 1;
439 else
440 Otherwin = Otherwin - 1;
441 }});
442 }
520 0x31: decode FCN {
521 0x0: Priv::saved({{
522 assert(Cansave < NWindows - 2);
523 assert(Otherwin || Canrestore);
524 Cansave = Cansave + 1;
525 if(Otherwin == 0)
526 Canrestore = Canrestore - 1;
527 else

--- 4 unchanged lines hidden (view full) ---

532 assert(Canrestore < NWindows - 2);
533 Canrestore = Canrestore + 1;
534 if(Otherwin == 0)
535 Cansave = Cansave - 1;
536 else
537 Otherwin = Otherwin - 1;
538 }});
539 }
443 0x32: Priv::wrpr({{
444 // XXX Need to protect with format that traps non-priv
445 // access
446 xc->setMiscRegWithEffect(RD + PrStart, Rs1 ^ Rs2_or_imm13);
447 }});
448 0x33: HPriv::wrhpr({{
449 // XXX Need to protect with format that traps non-priv/priv
450 // access
451 xc->setMiscRegWithEffect(RD + HprStart, Rs1 ^ Rs2_or_imm13);
452 }});
540 0x32: decode RD {
541 0x00: Priv::wrprtpc({{
542 if(Tl == 0)
543 return new IllegalInstruction;
544 else
545 Tpc = Rs1 ^ Rs2_or_imm13;
546 }});
547 0x01: Priv::wrprtnpc({{
548 if(Tl == 0)
549 return new IllegalInstruction;
550 else
551 Tnpc = Rs1 ^ Rs2_or_imm13;
552 }});
553 0x02: Priv::wrprtstate({{
554 if(Tl == 0)
555 return new IllegalInstruction;
556 else
557 Tstate = Rs1 ^ Rs2_or_imm13;
558 }});
559 0x03: Priv::wrprtt({{
560 if(Tl == 0)
561 return new IllegalInstruction;
562 else
563 Tt = Rs1 ^ Rs2_or_imm13;
564 }});
565 0x04: HPriv::wrprtick({{Tick = Rs1 ^ Rs2_or_imm13;}});
566 0x05: Priv::wrprtba({{Tba = Rs1 ^ Rs2_or_imm13;}});
567 0x06: Priv::wrprpstate({{Pstate = Rs1 ^ Rs2_or_imm13;}});
568 0x07: Priv::wrprtl({{
569 if(Pstate<2:> && !Hpstate<2:>)
570 Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPTL);
571 else
572 Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxTL);
573 }});
574 0x08: Priv::wrprpil({{Pil = Rs1 ^ Rs2_or_imm13;}});
575 0x09: Priv::wrprcwp({{Cwp = Rs1 ^ Rs2_or_imm13;}});
576 0x0A: Priv::wrprcansave({{Cansave = Rs1 ^ Rs2_or_imm13;}});
577 0x0B: Priv::wrprcanrestore({{Canrestore = Rs1 ^ Rs2_or_imm13;}});
578 0x0C: Priv::wrprcleanwin({{Cleanwin = Rs1 ^ Rs2_or_imm13;}});
579 0x0D: Priv::wrprotherwin({{Otherwin = Rs1 ^ Rs2_or_imm13;}});
580 0x0E: Priv::wrprwstate({{Wstate = Rs1 ^ Rs2_or_imm13;}});
581 //0x0F should cause an illegal instruction exception
582 0x10: Priv::wrprgl({{
583 if(Pstate<2:> && !Hpstate<2:>)
584 Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPGL);
585 else
586 Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxGL);
587 }});
588 //0x11-0x1F should cause an illegal instruction exception
589 }
590 0x33: decode RD {
591 0x00: HPriv::wrhprhpstate({{Hpstate = Rs1 ^ Rs2_or_imm13;}});
592 0x01: HPriv::wrhprhtstate({{
593 if(Tl == 0)
594 return new IllegalInstruction;
595 Htstate = Rs1 ^ Rs2_or_imm13;
596 }});
597 //0x02 should cause an illegal instruction exception
598 0x03: HPriv::wrhprhintp({{Hintp = Rs1 ^ Rs2_or_imm13;}});
599 //0x04 should cause an illegal instruction exception
600 0x05: HPriv::wrhprhtba({{Htba = Rs1 ^ Rs2_or_imm13;}});
601 //0x06-0x01D should cause an illegal instruction exception
602 0x1F: HPriv::wrhprhstick_cmpr({{HstickCmpr = Rs1 ^ Rs2_or_imm13;}});
603 }
453 0x34: decode OPF{
454 format BasicOperate{
455 0x01: fmovs({{
456 Frds.uw = Frs2s.uw;
457 //fsr.ftt = fsr.cexc = 0
458 Fsr &= ~(7 << 14);
459 Fsr &= ~(0x1F);
460 }});

--- 632 unchanged lines hidden ---
604 0x34: decode OPF{
605 format BasicOperate{
606 0x01: fmovs({{
607 Frds.uw = Frs2s.uw;
608 //fsr.ftt = fsr.cexc = 0
609 Fsr &= ~(7 << 14);
610 Fsr &= ~(0x1F);
611 }});

--- 632 unchanged lines hidden ---