aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-11-19 21:16:46 +0100
committerKarel Kočí <cynerd@email.cz>2017-11-19 21:16:46 +0100
commit2c6562fa78e884d66b8c2a306f020101e8803f2e (patch)
tree7e9a940cb73fcdf3424ff5443163ba51da0ef82c
parent04ea2670be26291a17808bd704ce3549795953a0 (diff)
downloadqtmips-2c6562fa78e884d66b8c2a306f020101e8803f2e.tar.gz
qtmips-2c6562fa78e884d66b8c2a306f020101e8803f2e.tar.bz2
qtmips-2c6562fa78e884d66b8c2a306f020101e8803f2e.zip
Just something I had stagged
-rw-r--r--qtmips_cli/machineapp.cpp11
-rw-r--r--qtmips_cli/machineapp.h16
-rw-r--r--qtmips_cli/tracer.cpp6
-rw-r--r--qtmips_cli/tracer.h12
-rw-r--r--qtmips_gui/CacheContent.ui18
-rw-r--r--qtmips_gui/CacheStatistics.ui18
-rw-r--r--qtmips_gui/MainWindow.ui (renamed from qtmips_gui/mainwindow.ui)0
-rw-r--r--qtmips_gui/NewDialog.ui71
-rw-r--r--qtmips_gui/cachecontent.cpp6
-rw-r--r--qtmips_gui/cachecontent.h11
-rw-r--r--qtmips_gui/cachestatistics.cpp6
-rw-r--r--qtmips_gui/cachestatistics.h11
-rw-r--r--qtmips_gui/coreview.cpp6
-rw-r--r--qtmips_gui/coreview.h11
-rw-r--r--qtmips_gui/icons.qrc2
-rw-r--r--qtmips_gui/icons/application-exit.pngbin0 -> 2633 bytes
-rw-r--r--qtmips_gui/icons/document-import.pngbin0 -> 1447 bytes
-rw-r--r--qtmips_gui/icons/finish.pngbin0 -> 1364 bytes
-rw-r--r--qtmips_gui/icons/forward.pngbin0 -> 1276 bytes
-rw-r--r--qtmips_gui/icons/next.pngbin0 -> 3639 bytes
-rw-r--r--qtmips_gui/icons/pause.pngbin0 -> 3337 bytes
-rw-r--r--qtmips_gui/icons/play.pngbin0 -> 3492 bytes
-rw-r--r--qtmips_gui/icons/refresh.pngbin0 -> 1966 bytes
-rw-r--r--qtmips_gui/icons/reload.pngbin0 -> 1966 bytes
-rw-r--r--qtmips_gui/icons/stop.pngbin0 -> 3131 bytes
-rw-r--r--qtmips_gui/newdialog.cpp6
-rw-r--r--qtmips_gui/newdialog.h11
-rw-r--r--qtmips_gui/registersdock.cpp6
-rw-r--r--qtmips_gui/registersdock.h11
-rw-r--r--qtmips_gui/registersdock.ui18
-rw-r--r--qtmips_machine/alu.cpp6
-rw-r--r--qtmips_machine/alu.h11
-rw-r--r--qtmips_machine/machineconfig.cpp6
-rw-r--r--qtmips_machine/machineconfig.h11
-rw-r--r--qtmips_machine/tests/testalu.cpp0
-rw-r--r--qtmips_machine/tests/testcore.cpp0
-rw-r--r--qtmips_machine/tests/testinstruction.cpp76
-rw-r--r--qtmips_machine/tests/testprogramloader.cpp0
-rwxr-xr-xtests/machine-unit-tests/test.sh2
39 files changed, 266 insertions, 103 deletions
diff --git a/qtmips_cli/machineapp.cpp b/qtmips_cli/machineapp.cpp
deleted file mode 100644
index 09fcd3e..0000000
--- a/qtmips_cli/machineapp.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "machineapp.h"
-#include <iostream>
-
-MachineApp::MachineApp(int argc, char **argv) : QCoreApplication(argc, argv) {
- connect(this, SIGNAL(aboutToQuit()), this, SLOT(quit()));
- // TODO drop hello
- std::cout << "Hello\n";
- std::cout.flush();
- // TODO check argc
- this->machine = new QtMipsMachine(argv[1]);
-}
diff --git a/qtmips_cli/machineapp.h b/qtmips_cli/machineapp.h
deleted file mode 100644
index 6587154..0000000
--- a/qtmips_cli/machineapp.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef MACHINEAPP_H
-#define MACHINEAPP_H
-
-#include <QCoreApplication>
-
-#include "qtmipsmachine.h"
-#include "programloader.h"
-
-class MachineApp : public QCoreApplication {
-public:
- MachineApp(int argc, char **argv);
-private:
- QtMipsMachine *machine;
-};
-
-#endif // MACHINEAPP_H
diff --git a/qtmips_cli/tracer.cpp b/qtmips_cli/tracer.cpp
new file mode 100644
index 0000000..63d00d1
--- /dev/null
+++ b/qtmips_cli/tracer.cpp
@@ -0,0 +1,6 @@
+#include "tracer.h"
+
+Tracer::Tracer()
+{
+
+}
diff --git a/qtmips_cli/tracer.h b/qtmips_cli/tracer.h
new file mode 100644
index 0000000..5c99970
--- /dev/null
+++ b/qtmips_cli/tracer.h
@@ -0,0 +1,12 @@
+#ifndef TRACER_H
+#define TRACER_H
+
+#include <QObject>
+
+class Tracer
+{
+public:
+ Tracer();
+};
+
+#endif // TRACER_H \ No newline at end of file
diff --git a/qtmips_gui/CacheContent.ui b/qtmips_gui/CacheContent.ui
new file mode 100644
index 0000000..ac2f263
--- /dev/null
+++ b/qtmips_gui/CacheContent.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<ui version="4.0">
+ <class>DockWidget</class>
+ <widget class="QDockWidget" name="DockWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>DockWidget</string>
+ </property>
+ <widget class="QWidget" name="dockWidgetContents"/>
+ </widget>
+</ui>
diff --git a/qtmips_gui/CacheStatistics.ui b/qtmips_gui/CacheStatistics.ui
new file mode 100644
index 0000000..ac2f263
--- /dev/null
+++ b/qtmips_gui/CacheStatistics.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<ui version="4.0">
+ <class>DockWidget</class>
+ <widget class="QDockWidget" name="DockWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>DockWidget</string>
+ </property>
+ <widget class="QWidget" name="dockWidgetContents"/>
+ </widget>
+</ui>
diff --git a/qtmips_gui/mainwindow.ui b/qtmips_gui/MainWindow.ui
index 0f69613..0f69613 100644
--- a/qtmips_gui/mainwindow.ui
+++ b/qtmips_gui/MainWindow.ui
diff --git a/qtmips_gui/NewDialog.ui b/qtmips_gui/NewDialog.ui
new file mode 100644
index 0000000..18d31ab
--- /dev/null
+++ b/qtmips_gui/NewDialog.ui
@@ -0,0 +1,71 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="geometry" >
+ <rect>
+ <x>30</x>
+ <y>240</y>
+ <width>341</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/qtmips_gui/cachecontent.cpp b/qtmips_gui/cachecontent.cpp
new file mode 100644
index 0000000..c651b7b
--- /dev/null
+++ b/qtmips_gui/cachecontent.cpp
@@ -0,0 +1,6 @@
+#include "cache_content.h"
+
+cache_content::cache_content()
+{
+
+}
diff --git a/qtmips_gui/cachecontent.h b/qtmips_gui/cachecontent.h
new file mode 100644
index 0000000..09b8734
--- /dev/null
+++ b/qtmips_gui/cachecontent.h
@@ -0,0 +1,11 @@
+#ifndef CACHE_CONTENT_H
+#define CACHE_CONTENT_H
+
+
+class cache_content
+{
+public:
+ cache_content();
+};
+
+#endif // CACHE_CONTENT_H \ No newline at end of file
diff --git a/qtmips_gui/cachestatistics.cpp b/qtmips_gui/cachestatistics.cpp
new file mode 100644
index 0000000..ade92c6
--- /dev/null
+++ b/qtmips_gui/cachestatistics.cpp
@@ -0,0 +1,6 @@
+#include "cachestatistics.h"
+
+CacheStatistics::CacheStatistics()
+{
+
+}
diff --git a/qtmips_gui/cachestatistics.h b/qtmips_gui/cachestatistics.h
new file mode 100644
index 0000000..4fa77a6
--- /dev/null
+++ b/qtmips_gui/cachestatistics.h
@@ -0,0 +1,11 @@
+#ifndef CACHESTATISTICS_H
+#define CACHESTATISTICS_H
+
+
+class CacheStatistics
+{
+public:
+ CacheStatistics();
+};
+
+#endif // CACHESTATISTICS_H \ No newline at end of file
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
new file mode 100644
index 0000000..de8a637
--- /dev/null
+++ b/qtmips_gui/coreview.cpp
@@ -0,0 +1,6 @@
+#include "coreview.h"
+
+CoreView::CoreView()
+{
+
+}
diff --git a/qtmips_gui/coreview.h b/qtmips_gui/coreview.h
new file mode 100644
index 0000000..6e7407f
--- /dev/null
+++ b/qtmips_gui/coreview.h
@@ -0,0 +1,11 @@
+#ifndef COREVIEW_H
+#define COREVIEW_H
+
+
+class CoreView
+{
+public:
+ CoreView();
+};
+
+#endif // COREVIEW_H \ No newline at end of file
diff --git a/qtmips_gui/icons.qrc b/qtmips_gui/icons.qrc
new file mode 100644
index 0000000..90f4a83
--- /dev/null
+++ b/qtmips_gui/icons.qrc
@@ -0,0 +1,2 @@
+<!DOCTYPE RCC>
+<RCC version="1.0"/>
diff --git a/qtmips_gui/icons/application-exit.png b/qtmips_gui/icons/application-exit.png
new file mode 100644
index 0000000..2d0cd61
--- /dev/null
+++ b/qtmips_gui/icons/application-exit.png
Binary files differ
diff --git a/qtmips_gui/icons/document-import.png b/qtmips_gui/icons/document-import.png
new file mode 100644
index 0000000..e5d7931
--- /dev/null
+++ b/qtmips_gui/icons/document-import.png
Binary files differ
diff --git a/qtmips_gui/icons/finish.png b/qtmips_gui/icons/finish.png
new file mode 100644
index 0000000..26ef8e3
--- /dev/null
+++ b/qtmips_gui/icons/finish.png
Binary files differ
diff --git a/qtmips_gui/icons/forward.png b/qtmips_gui/icons/forward.png
new file mode 100644
index 0000000..8fa42a1
--- /dev/null
+++ b/qtmips_gui/icons/forward.png
Binary files differ
diff --git a/qtmips_gui/icons/next.png b/qtmips_gui/icons/next.png
new file mode 100644
index 0000000..1eca765
--- /dev/null
+++ b/qtmips_gui/icons/next.png
Binary files differ
diff --git a/qtmips_gui/icons/pause.png b/qtmips_gui/icons/pause.png
new file mode 100644
index 0000000..36e8803
--- /dev/null
+++ b/qtmips_gui/icons/pause.png
Binary files differ
diff --git a/qtmips_gui/icons/play.png b/qtmips_gui/icons/play.png
new file mode 100644
index 0000000..746508d
--- /dev/null
+++ b/qtmips_gui/icons/play.png
Binary files differ
diff --git a/qtmips_gui/icons/refresh.png b/qtmips_gui/icons/refresh.png
new file mode 100644
index 0000000..129fcd6
--- /dev/null
+++ b/qtmips_gui/icons/refresh.png
Binary files differ
diff --git a/qtmips_gui/icons/reload.png b/qtmips_gui/icons/reload.png
new file mode 100644
index 0000000..129fcd6
--- /dev/null
+++ b/qtmips_gui/icons/reload.png
Binary files differ
diff --git a/qtmips_gui/icons/stop.png b/qtmips_gui/icons/stop.png
new file mode 100644
index 0000000..f83e86c
--- /dev/null
+++ b/qtmips_gui/icons/stop.png
Binary files differ
diff --git a/qtmips_gui/newdialog.cpp b/qtmips_gui/newdialog.cpp
new file mode 100644
index 0000000..b2d24a8
--- /dev/null
+++ b/qtmips_gui/newdialog.cpp
@@ -0,0 +1,6 @@
+#include "newdialog.h"
+
+newdialog::newdialog()
+{
+
+}
diff --git a/qtmips_gui/newdialog.h b/qtmips_gui/newdialog.h
new file mode 100644
index 0000000..d37c9c0
--- /dev/null
+++ b/qtmips_gui/newdialog.h
@@ -0,0 +1,11 @@
+#ifndef NEWDIALOG_H
+#define NEWDIALOG_H
+
+
+class newdialog
+{
+public:
+ newdialog();
+};
+
+#endif // NEWDIALOG_H \ No newline at end of file
diff --git a/qtmips_gui/registersdock.cpp b/qtmips_gui/registersdock.cpp
new file mode 100644
index 0000000..bf82725
--- /dev/null
+++ b/qtmips_gui/registersdock.cpp
@@ -0,0 +1,6 @@
+#include "registers.h"
+
+Registers::Registers()
+{
+
+}
diff --git a/qtmips_gui/registersdock.h b/qtmips_gui/registersdock.h
new file mode 100644
index 0000000..0fb60eb
--- /dev/null
+++ b/qtmips_gui/registersdock.h
@@ -0,0 +1,11 @@
+#ifndef REGISTERS_H
+#define REGISTERS_H
+
+
+class Registers
+{
+public:
+ Registers();
+};
+
+#endif // REGISTERS_H \ No newline at end of file
diff --git a/qtmips_gui/registersdock.ui b/qtmips_gui/registersdock.ui
new file mode 100644
index 0000000..ac2f263
--- /dev/null
+++ b/qtmips_gui/registersdock.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<ui version="4.0">
+ <class>DockWidget</class>
+ <widget class="QDockWidget" name="DockWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>DockWidget</string>
+ </property>
+ <widget class="QWidget" name="dockWidgetContents"/>
+ </widget>
+</ui>
diff --git a/qtmips_machine/alu.cpp b/qtmips_machine/alu.cpp
new file mode 100644
index 0000000..5c74a5d
--- /dev/null
+++ b/qtmips_machine/alu.cpp
@@ -0,0 +1,6 @@
+#include "alu.h"
+
+Alu::Alu()
+{
+
+}
diff --git a/qtmips_machine/alu.h b/qtmips_machine/alu.h
new file mode 100644
index 0000000..e913b0c
--- /dev/null
+++ b/qtmips_machine/alu.h
@@ -0,0 +1,11 @@
+#ifndef ALU_H
+#define ALU_H
+
+
+class Alu
+{
+public:
+ Alu();
+};
+
+#endif // ALU_H \ No newline at end of file
diff --git a/qtmips_machine/machineconfig.cpp b/qtmips_machine/machineconfig.cpp
new file mode 100644
index 0000000..8562ab9
--- /dev/null
+++ b/qtmips_machine/machineconfig.cpp
@@ -0,0 +1,6 @@
+#include "machineconfig.h"
+
+MachineConfig::MachineConfig()
+{
+
+}
diff --git a/qtmips_machine/machineconfig.h b/qtmips_machine/machineconfig.h
new file mode 100644
index 0000000..58c2fc2
--- /dev/null
+++ b/qtmips_machine/machineconfig.h
@@ -0,0 +1,11 @@
+#ifndef MACHINECONFIG_H
+#define MACHINECONFIG_H
+
+
+class MachineConfig
+{
+public:
+ MachineConfig();
+};
+
+#endif // MACHINECONFIG_H \ No newline at end of file
diff --git a/qtmips_machine/tests/testalu.cpp b/qtmips_machine/tests/testalu.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/qtmips_machine/tests/testalu.cpp
diff --git a/qtmips_machine/tests/testcore.cpp b/qtmips_machine/tests/testcore.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/qtmips_machine/tests/testcore.cpp
diff --git a/qtmips_machine/tests/testinstruction.cpp b/qtmips_machine/tests/testinstruction.cpp
index a299bcf..e69de29 100644
--- a/qtmips_machine/tests/testinstruction.cpp
+++ b/qtmips_machine/tests/testinstruction.cpp
@@ -1,76 +0,0 @@
-#include "tst_machine.h"
-#include "instructions/arithmetic.h"
-#include "instructions/jumpbranch.h"
-#include "instructions/loadstore.h"
-#include "instructions/nop.h"
-#include "instructions/shift.h"
-#include <iostream>
-
-void MachineTests::instruction_arithmetic_data() {
- QTest::addColumn<size_t>("type");
- QTest::addColumn<std::uint32_t>("res");
-
- QTest::newRow("ADD") << (size_t)IAT_ADD << (unsigned)749;
- QTest::newRow("ADDU") << (size_t)IAT_ADDU << (unsigned)749;
- QTest::newRow("SUB") << (size_t)IAT_SUB << (unsigned)-665;
- QTest::newRow("SUBU") << (size_t)IAT_SUBU << (unsigned)-665;
- QTest::newRow("AND") << (size_t)IAT_AND << (unsigned)2;
- QTest::newRow("OR") << (size_t)IAT_OR << (unsigned)747;
- QTest::newRow("XOR") << (size_t)IAT_XOR << (unsigned)745;
- // TODO others
-}
-
-void MachineTests::instruction_arithmetic() {
- Registers regs;
-
- QFETCH(size_t, type);
- QFETCH(std::uint32_t, res);
-
- // TODO meaby one more dataset?
-
- regs.write_gp(12, 42);
- regs.write_gp(8, 707);
- regs.write_gp(5, 0);
-
- Instruction *i = new InstructionArithmetic((enum InstructionArithmeticT)type, 12, 8, 5);
-
- i->decode(&regs);
- i->execute();
- i->memory(nullptr); // We should not work with memory so segfault here is basically a test
- i->write_back(&regs);
-
- QCOMPARE(regs.read_gp(5), (std::uint32_t)res);
-}
-
-void MachineTests::instruction_arithmetic_immediate_data() {
- QTest::addColumn<size_t>("type");
- QTest::addColumn<std::uint32_t>("res");
-
- QTest::newRow("ADDI") << (size_t)IAT_ADDI << (unsigned)749;
- QTest::newRow("ADDIU") << (size_t)IAT_ADDIU << (unsigned)749;
- QTest::newRow("ANDI") << (size_t)IAT_ANDI << (unsigned)-665;
- QTest::newRow("ORI") << (size_t)IAT_ORI << (unsigned)-665;
- QTest::newRow("XORI") << (size_t)IAT_XORI << (unsigned)2;
- // TODO others
-}
-
-void MachineTests::instruction_arithmetic_immediate() {
- Registers regs;
-
- QFETCH(size_t, type);
- QFETCH(std::uint32_t, res);
-
- // TODO meaby one more dataset?
-
- regs.write_gp(9, 42);
- regs.write_gp(3, 0);
-
- Instruction *i = new InstructionArithmeticImmediate((enum InstructionArithmeticImmediateT)type, 9, 3, 707);
-
- i->decode(&regs);
- i->execute();
- i->memory(nullptr); // We should not work with memory so segfault here is basically a test
- i->write_back(&regs);
-
- QCOMPARE(regs.read_gp(3), (std::uint32_t)res);
-}
diff --git a/qtmips_machine/tests/testprogramloader.cpp b/qtmips_machine/tests/testprogramloader.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/qtmips_machine/tests/testprogramloader.cpp
diff --git a/tests/machine-unit-tests/test.sh b/tests/machine-unit-tests/test.sh
index c916f74..2f06965 100755
--- a/tests/machine-unit-tests/test.sh
+++ b/tests/machine-unit-tests/test.sh
@@ -6,6 +6,8 @@ TEST_NAME="machine-unit-test"
# Build tests binary
qtmips_make sub-qtmips_machine-tests
+# Build test data
+mips_make_test
# Run unit tests
qtmips_run qtmips_machine/tests/tst_machine || echo_fail "Test $TEST_NAME failed!"