Exemplo n.º 1
0
void Processor::PrintProcState()
{
    PrintAccumulator();
    PrintInstrCntr();
    PrintInstrRg();
    PrintOperCode();
    PrintOperand();
}
Exemplo n.º 2
0
void MipsEnv::StepExec (void)
{
    if (IsStopSim() == true) {
        return;
    }

    SetJumped (false);

    Word_t inst_hex;
    int32_t fetch_res;
    Addr_t  fetch_pc = GetPC();
    fetch_res = FetchMemory (fetch_pc, &inst_hex);

    if (fetch_res == -1) {
        DebugPrint ("<Error: Instructino is Misaligned>\n");
        return;
    }

    std::string func_symbol;
    if ((IsDebugFunc () == true) &&
        (FindSymbol (fetch_pc, &func_symbol) == true)) {
        DebugPrint ("<Func: %s>\n", func_symbol.c_str());
    }

    GetTrace()->SetInstHex (inst_hex);
    GetTrace()->SetTracePC (GetPC());
    GetTrace()->SetStep(GetStep());

    AdvanceStep ();    // Update Step Information

    uint32_t  inst_idx = MIPS_DEC (inst_hex);
    GetTrace()->SetInstIdx (inst_idx);

    if (inst_idx == static_cast<uint32_t>(-1)) {
        DebugPrint ("<Error: instruction is not decoded. [%08x]=%08x\n", GetPC (), inst_hex);
        exit (EXIT_FAILURE);
    } else {

        m_inst_env->MIPS_Inst_Exec (inst_idx, inst_hex);

        if (IsDebugTrace() == true) {
            if (GetTrace()->IsDelayedSlot() == false) {

                DebugPrint ("%10d : ", GetTrace()->GetStep ());
                DebugPrint ("[%08x] %08x : ", GetTrace()->GetTracePC (), GetTrace()->GetInstHex ());
                char inst_string[31];
                PrintInst (GetTrace()->GetInstHex(), GetTrace()->GetInstIdx(),
                           inst_string, 30);
                DebugPrint ("%-30s  ", inst_string);
                std::stringstream operand_str;
                PrintOperand (&operand_str);

                DebugPrint ("%s\n", operand_str.str().c_str());

                if (GetTrace()->IsDelayedSlotExecuted () != 0) {
                    GetTrace()->SetDelayedSlot ();
                    DebugPrint ("%10d : ", GetTrace()->GetStep ());
                    DebugPrint ("[%08x] %08x : ", GetTrace()->GetTracePC (), GetTrace()->GetInstHex());
                    char inst_string[31];
                    PrintInst (GetTrace()->GetInstHex(), GetTrace()->GetInstIdx(),
                               inst_string, 30);
                    DebugPrint ("%-30s  ", inst_string);
                    std::stringstream operand_str;
                    PrintOperand (&operand_str);
                    DebugPrint ("%s\n", operand_str.str().c_str());
                    GetTrace()->ClearDelayedSlot ();
                }
            }
        }
    }

    if ((GetTrace()->IsDelayedSlot() == false) && (GetJumped () == false)) {
        ProceedPC ();      // Update PC
    }
}