some progress
This commit is contained in:
parent
618e4dd361
commit
5c6d1b22f6
7 changed files with 65 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 18.0.0, 2025-11-25T13:50:30. -->
|
<!-- Written by QtCreator 18.0.0, 2025-11-27T14:56:33. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|
@ -105,16 +105,16 @@
|
||||||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
|
<value type="QString" key="CMake.Initial.Parameters">-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
|
||||||
-DCMAKE_BUILD_TYPE:STRING=Debug
|
-DCMAKE_BUILD_TYPE:STRING=Debug
|
||||||
|
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
|
||||||
-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
|
-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
|
||||||
-DCMAKE_GENERATOR:STRING=Ninja
|
-DCMAKE_GENERATOR:STRING=Ninja
|
||||||
|
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||||
-DQT_MAINTENANCE_TOOL:FILEPATH=/home/aljaz/Qt/MaintenanceTool
|
-DQT_MAINTENANCE_TOOL:FILEPATH=/home/aljaz/Qt/MaintenanceTool
|
||||||
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
|
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
|
||||||
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
|
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}</value>
|
||||||
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
|
|
||||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</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>
|
<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">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
||||||
Start testing: Nov 27 14:24 CET
|
Start testing: Dec 04 13:01 CET
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
End testing: Nov 27 14:24 CET
|
End testing: Dec 04 13:01 CET
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "opcode.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -95,15 +96,55 @@ void Machine::setDevice(int num, Device* device) {
|
||||||
|
|
||||||
|
|
||||||
void Machine::notImplemented(string mnemonic) {
|
void Machine::notImplemented(string mnemonic) {
|
||||||
throw std::runtime_error("Instruction: " + mnemonic + " is not yet implemented.");
|
std::cerr << "Instruction: " << mnemonic << " is not yet implemented." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::invalidOpcode(int opcode) {
|
void Machine::invalidOpcode(int opcode) {
|
||||||
throw std::runtime_error("Invalid opcode: " + to_string(opcode));
|
std::cerr << "Invalid opcode: " << to_string(opcode) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::invalidAddressing() {
|
void Machine::invalidAddressing() {
|
||||||
throw std::runtime_error("Invalid addressing used.");
|
std::cerr << "Invalid addressing used." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nalozi in vrni en bajt z naslova PC
|
||||||
|
// in ga poveca za 1
|
||||||
|
int Machine::fetch() {
|
||||||
|
int address = getReg(8);
|
||||||
|
setReg(8, address + 1);
|
||||||
|
return readByte(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Machine::execute() {
|
||||||
|
int opcode = fetch();
|
||||||
|
int operand;
|
||||||
|
switch (opcode) {
|
||||||
|
// Format 1
|
||||||
|
case Opcode::FIX:
|
||||||
|
case Opcode::FLOAT:
|
||||||
|
case Opcode::NORM:
|
||||||
|
execF1(opcode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Format 2
|
||||||
|
case Opcode::ADDR:
|
||||||
|
case Opcode::CLEAR:
|
||||||
|
case Opcode::DIVR:
|
||||||
|
case Opcode::MULR:
|
||||||
|
case Opcode::RMO:
|
||||||
|
case Opcode::SHIFTL:
|
||||||
|
case Opcode::SHIFTR:
|
||||||
|
case Opcode::SUBR:
|
||||||
|
operand = fetch();
|
||||||
|
execF2(opcode, operand);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Format 3/4 (SIC/XE)
|
||||||
|
default:
|
||||||
|
decode_F3_F4(opcode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -113,3 +154,6 @@ void Machine::invalidAddressing() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,19 @@ public:
|
||||||
|
|
||||||
void notImplemented(string mnemonic);
|
void notImplemented(string mnemonic);
|
||||||
|
|
||||||
// Izvajalnik je naletel na operacijsko kodo ukaza, ki ni veljavna.
|
|
||||||
void invalidOpcode(int opcode);
|
void invalidOpcode(int opcode);
|
||||||
|
|
||||||
// Neveljavno naslavljanje.
|
|
||||||
void invalidAddressing();
|
void invalidAddressing();
|
||||||
|
|
||||||
|
int fetch();
|
||||||
|
|
||||||
|
void execute();
|
||||||
|
|
||||||
|
bool execF1(int opcode);
|
||||||
|
|
||||||
|
bool execF2(int opcode, int operand);
|
||||||
|
|
||||||
|
bool execSICF3F4(int opcode, int ni, int operand);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue