aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-04 18:44:28 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-04 18:44:28 +0100
commitc06242f07721a7d86dc2d9795622d6646ae6c88f (patch)
tree55a264c093ce4e7719e87c9ac187635f9f97df63 /qtmips_machine
parent5eccfdab52973f9be9e38c65c17a33e8d2428692 (diff)
downloadqtmips-c06242f07721a7d86dc2d9795622d6646ae6c88f.tar.gz
qtmips-c06242f07721a7d86dc2d9795622d6646ae6c88f.tar.bz2
qtmips-c06242f07721a7d86dc2d9795622d6646ae6c88f.zip
Implement some machine execution speed control for gui
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/qtmipsmachine.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp
index 3d79c7c..a652363 100644
--- a/qtmips_machine/qtmipsmachine.cpp
+++ b/qtmips_machine/qtmipsmachine.cpp
@@ -35,15 +35,13 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) {
else
cr = new CoreSingle(regs, coremem, cc.delay_slot());
- run_speed = 1;
run_t = new QTimer(this);
+ set_speed(0); // In default run as fast as possible
connect(run_t, SIGNAL(timeout()), this, SLOT(step()));
}
void QtMipsMachine::set_speed(unsigned val) {
- run_speed = val;
- if (run_t->isActive())
- play();
+ run_t->setInterval(val);
}
const Registers *QtMipsMachine::registers() {
@@ -78,7 +76,7 @@ bool QtMipsMachine::exited() {
void QtMipsMachine::play() {
CTL_GUARD;
set_status(ST_RUNNING);
- run_t->start(run_speed);
+ run_t->start();
}
void QtMipsMachine::pause() {