float Ship::Pe(float V){
	return ( Sw()/sqrt(Vol() * v.Lpp) * pow(Vol(), 2./3.) * pow(V, 3.) /580.) * (1 + e.SA/100.);
}
示例#2
0
void excute(){
    if(stall){
        extype = 0;
        EX = "NOP";
    }else {
        extype = idtype;
        EX = ID;
    }
    if(strcmp(EX,"ADD") == 0){
        if(Add(rs,rt,rd) < 0){
            error_no = 1;
        }
    }else if(strcmp(EX,"SUB") == 0){
        if(Sub(rs,rt,rd) < 0){
            error_no = 1;
        }
    }else if(strcmp(EX,"ADDU") == 0){
        Add(rs,rt,rd);
    }else if(strcmp(EX,"AND") == 0){
        And(rs,rt,rd);
    }else if(strcmp(EX,"OR") == 0){
        Or(rs,rt,rd);
    }else if(strcmp(EX,"XOR") == 0){
        Xor(rs,rt,rd);
    }else if(strcmp(EX,"NOR") == 0){
        Nor(rs,rt,rd);
    }else if(strcmp(EX,"NAND") == 0){
        Nand(rs,rt,rd);
    }else if(strcmp(EX,"SLT") == 0){
        Slt(rs,rt,rd);
    }else if(strcmp(EX,"SLL") == 0){
        Sll(rt,rd,shamt);
    }else if(strcmp(EX,"SRL") == 0){
        Srl(rt,rd,shamt);
    }else if(strcmp(EX,"SRA") == 0){
        Sra(rt,rd,shamt);
    }else if(strcmp(EX,"JR") == 0){
        PC = registers[rs];
    }else if(strcmp(EX,"ADDI") == 0){
        if(Addi(rs,rt,imm)<0){
            error_no = 1;
        }
    }else if(strcmp(EX,"ADDIU") == 0){
        Addiu(rs,rt,imm);
    }else if(strcmp(EX,"LW") == 0){
        Lw(rs,rt,imm);
    }else if(strcmp(EX,"LH") == 0){
        Lh(rs,rt,imm);
    }else if(strcmp(EX,"LHU") == 0){
        Lhu(rs,rt,imm);
    }else if(strcmp(EX,"LB") == 0){
        Lb(rs,rt,imm);
    }else if(strcmp(EX,"LBU") == 0){
        Lbu(rs,rt,imm);
    }else if(strcmp(EX,"SW") == 0){
        Sw(rs,rt,imm);
    }else if(strcmp(EX,"SH") == 0){
        Sh(rs,rt,imm);
    }else if(strcmp(EX,"SB") == 0){
        Sb(rs,rt,imm);
    }else if(strcmp(EX,"LUI") == 0){
        Lui(rt,imm);
    }else if(strcmp(EX,"ANDI") == 0){
        Andi(rs,rt,imm);
    }else if(strcmp(EX,"ORI") == 0){
        Ori(rs,rt,imm);
    }else if(strcmp(EX,"NORI") == 0){
        Nori(rs,rt,imm);
    }else if(strcmp(EX,"SLTI") == 0){
        Slti(rs,rt,imm);
    }else if(strcmp(EX,"JAL") == 0){
        registers[31] = PC;
        PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4;
    }else if(strcmp(EX,"J") == 0){
        PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4;
    }/*else if(strcmp(EX,"BEQ") == 0 || strcmp(EX,"BNE") == 0 || strcmp(EX,"BGTZ") == 0){
        PC = go;
    }*/


}