aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-04-02 17:02:20 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-04-02 17:02:20 +0200
commit476af4ac713b88597e628ff8415ae2890757d574 (patch)
tree33fc90a3b44ae2bc5da6fda924444beb455a59a4 /qtmips_machine
parent71a7c2e6791d62eaeddf8bd143c7cc1233912f2b (diff)
downloadqtmips-476af4ac713b88597e628ff8415ae2890757d574.tar.gz
qtmips-476af4ac713b88597e628ff8415ae2890757d574.tar.bz2
qtmips-476af4ac713b88597e628ff8415ae2890757d574.zip
Implement stall cycles counter and view of CPU cycles counter.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/core.cpp7
-rw-r--r--qtmips_machine/core.h5
2 files changed, 12 insertions, 0 deletions
diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp
index 9e285a4..88b2fe2 100644
--- a/qtmips_machine/core.cpp
+++ b/qtmips_machine/core.cpp
@@ -43,6 +43,7 @@ Core::Core(Registers *regs, MemoryAccess *mem_program, MemoryAccess *mem_data,
unsigned int min_cache_row_size, Cop0State *cop0state) :
ex_handlers(), hw_breaks() {
cycle_c = 0;
+ stall_c = 0;
this->regs = regs;
this->cop0state = cop0state;
this->mem_program = mem_program;
@@ -61,11 +62,13 @@ Core::Core(Registers *regs, MemoryAccess *mem_program, MemoryAccess *mem_data,
void Core::step(bool skip_break) {
cycle_c++;
+ emit cycle_c_value(cycle_c);
do_step(skip_break);
}
void Core::reset() {
cycle_c = 0;
+ stall_c = 0;
do_reset();
}
@@ -903,6 +906,10 @@ void CorePipelined::do_step(bool skip_break) {
}
// emit instruction_decoded(dt_d.inst, dt_d.inst_addr, dt_d.excause, dt_d.is_valid);
}
+ if (stall || dt_d.stop_if) {
+ stall_c++;
+ emit stall_c_value(stall_c);
+ }
}
void CorePipelined::do_reset() {
diff --git a/qtmips_machine/core.h b/qtmips_machine/core.h
index 8672850..ff589c5 100644
--- a/qtmips_machine/core.h
+++ b/qtmips_machine/core.h
@@ -165,6 +165,9 @@ signals:
void hu_stall_value(std::uint32_t);
void branch_forward_value(std::uint32_t);
+ void cycle_c_value(std::uint32_t);
+ void stall_c_value(std::uint32_t);
+
void stop_on_exception_reached();
protected:
@@ -273,6 +276,8 @@ protected:
void dtExecuteInit(struct dtExecute &dt);
void dtMemoryInit(struct dtMemory &dt);
+protected:
+ unsigned int stall_c;
private:
struct hwBreak{
hwBreak(std::uint32_t addr);