Bug fix and some extra debugging info.

git-svn-id: http://www.cdkersey.com/harp/harptool@114 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
chad
2013-01-17 09:01:25 +00:00
parent c8460123f7
commit 3ceabe2a61

View File

@@ -80,8 +80,8 @@ void Core::step() {
} catch (MemoryUnit::PageFault pf) { } catch (MemoryUnit::PageFault pf) {
fetchPos = 0; fetchPos = 0;
fetchMore = true; fetchMore = true;
reg[0][1] = pf.faultAddr;
interrupt(pf.notFound?1:2); interrupt(pf.notFound?1:2);
reg[0][1] = pf.faultAddr;
} }
} while (fetchMore); } while (fetchMore);
D(3, "Fetched at 0x" << hex << pc); D(3, "Fetched at 0x" << hex << pc);
@@ -95,24 +95,40 @@ void Core::step() {
} }
#endif #endif
/* Update pc */ // Update pc
pc += decPos; pc += decPos;
/* Execute */ // Execute
try { try {
inst->executeOn(*this); inst->executeOn(*this);
} catch (MemoryUnit::PageFault pf) { } catch (MemoryUnit::PageFault pf) {
pc -= decPos; /* Reset to beginning of faulting address. */ pc -= decPos; /* Reset to beginning of faulting address. */
reg[0][1] = pf.faultAddr;
interrupt(pf.notFound?1:2); interrupt(pf.notFound?1:2);
reg[0][1] = pf.faultAddr;
} catch (DivergentBranchException e) { } catch (DivergentBranchException e) {
pc -= decPos; pc -= decPos;
interrupt(4); interrupt(4);
} catch (DomainException e) { } catch (DomainException e) {
interrupt(5); interrupt(5);
} }
// At Debug Level 3, print debug info after each instruction.
#ifdef USE_DEBUG
if (USE_DEBUG >= 3) {
D(3, "Register state:");
for (unsigned i = 0; i < reg[0].size(); ++i)
D_RAW(" %r" << i << ": " << hex << reg[0][i]
<< '(' << shadowReg[i] << ')' << endl);
D(3, "Predicate state:");
D_RAW(" ");
for (unsigned i = 0; i < pred[0].size(); ++i) D_RAW(pred[0][i]);
D_RAW(endl << " (");
for (unsigned i = 0; i < shadowPReg.size(); ++i) D_RAW(shadowPReg[i]);
D_RAW(endl);
}
#endif
/* Clean up. */ // Clean up.
delete inst; delete inst;
} }