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