This commit is contained in:
aljazbrodar. 2025-12-10 19:47:23 +01:00
parent 1d357c6c96
commit d40c23038a
30 changed files with 208 additions and 100 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 18.0.0, 2025-12-10T11:23:00. -->
<!-- Written by QtCreator 18.0.0, 2025-12-10T19:36:57. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -105,16 +105,16 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_GENERATOR:STRING=Ninja
-DQT_MAINTENANCE_TOOL:FILEPATH=/home/aljaz/Qt/MaintenanceTool
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
<value type="QString" key="CMake.Initial.Parameters">-DQT_MAINTENANCE_TOOL:FILEPATH=/home/aljaz/Qt/MaintenanceTool
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}</value>
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">

View file

@ -18,6 +18,7 @@ qt_add_executable(simulator
opcode.h opcode.cpp
executor.h executor.cpp
loader.h loader.cpp
resources.qrc
)

View file

@ -7,7 +7,7 @@
{
"build" : ".",
"hasInstallRule" : true,
"jsonFile" : "directory-.-Debug-b087ac99b4952b24d922.json",
"jsonFile" : "directory-.-Debug-d64610240af6ce1dd3c4.json",
"minimumCMakeVersion" :
{
"string" : "3.16"
@ -44,7 +44,7 @@
{
"directoryIndex" : 0,
"id" : "simulator::@6890427a1f51a3e7e1df",
"jsonFile" : "target-simulator-Debug-edef6bab040a42101471.json",
"jsonFile" : "target-simulator-Debug-5e6084453823b96cc558.json",
"name" : "simulator",
"projectIndex" : 0
},

View file

@ -17,13 +17,13 @@
{
"command" : 0,
"file" : 0,
"line" : 32,
"line" : 33,
"parent" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 43,
"line" : 44,
"parent" : 0
}
]

View file

@ -26,7 +26,7 @@
"objects" :
[
{
"jsonFile" : "codemodel-v2-9908d093f7d320a6f887.json",
"jsonFile" : "codemodel-v2-aa358c96496ecc5aad2d.json",
"kind" : "codemodel",
"version" :
{
@ -77,7 +77,7 @@
},
"codemodel-v2" :
{
"jsonFile" : "codemodel-v2-9908d093f7d320a6f887.json",
"jsonFile" : "codemodel-v2-aa358c96496ecc5aad2d.json",
"kind" : "codemodel",
"version" :
{

View file

@ -71,13 +71,13 @@
{
"command" : 4,
"file" : 1,
"line" : 32,
"line" : 33,
"parent" : 0
},
{
"command" : 5,
"file" : 1,
"line" : 24,
"line" : 25,
"parent" : 0
},
{
@ -385,8 +385,8 @@
"sourceIndexes" :
[
0,
15,
16
16,
17
]
},
{
@ -421,11 +421,18 @@
4
]
},
{
"name" : "Resources",
"sourceIndexes" :
[
15
]
},
{
"name" : "CMake Rules",
"sourceIndexes" :
[
17
18
]
}
],
@ -515,6 +522,11 @@
"path" : "loader.cpp",
"sourceGroupIndex" : 1
},
{
"backtrace" : 4,
"path" : "resources.qrc",
"sourceGroupIndex" : 4
},
{
"backtrace" : 0,
"isGenerated" : true,
@ -531,7 +543,7 @@
"backtrace" : 0,
"isGenerated" : true,
"path" : "build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp.rule",
"sourceGroupIndex" : 4
"sourceGroupIndex" : 5
}
],
"type" : "EXECUTABLE"

View file

@ -1,35 +1,60 @@
# ninja log v6
2 12 1765361495346725311 simulator_autogen/timestamp c193a23cfe79571d
201 1749 1765361130091904622 CMakeFiles/simulator.dir/simulator_autogen/mocs_compilation.cpp.o 5301f473905a545f
13 774 1765361495357725305 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
2 12 1765361495346725311 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
1679 1911 1765361497023724460 simulator 53725ab159343a13
2309 2585 1765391447352614831 simulator 53725ab159343a13
17 296 1765301640842310980 CMakeFiles/simulator.dir/device.cpp.o 36fc5c8cf014f45b
201 1400 1765361130091904622 CMakeFiles/simulator.dir/main.cpp.o 9ebba9b7abc4cbf1
2 12 1765361495346725311 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 15 1765391445045619892 simulator_autogen/timestamp c193a23cfe79571d
13 775 1765391004094460465 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
206 1341 1765388632939713585 CMakeFiles/simulator.dir/simulator_autogen/mocs_compilation.cpp.o 5301f473905a545f
3 15 1765391445045619892 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
206 1793 1765388632939713585 CMakeFiles/simulator.dir/main.cpp.o 9ebba9b7abc4cbf1
12 22 1765010490368890036 CMakeFiles/simulator.dir/opcode.cpp.o da65f589ec5e1f76
3 15 1765391445045619892 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
298 641 1765351736928284389 CMakeFiles/simulator.dir/loader.cpp.o 8371bb969cd708a5
13 202 1765352834796852714 CMakeFiles/simulator.dir/machine.cpp.o 7030a03f8cbf1ad0
13 1679 1765361495357725305 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
2 12 1765361495346725311 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 13 1765361566371689115 simulator_autogen/timestamp c193a23cfe79571d
3 13 1765361566371689115 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 13 1765361566371689115 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
3 13 1765361566371689115 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
13 788 1765361566381689110 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
13 1669 1765361566381689110 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1669 1914 1765361568037688263 simulator 53725ab159343a13
4 15 1765361868707411424 simulator_autogen/timestamp c193a23cfe79571d
4 15 1765361868707411424 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
4 15 1765361868707411424 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
4 15 1765361868707411424 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
16 1053 1765361868719411410 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
15 1979 1765361868718411411 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1979 2215 1765361870682409023 simulator 53725ab159343a13
4 14 1765361903697369524 simulator_autogen/timestamp c193a23cfe79571d
4 14 1765361903697369524 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
4 14 1765361903697369524 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
4 14 1765361903697369524 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
14 786 1765361903706369513 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
14 1768 1765361903706369513 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1768 2018 1765361905461367446 simulator 53725ab159343a13
14 290 1765388413560525375 CMakeFiles/simulator.dir/machine.cpp.o 7030a03f8cbf1ad0
15 2309 1765391445058619863 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
3 15 1765391445045619892 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 244 1765391661065278121 simulator_autogen/timestamp c193a23cfe79571d
3 244 1765391661065278121 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 244 1765391661065278121 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
3 244 1765391661065278121 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
244 1878 1765391661070278116 CMakeFiles/simulator.dir/simulator_autogen/mocs_compilation.cpp.o 5301f473905a545f
244 2352 1765391661070278116 CMakeFiles/simulator.dir/main.cpp.o 9ebba9b7abc4cbf1
244 2999 1765391661070278116 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
2999 3246 1765391663825275257 simulator 53725ab159343a13
2 13 1765391675220263773 simulator_autogen/timestamp c193a23cfe79571d
2 13 1765391675220263773 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
2 13 1765391675220263773 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
2 13 1765391675220263773 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
13 1850 1765391675231263762 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1850 2084 1765391677068261961 simulator 53725ab159343a13
2 13 1765391743406206014 simulator_autogen/timestamp c193a23cfe79571d
2 13 1765391743406206014 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
2 13 1765391743406206014 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
2 13 1765391743406206014 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
13 1956 1765391743417206006 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1956 2190 1765391745360204622 simulator 53725ab159343a13
3 19 1765391803656169255 simulator_autogen/timestamp c193a23cfe79571d
3 19 1765391803656169255 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 19 1765391803656169255 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
3 19 1765391803656169255 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
19 1599 1765391803672169247 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1599 1838 1765391805252168448 simulator 53725ab159343a13
3 14 1765392232130182156 simulator_autogen/timestamp c193a23cfe79571d
3 14 1765392232130182156 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 14 1765392232130182156 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
3 14 1765392232130182156 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
14 1687 1765392232141182161 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1687 1928 1765392233814182895 simulator 53725ab159343a13
2 12 1765392380808261413 simulator_autogen/timestamp c193a23cfe79571d
2 12 1765392380808261413 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
2 12 1765392380808261413 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
2 12 1765392380808261413 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
12 801 1765392380818261419 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
12 1711 1765392380818261419 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1711 1966 1765392382517262473 simulator 53725ab159343a13
3 13 1765392399220272998 simulator_autogen/timestamp c193a23cfe79571d
3 13 1765392399220272998 simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
3 13 1765392399220272998 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/timestamp c193a23cfe79571d
3 13 1765392399220272998 /home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/mocs_compilation.cpp c193a23cfe79571d
14 843 1765392399231273005 CMakeFiles/simulator.dir/executor.cpp.o 8cd2a28f3c211eaa
13 1798 1765392399230273005 CMakeFiles/simulator.dir/mainwindow.cpp.o e3901bb2e4f9b516
1798 2041 1765392401015274146 simulator 53725ab159343a13

View file

@ -1,8 +1,6 @@
# Generated by CMake. Changes will be overwritten.
/home/aljaz/Desktop/spo/ass2/simulator/opcode.cpp
/home/aljaz/Desktop/spo/ass2/simulator/device.cpp
/home/aljaz/Desktop/spo/ass2/simulator/mainwindow.cpp
uic:ui_mainwindow.h
/home/aljaz/Desktop/spo/ass2/simulator/executor.cpp
/home/aljaz/Desktop/spo/ass2/simulator/loader.h
/home/aljaz/Desktop/spo/ass2/simulator/executor.h
mmc:Q_OBJECT
mdp:/home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/moc_predefs.h
@ -366,11 +364,14 @@
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stdbool.h
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h
/home/aljaz/Desktop/spo/ass2/simulator/loader.h
/home/aljaz/Desktop/spo/ass2/simulator/executor.cpp
/home/aljaz/Desktop/spo/ass2/simulator/mainwindow.cpp
uic:ui_mainwindow.h
/home/aljaz/Desktop/spo/ass2/simulator/device.cpp
/home/aljaz/Desktop/spo/ass2/simulator/opcode.cpp
/home/aljaz/Desktop/spo/ass2/simulator/main.cpp
/home/aljaz/Desktop/spo/ass2/simulator/opcode.h
/home/aljaz/Desktop/spo/ass2/simulator/machine.cpp
/home/aljaz/Desktop/spo/ass2/simulator/device.h
/home/aljaz/Desktop/spo/ass2/simulator/loader.cpp
/home/aljaz/Desktop/spo/ass2/simulator/machine.h
/home/aljaz/Desktop/spo/ass2/simulator/mainwindow.h
mmc:Q_OBJECT
mdp:/home/aljaz/Desktop/spo/ass2/simulator/build/Desktop_Qt_6_10_1-Debug/simulator_autogen/moc_predefs.h
@ -844,6 +845,5 @@
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stdarg.h
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stdbool.h
mdp:/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h
/home/aljaz/Desktop/spo/ass2/simulator/machine.h
/home/aljaz/Desktop/spo/ass2/simulator/loader.cpp
/home/aljaz/Desktop/spo/ass2/simulator/device.h
/home/aljaz/Desktop/spo/ass2/simulator/machine.cpp
/home/aljaz/Desktop/spo/ass2/simulator/opcode.h

View file

@ -1,3 +1,3 @@
Start testing: Dec 10 17:54 CET
Start testing: Dec 10 19:32 CET
----------------------------------------------------------
End testing: Dec 10 17:54 CET
End testing: Dec 10 19:32 CET

View file

@ -52,7 +52,8 @@ template <> constexpr inline auto MainWindow::qt_create_metaobjectdata<qt_meta_t
"updateUI",
"setStatusLightRunning",
"setStatusLightStopped",
"setStatusLightEnded"
"setStatusLightEnded",
"on_menuVizitka_triggered"
};
QtMocHelpers::UintData qt_methods {
@ -82,6 +83,8 @@ template <> constexpr inline auto MainWindow::qt_create_metaobjectdata<qt_meta_t
QtMocHelpers::SlotData<void()>(13, 2, QMC::AccessPrivate, QMetaType::Void),
// Slot 'setStatusLightEnded'
QtMocHelpers::SlotData<void()>(14, 2, QMC::AccessPrivate, QMetaType::Void),
// Slot 'on_menuVizitka_triggered'
QtMocHelpers::SlotData<void()>(15, 2, QMC::AccessPrivate, QMetaType::Void),
};
QtMocHelpers::UintData qt_properties {
};
@ -118,6 +121,7 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
case 10: _t->setStatusLightRunning(); break;
case 11: _t->setStatusLightStopped(); break;
case 12: _t->setStatusLightEnded(); break;
case 13: _t->on_menuVizitka_triggered(); break;
default: ;
}
}
@ -150,14 +154,14 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 13)
if (_id < 14)
qt_static_metacall(this, _c, _id, _a);
_id -= 13;
_id -= 14;
}
if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 13)
if (_id < 14)
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();
_id -= 13;
_id -= 14;
}
return _id;
}

View file

@ -11,6 +11,7 @@
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
@ -51,8 +52,10 @@ public:
QLabel *label_8;
QGroupBox *groupBox_2;
QLabel *labelX;
QLabel *label_10;
QGroupBox *groupBox_3;
QLabel *labelSW;
QLabel *label_11;
QWidget *layoutWidget;
QVBoxLayout *verticalLayout;
QLabel *label;
@ -81,6 +84,9 @@ public:
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName("MainWindow");
MainWindow->resize(902, 757);
QIcon icon;
icon.addFile(QString::fromUtf8("logo.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
MainWindow->setWindowIcon(icon);
actionExit = new QAction(MainWindow);
actionExit->setObjectName("actionExit");
centralwidget = new QWidget(MainWindow);
@ -135,13 +141,19 @@ public:
groupBox_2->setGeometry(QRect(10, 330, 161, 80));
labelX = new QLabel(groupBox_2);
labelX->setObjectName("labelX");
labelX->setGeometry(QRect(30, 30, 58, 15));
labelX->setGeometry(QRect(20, 50, 58, 15));
label_10 = new QLabel(groupBox_2);
label_10->setObjectName("label_10");
label_10->setGeometry(QRect(20, 30, 58, 15));
groupBox_3 = new QGroupBox(centralwidget);
groupBox_3->setObjectName("groupBox_3");
groupBox_3->setGeometry(QRect(20, 460, 161, 80));
labelSW = new QLabel(groupBox_3);
labelSW->setObjectName("labelSW");
labelSW->setGeometry(QRect(30, 30, 58, 15));
labelSW->setGeometry(QRect(10, 50, 58, 15));
label_11 = new QLabel(groupBox_3);
label_11->setObjectName("label_11");
label_11->setGeometry(QRect(10, 30, 58, 15));
layoutWidget = new QWidget(centralwidget);
layoutWidget->setObjectName("layoutWidget");
layoutWidget->setGeometry(QRect(240, 20, 541, 641));
@ -268,8 +280,10 @@ public:
label_8->setText(QCoreApplication::translate("MainWindow", "F", nullptr));
groupBox_2->setTitle(QCoreApplication::translate("MainWindow", "Indeksni register", nullptr));
labelX->setText(QCoreApplication::translate("MainWindow", "labelX", nullptr));
label_10->setText(QCoreApplication::translate("MainWindow", "X", nullptr));
groupBox_3->setTitle(QCoreApplication::translate("MainWindow", "Statusni register", nullptr));
labelSW->setText(QCoreApplication::translate("MainWindow", "labelSW", nullptr));
label_11->setText(QCoreApplication::translate("MainWindow", "SW", nullptr));
label->setText(QCoreApplication::translate("MainWindow", "Pomnilnik", nullptr));
addressLineEdit->setText(QString());
addressLineEdit->setPlaceholderText(QCoreApplication::translate("MainWindow", "Pomnilniski naslov", nullptr));

View file

@ -26,7 +26,7 @@ void Executor::start() {
emit signalEnded();
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}
@ -55,21 +55,21 @@ void Executor::step() {
emit signalEnded();
return;
}
emit signalStarted();
int pc_before = machine->getPC();
// Izvedi en ukaz
machine->execute();
int pc_after = machine->getPC();
emit updateRequested();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
emit signalStopped();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
// Če PC ostane isti → neskončna zanka → HALT
emit updateRequested();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
emit signalStopped();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (pc_after == pc_before) {
ended = true;
emit signalEnded();
}
}

BIN
ass2/simulator/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

View file

@ -2,7 +2,6 @@
#include "device.h"
#include "opcode.h"
#include <stdexcept>
using namespace std;
Machine::Machine() {

View file

@ -2,29 +2,38 @@
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QIcon>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QGuiApplication::setWindowIcon(QIcon("logo.png"));
QAction *actionLoad = new QAction(tr("Load"), this);
ui->menuLoad->addAction(actionLoad);
executor = new Executor(&machine);
executorThread = new QThread(this);
executor.moveToThread(executorThread);
connect(this, &MainWindow::startExecutor, &executor, &Executor::start);
connect(this, &MainWindow::stopExecutor, &executor, &Executor::stop);
connect(this, &MainWindow::stepExecutor, &executor, &Executor::step);
executor->moveToThread(executorThread);
connect(this, &MainWindow::startExecutor, executor, &Executor::start, Qt::QueuedConnection);
connect(this, &MainWindow::stopExecutor, executor, &Executor::stop, Qt::QueuedConnection);
connect(this, &MainWindow::stepExecutor, executor, &Executor::step, Qt::QueuedConnection);
connect(executor, &Executor::updateRequested, this, &MainWindow::updateUI, Qt::QueuedConnection);
connect(executor, &Executor::signalStarted, this, &MainWindow::setStatusLightRunning, Qt::QueuedConnection);
connect(executor, &Executor::signalStopped, this, &MainWindow::setStatusLightStopped, Qt::QueuedConnection);
connect(executor, &Executor::signalEnded, this, &MainWindow::setStatusLightEnded, Qt::QueuedConnection);
executorThread->start();
connect(&executor, &Executor::updateRequested, this, &MainWindow::updateUI);
connect(&executor, &Executor::signalStarted, this, &MainWindow::setStatusLightRunning);
connect(&executor, &Executor::signalStopped, this, &MainWindow::setStatusLightStopped);
connect(&executor, &Executor::signalEnded, this, &MainWindow::setStatusLightEnded);
connect(ui->menuVizitka, &QMenu::aboutToShow, this, &MainWindow::on_menuVizitka_triggered);
connect(actionLoad, &QAction::triggered, this, &MainWindow::onLoadTriggered);
connect(ui->runButton, &QPushButton::clicked, this, &MainWindow::on_runButton_clicked);
connect(ui->stepButton, &QPushButton::clicked, this, &MainWindow::on_stepButton_clicked);
//connect(ui->runButton, &QPushButton::clicked, this, &MainWindow::on_runButton_clicked);
//connect(ui->stepButton, &QPushButton::clicked, this, &MainWindow::on_stepButton_clicked);
updateUI();
ui->statusLight->setFixedSize(16,16);
@ -66,6 +75,7 @@ MainWindow::~MainWindow()
{
executorThread->quit();
executorThread->wait();
delete executor;
delete ui;
}
@ -114,7 +124,7 @@ void MainWindow::updateUI()
void MainWindow::onLoadTriggered() {
machine.resetRegisters();
machine.resetMemory();
executor.resetProgram();
executor->resetProgram();
updateUI();
QString filename = QFileDialog::getOpenFileName(this, tr("Open Object File"), "", tr("Object Files (*.obj)"));
if (!filename.isEmpty()) {
@ -162,7 +172,6 @@ void MainWindow::on_stopButton_clicked()
emit stopExecutor();
}
void MainWindow::setStatusLightRunning() {
ui->statusLight->setStyleSheet("background-color: green; border-radius: 8px;");
}
@ -174,3 +183,16 @@ void MainWindow::setStatusLightStopped() {
void MainWindow::setStatusLightEnded() {
ui->statusLight->setStyleSheet("background-color: black; border-radius: 8px;");
}
void MainWindow::on_menuVizitka_triggered()
{
QMessageBox::information(
this,
"Vizitka",
"Aljaž Brodar\n"
"Sistemska programska oprema\n"
"Simulator SIC/XE\n"
"2025\n"
);
}

View file

@ -33,6 +33,7 @@ private slots:
void setStatusLightRunning();
void setStatusLightStopped();
void setStatusLightEnded();
void on_menuVizitka_triggered();
signals:
void startExecutor();
void stopExecutor();
@ -42,7 +43,7 @@ private:
Ui::MainWindow *ui;
Loader loader;
Machine machine;
Executor executor{ &machine };
Executor* executor;
QThread* executorThread;
QTimer* uiUpdateTimer;
};

View file

@ -13,6 +13,10 @@
<property name="windowTitle">
<string>Simulator</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>logo.png</normaloff>logo.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
@ -224,8 +228,8 @@
<widget class="QLabel" name="labelX">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<x>20</x>
<y>50</y>
<width>58</width>
<height>15</height>
</rect>
@ -234,6 +238,19 @@
<string>labelX</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>58</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
@ -250,8 +267,8 @@
<widget class="QLabel" name="labelSW">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<x>10</x>
<y>50</y>
<width>58</width>
<height>15</height>
</rect>
@ -260,6 +277,19 @@
<string>labelSW</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>58</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>SW</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">