diff options
author | Karel Kočí <cynerd@email.cz> | 2018-01-11 22:44:27 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-01-11 22:44:27 +0100 |
commit | 9a3b0dccb3dcb958b6a5c0cd72e8684887b4c4bf (patch) | |
tree | 6fe053723f205516f23427a05bd7c235ce88b32a /qtmips_cli/tracer.cpp | |
parent | 4621754239e9464e097a32d087fe0262e21c5bb7 (diff) | |
download | qtmips-9a3b0dccb3dcb958b6a5c0cd72e8684887b4c4bf.tar.gz qtmips-9a3b0dccb3dcb958b6a5c0cd72e8684887b4c4bf.tar.bz2 qtmips-9a3b0dccb3dcb958b6a5c0cd72e8684887b4c4bf.zip |
Allow instruction trace from any stage
In reality this internally allows us to see stages even it we are not
using pipelining but that is hidden from outside simply to not confuse
user.
Diffstat (limited to 'qtmips_cli/tracer.cpp')
-rw-r--r-- | qtmips_cli/tracer.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/qtmips_cli/tracer.cpp b/qtmips_cli/tracer.cpp index ca66e09..4438fd8 100644 --- a/qtmips_cli/tracer.cpp +++ b/qtmips_cli/tracer.cpp @@ -25,7 +25,23 @@ Tracer::Tracer(QtMipsMachine *machine) { } while(false) void Tracer::fetch() { - CON(con_fetch, machine->core(), instruction_fetched(machine::Instruction&), instruction_fetch(machine::Instruction&)); + CON(con_fetch, machine->core(), instruction_fetched(const machine::Instruction&), instruction_fetch(const machine::Instruction&)); +} + +void Tracer::decode() { + CON(con_fetch, machine->core(), instruction_decoded(const machine::Instruction&), instruction_decode(const machine::Instruction&)); +} + +void Tracer::execute() { + CON(con_fetch, machine->core(), instruction_executed(const machine::Instruction&), instruction_execute(const machine::Instruction&)); +} + +void Tracer::memory() { + CON(con_fetch, machine->core(), instruction_memory(const machine::Instruction&), instruction_memory(const machine::Instruction&)); +} + +void Tracer::writeback() { + CON(con_fetch, machine->core(), instruction_writeback(const machine::Instruction&), instruction_writeback(const machine::Instruction&)); } void Tracer::reg_pc() { @@ -48,8 +64,24 @@ void Tracer::reg_hi() { r_hi = true; } -void Tracer::instruction_fetch(Instruction &inst) { - cout << inst.to_str().toStdString() << endl; +void Tracer::instruction_fetch(const Instruction &inst) { + cout << "Fetch: " << inst.to_str().toStdString() << endl; +} + +void Tracer::instruction_decode(const machine::Instruction &inst) { + cout << "Decode: " << inst.to_str().toStdString() << endl; +} + +void Tracer::instruction_execute(const machine::Instruction &inst) { + cout << "Execute: " << inst.to_str().toStdString() << endl; +} + +void Tracer::instruction_memory(const machine::Instruction &inst) { + cout << "Memory: " << inst.to_str().toStdString() << endl; +} + +void Tracer::instruction_writeback(const machine::Instruction &inst) { + cout << "Writeback: " << inst.to_str().toStdString() << endl; } void Tracer::regs_pc_update(std::uint32_t val) { |