SLEEP
This commit is contained in:
@ -214,7 +214,7 @@ public class Commands {
|
||||
return;
|
||||
case 0b01100011:
|
||||
System.out.println("SLEEP");
|
||||
//TODO
|
||||
SLEEP();
|
||||
addExecutionTime(1);
|
||||
return;
|
||||
default:
|
||||
@ -222,8 +222,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
if (instruction == 0 || instruction == 0b0110000 || instruction == 0b01000000 || instruction == 0b00100000){
|
||||
System.out.println("NOP");
|
||||
addExecutionTime(1);
|
||||
NOP ();
|
||||
}
|
||||
else{
|
||||
System.out.println("Nicht gefunden!");
|
||||
@ -232,10 +231,19 @@ public class Commands {
|
||||
|
||||
}
|
||||
|
||||
public static void SLEEP() {
|
||||
Controller_Frontend.sleep ();
|
||||
}
|
||||
|
||||
public static void RETFIE() {
|
||||
DataRegister.setPC(ProgramStack.pop());
|
||||
}
|
||||
|
||||
public static void NOP () {
|
||||
System.out.println("NOP");
|
||||
addExecutionTime(1);
|
||||
}
|
||||
|
||||
public static void GOTO(int jump) {
|
||||
DataRegister.setPC(jump-1);
|
||||
}
|
||||
|
||||
@ -79,10 +79,18 @@ public class Controller_Frontend {
|
||||
private CheckBox wdtCheck;
|
||||
|
||||
private static volatile boolean isAutoRunActive = true;
|
||||
|
||||
private static volatile boolean isSleeping = false;
|
||||
|
||||
public static void stopRunFromBackend(){
|
||||
isAutoRunActive = false;
|
||||
if (isSleeping)
|
||||
isSleeping = false;
|
||||
else
|
||||
DataRegister.resetPC();
|
||||
}
|
||||
|
||||
public static void sleep() {
|
||||
isSleeping = true;
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -153,8 +161,12 @@ public class Controller_Frontend {
|
||||
});
|
||||
|
||||
// Befehle ausführen
|
||||
Commands.decode(prog[DataRegister.getPC()]);
|
||||
DataRegister.increasePC();
|
||||
if (!isSleeping) {
|
||||
Commands.decode(prog[DataRegister.getPC()]);
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
else
|
||||
Commands.decode(0);
|
||||
WatchdogTimer.testAndTrigger();
|
||||
Table.refresh();
|
||||
Stage stage = (Stage) stepintoButton.getScene().getWindow();
|
||||
|
||||
@ -11,12 +11,14 @@ public class WatchdogTimer {
|
||||
|
||||
public static void testAndTrigger() {
|
||||
watchdogTime = getTimeFromRegister() * 1000;
|
||||
if (enabled && (Commands.getTotalExecutionTime() >= (watchdogTime + lastReset - 1))){
|
||||
DataRegister.resetPC();
|
||||
System.err.println("Watchdog Timer triggered");
|
||||
DataRegister.clearBit(3, 4);
|
||||
lastReset = Commands.getTotalExecutionTime();
|
||||
Controller_Frontend.stopRunFromBackend();
|
||||
if (enabled) {
|
||||
System.err.println("Remaining: " + ((watchdogTime + lastReset - 1) - Commands.getTotalExecutionTime()));
|
||||
if (Commands.getTotalExecutionTime() >= (watchdogTime + lastReset - 1)) {
|
||||
System.err.println("Watchdog Timer triggered");
|
||||
DataRegister.clearBit(3, 4);
|
||||
lastReset = Commands.getTotalExecutionTime();
|
||||
Controller_Frontend.stopRunFromBackend();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user