Main Page   Compound List   File List   Compound Members   File Members  

Instruction Class Reference

#include <machine.h>

List of all members.

Public Methods

void Decode ()

Public Attributes

unsigned int value
char opCode
char rs
char rt
char rd
int extra


Member Function Documentation

void Instruction::Decode  
 

Definition at line 590 of file mipssim.cc.

References BCOND, extra, OpInfo::format, IFMT, OP_BGEZ, OP_BGEZAL, OP_BLTZ, OP_BLTZAL, OP_UNIMP, OpInfo::opCode, opCode, rd, RFMT, rs, rt, SPECIAL, and value.

Referenced by Machine::OneInstruction.

00591 {
00592     OpInfo *opPtr;
00593     
00594     rs = (value >> 21) & 0x1f;
00595     rt = (value >> 16) & 0x1f;
00596     rd = (value >> 11) & 0x1f;
00597     opPtr = &opTable[(value >> 26) & 0x3f];
00598     opCode = opPtr->opCode;
00599     if (opPtr->format == IFMT) {
00600         extra = value & 0xffff;
00601         if (extra & 0x8000) {
00602            extra |= 0xffff0000;
00603         }
00604     } else if (opPtr->format == RFMT) {
00605         extra = (value >> 6) & 0x1f;
00606     } else {
00607         extra = value & 0x3ffffff;
00608     }
00609     if (opCode == SPECIAL) {
00610         opCode = specialTable[value & 0x3f];
00611     } else if (opCode == BCOND) {
00612         int i = value & 0x1f0000;
00613 
00614         if (i == 0) {
00615             opCode = OP_BLTZ;
00616         } else if (i == 0x10000) {
00617             opCode = OP_BGEZ;
00618         } else if (i == 0x100000) {
00619             opCode = OP_BLTZAL;
00620         } else if (i == 0x110000) {
00621             opCode = OP_BGEZAL;
00622         } else {
00623             opCode = OP_UNIMP;
00624         }
00625     }
00626 }


Member Data Documentation

int Instruction::extra
 

Definition at line 90 of file machine.h.

Referenced by Decode, Machine::OneInstruction, and TypeToReg.

char Instruction::opCode
 

Definition at line 87 of file machine.h.

Referenced by Decode, and Machine::OneInstruction.

char Instruction::rd
 

Definition at line 89 of file machine.h.

Referenced by Decode, Machine::OneInstruction, and TypeToReg.

char Instruction::rs
 

Definition at line 89 of file machine.h.

Referenced by Decode, Machine::OneInstruction, and TypeToReg.

char Instruction::rt
 

Definition at line 89 of file machine.h.

Referenced by Decode, Machine::OneInstruction, and TypeToReg.

unsigned int Instruction::value
 

Definition at line 85 of file machine.h.

Referenced by Decode, and Machine::OneInstruction.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 09:54:56 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees