ExecutionTime Multiplier, Hex Format
This commit is contained in:
@ -18,7 +18,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getTotalExecutionTime() {
|
public static long getTotalExecutionTime() {
|
||||||
return totalExecutionTime;
|
return (long) (totalExecutionTime * Controller_Frontend.getExecutionTimeMultiplier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetTotalExecutionTime() {
|
public static void resetTotalExecutionTime() {
|
||||||
|
|||||||
@ -32,13 +32,19 @@ import java.util.Arrays;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
public class Controller_Frontend {
|
public class Controller_Frontend {
|
||||||
|
|
||||||
private int [] prog;
|
private int [] prog;
|
||||||
private int [][] read;
|
private int [][] read;
|
||||||
private int [] ind;
|
private int [] ind;
|
||||||
|
|
||||||
private double executionTimeMultiplier = 1;
|
private static double executionTimeMultiplier = 1;
|
||||||
|
|
||||||
|
public static double getExecutionTimeMultiplier(){
|
||||||
|
return executionTimeMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -240,8 +246,7 @@ public class Controller_Frontend {
|
|||||||
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
IOPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
|
||||||
|
|
||||||
long totalExecutionTime = Commands.getTotalExecutionTime();
|
long totalExecutionTime = Commands.getTotalExecutionTime();
|
||||||
double adjustedTotalExecutionTime = totalExecutionTime * executionTimeMultiplier;
|
totalExecutionTimeLabel.setText("Total Execution Time: " + totalExecutionTime + "µs");
|
||||||
totalExecutionTimeLabel.setText("Total Execution Time: " + adjustedTotalExecutionTime + "µs");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markSelectedRow(int currentIndex, String selectedRowStyle) {
|
private void markSelectedRow(int currentIndex, String selectedRowStyle) {
|
||||||
@ -268,6 +273,7 @@ public class Controller_Frontend {
|
|||||||
File selectedFile = chooseLSTFile();
|
File selectedFile = chooseLSTFile();
|
||||||
stopAutoRun(null);
|
stopAutoRun(null);
|
||||||
if(selectedFile != null){
|
if(selectedFile != null){
|
||||||
|
String fileAddress = selectedFile.getAbsolutePath();
|
||||||
DataRegister.initDataRegister();
|
DataRegister.initDataRegister();
|
||||||
DataRegister.resetPC();
|
DataRegister.resetPC();
|
||||||
initialize();
|
initialize();
|
||||||
@ -285,13 +291,23 @@ public class Controller_Frontend {
|
|||||||
WatchdogTimer.reset();
|
WatchdogTimer.reset();
|
||||||
wdtCheck.setSelected(false);
|
wdtCheck.setSelected(false);
|
||||||
Table.refresh();
|
Table.refresh();
|
||||||
read = ParseFile.parseDatei(selectedFile.getAbsolutePath());
|
read = ParseFile.parseDatei(fileAddress);
|
||||||
prog = read [0];
|
prog = read [0];
|
||||||
ind = read[1];
|
ind = read[1];
|
||||||
System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
|
System.out.println(Arrays.toString(Arrays.stream(prog).toArray()));
|
||||||
displayLSTFileContent(selectedFile);
|
displayLSTFileContent(selectedFile);
|
||||||
markSelectedRow(0, "-fx-background-color: red; -fx-text-fill: white;");
|
markSelectedRow(0, "-fx-background-color: red; -fx-text-fill: white;");
|
||||||
initializeBreakpoints();
|
initializeBreakpoints();
|
||||||
|
int lastSlash = max (fileAddress.lastIndexOf('/'), fileAddress.lastIndexOf('\\'));
|
||||||
|
int lastDot = fileAddress.lastIndexOf('.');
|
||||||
|
String stageTitle;
|
||||||
|
if (lastDot > lastSlash)
|
||||||
|
stageTitle = "Simulator - " + fileAddress.substring(lastSlash + 1, lastDot);
|
||||||
|
else {
|
||||||
|
stageTitle = "Simulator - " + fileAddress.substring(lastSlash + 1);
|
||||||
|
}
|
||||||
|
Stage stage = (Stage) stepintoButton.getScene().getWindow();
|
||||||
|
stage.setTitle(stageTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -345,7 +361,6 @@ public class Controller_Frontend {
|
|||||||
|
|
||||||
private File chooseLSTFile() {
|
private File chooseLSTFile() {
|
||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
fileChooser.setTitle("Open LST File");
|
|
||||||
fileChooser.getExtensionFilters().addAll(
|
fileChooser.getExtensionFilters().addAll(
|
||||||
new FileChooser.ExtensionFilter("LST Files", "*.lst", "*.LST"),
|
new FileChooser.ExtensionFilter("LST Files", "*.lst", "*.LST"),
|
||||||
new FileChooser.ExtensionFilter("All Files", "*.*"));
|
new FileChooser.ExtensionFilter("All Files", "*.*"));
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class EEPROM {
|
|||||||
public static void registerTime(boolean reset) {
|
public static void registerTime(boolean reset) {
|
||||||
if (reset)
|
if (reset)
|
||||||
startTime = getTotalExecutionTime();
|
startTime = getTotalExecutionTime();
|
||||||
else if ((getTotalExecutionTime() >= (startTime + 1)) && writeControl) {
|
else if ((getTotalExecutionTime() >= (startTime + 1000)) && writeControl) {
|
||||||
eecon2stages = new boolean[]{false, false};
|
eecon2stages = new boolean[]{false, false};
|
||||||
DataRegister.setDirectBit(EECON1, EEIF, 1);
|
DataRegister.setDirectBit(EECON1, EEIF, 1);
|
||||||
DataRegister.setDirectBit(EECON1, WR, 0);
|
DataRegister.setDirectBit(EECON1, WR, 0);
|
||||||
|
|||||||
@ -26,11 +26,11 @@ public class PreScaler {
|
|||||||
scaler = getFactor();
|
scaler = getFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void decrement() {
|
public static void decrement(boolean manual) {
|
||||||
scaler--;
|
scaler--;
|
||||||
if (scaler == 0) {
|
if (scaler == 0) {
|
||||||
scaler = getFactor();
|
scaler = getFactor();
|
||||||
Timer.increment(false);
|
Timer.increment(manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,9 @@ public class Table {
|
|||||||
private static final double TABLE_WIDTH = 400; // Breite der TableView
|
private static final double TABLE_WIDTH = 400; // Breite der TableView
|
||||||
private static final double TABLE_HEIGHT = 650; // Höhe der TableView
|
private static final double TABLE_HEIGHT = 650; // Höhe der TableView
|
||||||
|
|
||||||
|
private static String format (String s) {
|
||||||
|
return (s.length() == 1) ? "0" + s : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static VBox refresh(){
|
public static VBox refresh(){
|
||||||
@ -60,8 +63,8 @@ public class Table {
|
|||||||
for (int col = 0; col < NUM_COLUMNS; col++) {
|
for (int col = 0; col < NUM_COLUMNS; col++) {
|
||||||
int index = row * NUM_COLUMNS + col;
|
int index = row * NUM_COLUMNS + col;
|
||||||
if (index < DataRegister.getDataRegister().length) {
|
if (index < DataRegister.getDataRegister().length) {
|
||||||
String address = "0x" + Integer.toHexString(index).toUpperCase();
|
String address = "0x" + format(Integer.toHexString(index).toUpperCase());
|
||||||
String value = "0x" + Integer.toHexString(DataRegister.getDataRegister()[index]).toUpperCase();
|
String value = "0x" + format(Integer.toHexString(DataRegister.getDataRegister()[index]).toUpperCase());
|
||||||
rowData[col] = new DataEntry(address, value);
|
rowData[col] = new DataEntry(address, value);
|
||||||
} else {
|
} else {
|
||||||
rowData[col] = new DataEntry("", "");
|
rowData[col] = new DataEntry("", "");
|
||||||
@ -71,11 +74,11 @@ public class Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Erstelle Labels für die Spezialregister
|
// Erstelle Labels für die Spezialregister
|
||||||
Label pclLabel = new Label("PCL: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCL())).toUpperCase());
|
Label pclLabel = new Label("PCL: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCL())).toUpperCase()));
|
||||||
Label statusLabel = new Label("STATUS: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getSTATUS())).toUpperCase());
|
Label statusLabel = new Label("STATUS: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getSTATUS())).toUpperCase()));
|
||||||
Label fsrLabel = new Label("FSR: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase());
|
Label fsrLabel = new Label("FSR: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getFSR())).toUpperCase()));
|
||||||
Label pclathLabel = new Label("PCLATH: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase());
|
Label pclathLabel = new Label("PCLATH: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getPCLATH())).toUpperCase()));
|
||||||
Label intconLabel = new Label("INTCON: 0x" + Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase());
|
Label intconLabel = new Label("INTCON: 0x" + format(Integer.toHexString(DataRegister.getRegister(DataRegister.getINTCON())).toUpperCase()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public class Timer {
|
|||||||
if (DataRegister.getDirectBit(OPTION, T0CS) == 0){
|
if (DataRegister.getDirectBit(OPTION, T0CS) == 0){
|
||||||
if (PreScaler.isPrescalerOnTimer()){
|
if (PreScaler.isPrescalerOnTimer()){
|
||||||
for (int i = 0; i < cycles; i++){
|
for (int i = 0; i < cycles; i++){
|
||||||
PreScaler.decrement();
|
PreScaler.decrement(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
increment(false);
|
increment(false);
|
||||||
@ -26,12 +26,11 @@ public class Timer {
|
|||||||
if ((DataRegister.getDirectBit(OPTION, T0CS) == 1) && !Controller_Frontend.isSleeping()){
|
if ((DataRegister.getDirectBit(OPTION, T0CS) == 1) && !Controller_Frontend.isSleeping()){
|
||||||
int newpin = (register >> 4) & 1;
|
int newpin = (register >> 4) & 1;
|
||||||
if (newpin != oldpin) {
|
if (newpin != oldpin) {
|
||||||
System.out.println(newpin + " " + oldpin);
|
|
||||||
if (DataRegister.getDirectBit(OPTION, T0SE) == 0) {
|
if (DataRegister.getDirectBit(OPTION, T0SE) == 0) {
|
||||||
// Low to high
|
// Low to high
|
||||||
if (newpin == 1 && oldpin == 0) {
|
if (newpin == 1 && oldpin == 0) {
|
||||||
if (PreScaler.isPrescalerOnTimer())
|
if (PreScaler.isPrescalerOnTimer())
|
||||||
PreScaler.decrement();
|
PreScaler.decrement(true);
|
||||||
else
|
else
|
||||||
increment(true);
|
increment(true);
|
||||||
}
|
}
|
||||||
@ -39,7 +38,7 @@ public class Timer {
|
|||||||
// High to low
|
// High to low
|
||||||
if (newpin == 0 && oldpin == 1) {
|
if (newpin == 0 && oldpin == 1) {
|
||||||
if (PreScaler.isPrescalerOnTimer())
|
if (PreScaler.isPrescalerOnTimer())
|
||||||
PreScaler.decrement();
|
PreScaler.decrement(true);
|
||||||
else
|
else
|
||||||
increment(true);
|
increment(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user