示例#1
0
文件: TGA.cpp 项目: MGraefe/deferred
int CRLEHeader::Num( void ) const
{
    if( Cpr() )
        return m_val - 128 + 1;
    else
        return m_val + 1;
}
示例#2
0
void Itype(unsigned int b){
    idtype = 'I';
    if(op == 0x04){
        if(((wbad == rs || wbad == rt) && (wbad != -1 && wbad != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(rs == rt){
                    PC = PC + S(imm)*4 - 4;
                    if(S(imm) != 1)flush = 1;
                }else if(wbad == rs){
                    if(CprF(wbrs,registers[rt]) == 0){
                        PC = PC + S(imm)*4 - 4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_Bie = 1;
                    fwdr = rs;
                }else{
                    if(CprF(registers[rs],wbrs) == 0){
                        PC = PC + S(imm)*4 -4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 't';
                    for_Bie = 1;
                    fwdr = rt;
                }
                stall = 0;
            }
        }else if(((wbadd == rs || wbadd == rt) && (wbadd != -1 && wbadd != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(rs == rt){
                    PC = PC + S(imm)*4 - 4;
                    if(S(imm) != 1)flush = 1;
                }else if(wbadd == rs){
                    if(CprF(wbrsd,registers[rt]) == 0){
                        PC = PC + S(imm)*4 - 4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_B = 1;
                    fwdr = rs;
                }else{
                    if(CprF(registers[rs],wbrsd) == 0){
                        PC = PC + S(imm)*4 -4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 't';
                    for_B = 1;
                    fwdr = rt;
                }
                stall = 0;
            }
        }else if(Cpr(registers[rs],registers[rt]) == 0){
            PC = PC + S(imm)*4-4;
            if(S(imm) != 1)flush = 1;
        }else{
            go = PC+4;
        }
        stall = 0;
        ID = "BEQ";
    }else if(op == 0x05){
        if(((wbad == rs || wbad == rt) && (wbad != -1 && wbad != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(rs == rt){

                }else if(wbad == rs){
                    if(CprF(wbrs,registers[rt]) != 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_Bie = 1;
                    fwdr = rs;
                }else{
                    if(CprF(registers[rs],wbrs) != 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 't';
                    for_Bie = 1;
                    fwdr = rt;
                }
                stall = 0;
            }
        }else if(((wbadd == rs || wbadd == rt) && (wbadd != -1 && wbadd != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(rs == rt){

                }else if(wbadd == rs){
                    if(CprF(wbrsd,registers[rt]) != 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_B = 1;
                    fwdr = rs;
                }else{
                    if(CprF(registers[rs],wbrsd) != 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 't';
                    for_B = 1;
                    fwdr = rt;
                }
                stall = 0;
            }
        }else if(Cpr(registers[rs],registers[rt]) != 0){
            PC = PC + S(imm)*4-4;
            if(S(imm) != 1)flush = 1;
        }else{
            go = PC+4;
        }
        stall = 0;
        ID = "BNE";
    }else if(op == 0x07){
        if(((wbad == rs) && (wbad != -1 && wbad != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(wbad == rs){
                    if(wbrs > 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_Bie = 1;
                    fwdr = rs;
                }
                stall = 0;
            }
        }else if(((wbadd == rs) && (wbadd != -1 && wbadd != 0))){
            if(idtype == 'L'){
                stall = 1;
            }else{
                if(wbadd == rs){
                    if(wbrsd > 0){
                        PC = PC + S(imm)*4-4;
                        if(S(imm) != 1)flush = 1;
                    }else{
                        go = PC+4;
                    }
                    forad = 's';
                    for_B = 1;
                    fwdr = rs;
                }
                stall = 0;
            }
        }else{
            if(registers[rs]>0){
                PC = PC + S(imm)*4-4;
                if(S(imm) != 1)flush = 1;
            }else{
                go = PC+4;
            }
            stall = 0;
        }
        ID = "BGTZ";
    }else if((wbad == rs && (wbad != -1 && wbad != 0)) ){
        if(idtype == 'L'){
            stall = 1;
        }else{
            for_id = 1;
            forad = 's';
            fwdr = rs;
        }
    }else if((wbadd == rs && (wbadd != -1 && wbadd != 0))){
        if(idtype == 'L'){
            stall = 1;
        }else{
            for_ex = 1;
            forad = 's';
            fwdr = rs;
        }
        stall = 1;
    }else stall = 0;
    if(op == 0x08){
        ID = "ADDI";
    }else if(op == 0x09){
        ID = "ADDIU";
    }else if(op == 0x23){
        idtype = 'L';
        ID = "LW";
    }else if(op == 0x21){
        idtype = 'L';
        ID = "LH";
    }else if(op == 0x25){
        idtype = 'L';
        ID = "LHU";
    }else if(op == 0x20){
        idtype = 'L';
        ID = "LB";
    }else if(op == 0x24){
        idtype = 'L';
        ID = "LBU";
    }else if(op == 0x2B){
        idtype = 'S';
        ID = "SW";
    }else if(op == 0x29){
        idtype = 'S';
        ID = "SH";
    }else if(op == 0x28){
        idtype = 'S';
        ID = "SB";
    }else if(op == 0x0f){
        idtype = 'L';
        ID = "LUI";
    }else if(op == 0x0c){
        ID = "ANDI";
    }else if(op == 0x0d){
        ID = "ORI";
    }else if(op == 0x0e){
        ID = "NORI";
    }else if(op == 0x0a){
        ID = "SLTI";
    }
}