Removed non-functioning interpreter code

This commit is contained in:
dingusdev 2022-03-02 19:22:13 -07:00
parent d83fdd8866
commit 86bc91028d
5 changed files with 11 additions and 155 deletions

View File

@ -60,7 +60,6 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/core")
add_subdirectory("${PROJECT_SOURCE_DIR}/cpu/ppc/")
add_subdirectory("${PROJECT_SOURCE_DIR}/debugger/")
add_subdirectory("${PROJECT_SOURCE_DIR}/devices/")
add_subdirectory("${PROJECT_SOURCE_DIR}/execution")
add_subdirectory("${PROJECT_SOURCE_DIR}/machines/")
add_subdirectory("${PROJECT_SOURCE_DIR}/utils/")
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
@ -106,7 +105,6 @@ add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:core>
$<TARGET_OBJECTS:cpu_ppc>
$<TARGET_OBJECTS:debugger>
$<TARGET_OBJECTS:devices>
$<TARGET_OBJECTS:execution>
$<TARGET_OBJECTS:machines>
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:loguru>)
@ -130,7 +128,6 @@ if (DPPC_BUILD_PPC_TESTS)
$<TARGET_OBJECTS:cpu_ppc>
$<TARGET_OBJECTS:debugger>
$<TARGET_OBJECTS:devices>
$<TARGET_OBJECTS:execution>
$<TARGET_OBJECTS:machines>
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:loguru>)
@ -157,7 +154,6 @@ if (DPPC_BUILD_BENCHMARKS)
$<TARGET_OBJECTS:cpu_ppc>
$<TARGET_OBJECTS:debugger>
$<TARGET_OBJECTS:devices>
$<TARGET_OBJECTS:execution>
$<TARGET_OBJECTS:machines>
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:loguru>)

View File

@ -1,7 +0,0 @@
include_directories("${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/thirdparty/loguru/")
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
add_library(execution OBJECT ${SOURCES})
target_link_libraries(execution PRIVATE cubeb)

View File

@ -1,111 +0,0 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-21 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <chrono>
#include <cinttypes>
#include <ctime>
#include <iostream>
#include <interpreter_loop.h>
#include <loguru.hpp>
#include <cpu/ppc/ppcemu.h>
std::chrono::high_resolution_clock::time_point global; // global timer
std::chrono::high_resolution_clock::time_point cuda_timer; // updates every 11 ms
std::chrono::high_resolution_clock::time_point disp_timer; // updates every 16 ms
using namespace std;
const uint64_t cuda_update = 11000;
const uint64_t display_update = 16667;
bool cuda_priority = 0;
bool disp_priority = 0;
uint64_t elapsed_times[3] = {0}; // Elapsed time to reach a cycle (for display)
uint64_t routine_bench[3] = {0}; // Estimated time (in microseconds) to cycle through functions
uint64_t routine_runtime[3] = {0, cuda_update, display_update}; // Time to elapse before execution
enum general_routine_timepoint { OVERALL_UPDATE_TIME, CUDA_UPDATE_TIME, DISPLAY_UPDATE_TIME };
void round_robin_bench() {
// Benchmark how much time elapses during a minimal CPU block
std::chrono::high_resolution_clock::time_point dummy = std::chrono::high_resolution_clock::now();
for (int i = 0; i < 4096; i++) {
dppc_interpreter::ppc_ori(); //execute NOPs as a basic test
}
std::chrono::high_resolution_clock::time_point dummy2 = std::chrono::high_resolution_clock::now();
routine_bench[OVERALL_UPDATE_TIME] =
std::chrono::duration_cast<std::chrono::microseconds>(dummy2 - dummy).count();
std::cout << "Initial test: " << routine_bench[OVERALL_UPDATE_TIME] << endl;
}
void interpreter_update_counters() {
std::chrono::high_resolution_clock::time_point end = std::chrono::high_resolution_clock::now();
elapsed_times[OVERALL_UPDATE_TIME] =
std::chrono::duration_cast<std::chrono::microseconds>(end - global).count();
elapsed_times[CUDA_UPDATE_TIME] =
std::chrono::duration_cast<std::chrono::microseconds>(end - cuda_timer).count();
elapsed_times[DISPLAY_UPDATE_TIME] =
std::chrono::duration_cast<std::chrono::microseconds>(end - disp_timer).count();
// Calculate if the threshold for updating a time-critical section has reached or is about to be reached
if ((elapsed_times[CUDA_UPDATE_TIME] + routine_bench[OVERALL_UPDATE_TIME]) >=
routine_runtime[CUDA_UPDATE_TIME]) {
cuda_priority = true;
elapsed_times[CUDA_UPDATE_TIME] = 0;
cuda_timer = end;
}
if ((elapsed_times[DISPLAY_UPDATE_TIME] + routine_bench[OVERALL_UPDATE_TIME]) >=
routine_runtime[DISPLAY_UPDATE_TIME]) {
disp_priority = true;
elapsed_times[DISPLAY_UPDATE_TIME] = 0;
disp_timer = end;
}
}
void interpreter_main_loop() {
// Round robin algorithm goes here
round_robin_bench();
global = std::chrono::high_resolution_clock::now();
cuda_timer = global;
disp_timer = global;
for (;;) {
if (cuda_priority) {
LOG_F(9, "Placeholder for Cuda Update function!\n");
cuda_priority = false;
}
if (disp_priority) {
LOG_F(9, "Placeholder for Display Update function! \n");
disp_priority = false;
}
ppc_exec();
interpreter_update_counters();
}
}

View File

@ -1,23 +0,0 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-21 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
void interpreter_update_counters();
void interpreter_main_loop();

View File

@ -23,7 +23,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
// This is where the magic begins
#include "debugger/debugger.h"
#include "execution/interpreter_loop.h"
#include "machines/machinefactory.h"
#include "machines/machineproperties.h"
#include "utils/profiler.h"
@ -198,15 +197,17 @@ int main(int argc, char** argv) {
signal(SIGABRT, sigabrt_handler);
switch (execution_mode) {
case 0:
interpreter_main_loop();
break;
case 1:
enter_debugger();
break;
default:
LOG_F(ERROR, "Invalid EXECUTION MODE");
return 0;
case 0:
for (;;) {
ppc_exec();
}
break;
case 1:
enter_debugger();
break;
default:
LOG_F(ERROR, "Invalid EXECUTION MODE");
return 0;
}
bail: