Main Page | Alphabetical List | Class List | File List | Class Members | File Members

Instruction Class Reference

#include <machine.h>

List of all members.

Public Member Functions

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(), and Machine::OneInstruction().

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(), and Machine::OneInstruction().

char Instruction::rs
 

Definition at line 89 of file machine.h.

Referenced by Decode(), and Machine::OneInstruction().

char Instruction::rt
 

Definition at line 89 of file machine.h.

Referenced by Decode(), and Machine::OneInstruction().

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 Thu Sep 16 12:33:48 2004 for NachOS by doxygen 1.3.8