Changed some Class names
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/Model/Microcontroller/EepromThread.class
Normal file
BIN
bin/Model/Microcontroller/EepromThread.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
package Control;
|
||||
|
||||
import Model.MyModelData;
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
import Model.ProgramLoader.ReadProgramFile;
|
||||
import View.GUIAbout;
|
||||
import View.GUIHelp;
|
||||
@@ -36,13 +36,13 @@ public class MyControlModel implements ActionListener {
|
||||
ReadProgramFile oRef;
|
||||
int iTestFileLoaded = 0;
|
||||
boolean[] abBreakpoints;
|
||||
PIC oPIC;
|
||||
Pic oPIC;
|
||||
|
||||
MyModelData oMyModelData = new MyModelData();
|
||||
|
||||
public MyControlModel(MyView view, ConcurrentLinkedQueue<Integer> qCommandsForModel, ConcurrentLinkedQueue<MyModelData> qDataForModel) {
|
||||
oMyView = view;
|
||||
this.oPIC = new PIC();
|
||||
this.oPIC = new Pic();
|
||||
this.qCommandsForModel = qCommandsForModel;
|
||||
this.qDataForModel = qDataForModel;
|
||||
oControlButtons = oMyView.getGUIMCMenu().getControlButtons();
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
import View.MyView;
|
||||
|
||||
/**
|
||||
@@ -25,10 +25,10 @@ public class MyControlView {
|
||||
};
|
||||
|
||||
MyView oMyView;
|
||||
PIC oPIC;
|
||||
Pic oPIC;
|
||||
ConcurrentLinkedQueue<Integer> qCommandsToModel;
|
||||
|
||||
public MyControlView(PIC oPIC, MyView view, ConcurrentLinkedQueue<Integer> qCommands) {
|
||||
public MyControlView(Pic oPIC, MyView view, ConcurrentLinkedQueue<Integer> qCommands) {
|
||||
oMyView = view;
|
||||
this.oPIC = oPIC;
|
||||
qCommandsToModel = qCommands;
|
||||
@@ -328,7 +328,7 @@ public class MyControlView {
|
||||
|
||||
}
|
||||
|
||||
public void setPIC(PIC oPic) {
|
||||
public void setPIC(Pic oPic) {
|
||||
oPIC = oPic;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package Model.Microcontroller;
|
||||
|
||||
public class ALU {
|
||||
public class Alu {
|
||||
private boolean bCarryFlag = false;
|
||||
private boolean bDigitCarryFlag = false;
|
||||
private boolean bZeroFlag = false;
|
||||
|
||||
@@ -7,12 +7,12 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class EEPROM {
|
||||
public class Eeprom {
|
||||
|
||||
private int[] aiEeprom;
|
||||
private File oFile;
|
||||
|
||||
public EEPROM() {
|
||||
public Eeprom() {
|
||||
aiEeprom = new int[64];
|
||||
oFile = new File("./eeprom.dat");
|
||||
}
|
||||
|
||||
13
src/Model/Microcontroller/EepromThread.java
Normal file
13
src/Model/Microcontroller/EepromThread.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package Model.Microcontroller;
|
||||
|
||||
public class EepromThread extends Thread {
|
||||
|
||||
public EepromThread() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package Model.Microcontroller;
|
||||
|
||||
public class INSTRUCTIONDECODER {
|
||||
public class InstructionDecoder {
|
||||
/**
|
||||
* Decides which PIC-command-method to call.
|
||||
* @param iCommandAsIntToMask
|
||||
* @param oPIC
|
||||
*/
|
||||
public int decodeAndExecuteCommand(int iCommandAsIntToMask, PIC oPIC) {
|
||||
public int decodeAndExecuteCommand(int iCommandAsIntToMask, Pic oPIC) {
|
||||
//System.out.println("Command " + Integer.toHexString(iCommandAsIntToMask));
|
||||
//Return-value will be -1 if command can't be read.
|
||||
int iDecodedCommand = -1;
|
||||
@@ -274,7 +274,7 @@ public class INSTRUCTIONDECODER {
|
||||
return iDecodedCommand;
|
||||
}
|
||||
|
||||
public void executeCommand(int iDecodedCommand, PIC oPIC, int iDestinationBit, int iRegisterFileAddress, int iBitaddress, int iEightK, int iElevenK) {
|
||||
public void executeCommand(int iDecodedCommand, Pic oPIC, int iDestinationBit, int iRegisterFileAddress, int iBitaddress, int iEightK, int iElevenK) {
|
||||
switch (iDecodedCommand) {
|
||||
case -1: {
|
||||
System.out.println("Command doesn't exist.");
|
||||
|
||||
@@ -8,7 +8,7 @@ package Model.Microcontroller;
|
||||
/**
|
||||
* Microcontrollerclass that contains all other partclasses
|
||||
*/
|
||||
public class PIC {
|
||||
public class Pic {
|
||||
/**
|
||||
* Parts of PIC.
|
||||
* Objects are written with a large starting letter.
|
||||
@@ -18,19 +18,19 @@ public class PIC {
|
||||
private STACK Stack;
|
||||
private int WRegister;
|
||||
private TIME Runtimer;
|
||||
private ALU ArithmeticLogicUnit;
|
||||
private EEPROM Eeprom;
|
||||
private Alu ArithmeticLogicUnit;
|
||||
private Eeprom Eeprom;
|
||||
private int iStateMachineWriteEeprom = 0;
|
||||
|
||||
public PIC() {
|
||||
public Pic() {
|
||||
//Initialising objects of PIC.
|
||||
ProgramMemory = new PROGRAMMEMORY();
|
||||
Ram = new RAM();
|
||||
Stack = new STACK();
|
||||
Runtimer = new TIME(Ram);
|
||||
WRegister = 0;
|
||||
ArithmeticLogicUnit = new ALU();
|
||||
Eeprom = new EEPROM();
|
||||
ArithmeticLogicUnit = new Alu();
|
||||
Eeprom = new Eeprom();
|
||||
}
|
||||
|
||||
public synchronized void resetPIC() {
|
||||
@@ -355,11 +355,11 @@ public class PIC {
|
||||
* Bit ’b’ in register ’f’ is set.
|
||||
*/
|
||||
public void BSF(int bitaddress, int registerFileAddress) {
|
||||
//TODO have to check bitaddress and registerFileAddress too
|
||||
if (iStateMachineWriteEeprom == 3) {
|
||||
if ((iStateMachineWriteEeprom == 3) && (bitaddress == 1) && (registerFileAddress == 0x07)) {
|
||||
iStateMachineWriteEeprom = 4;
|
||||
} else if (iStateMachineWriteEeprom == 4) {
|
||||
} else if ((iStateMachineWriteEeprom == 4) && (bitaddress == 7) && (registerFileAddress == 0x0B)) {
|
||||
if (Ram.get_WREN()) {
|
||||
//TODO start thread
|
||||
Eeprom.writeToFile();
|
||||
}
|
||||
} else {
|
||||
@@ -870,8 +870,7 @@ public class PIC {
|
||||
* as 0’s.
|
||||
*/
|
||||
public void MOVLW(int eightK) {
|
||||
//TODO has to check eightK
|
||||
if (iStateMachineWriteEeprom == 1) {
|
||||
if ((iStateMachineWriteEeprom == 1) && (eightK == 0xAA)) {
|
||||
iStateMachineWriteEeprom = 2;
|
||||
} else {
|
||||
iStateMachineWriteEeprom = 0;
|
||||
@@ -932,10 +931,9 @@ public class PIC {
|
||||
* Move data from W register to file register
|
||||
*/
|
||||
public void MOVWF(int registerFileAddress) {
|
||||
//TODO has to check registerFileAddress
|
||||
if (iStateMachineWriteEeprom == 0) {
|
||||
if ((iStateMachineWriteEeprom == 0) && (WRegister == 0x55) && (registerFileAddress == 0x08)) {
|
||||
iStateMachineWriteEeprom = 1;
|
||||
} else if (iStateMachineWriteEeprom == 2) {
|
||||
} else if ((iStateMachineWriteEeprom == 2) && (WRegister == 0xAA) && (registerFileAddress == 0x08)) {
|
||||
iStateMachineWriteEeprom = 3;
|
||||
} else {
|
||||
iStateMachineWriteEeprom = 0;
|
||||
|
||||
@@ -2,11 +2,11 @@ package Model;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import Model.Microcontroller.INSTRUCTIONDECODER;
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.InstructionDecoder;
|
||||
import Model.Microcontroller.Pic;
|
||||
|
||||
public class MyModel extends Thread {
|
||||
PIC oPIC = new PIC();
|
||||
Pic oPIC = new Pic();
|
||||
|
||||
MyModelData oMyModelData;
|
||||
|
||||
@@ -21,9 +21,9 @@ public class MyModel extends Thread {
|
||||
|
||||
ConcurrentLinkedQueue<Integer> qReceivedCommands;
|
||||
ConcurrentLinkedQueue<MyModelData> qDataToModel;
|
||||
ConcurrentLinkedQueue<PIC> qDataToView;
|
||||
ConcurrentLinkedQueue<Pic> qDataToView;
|
||||
|
||||
public MyModel(ConcurrentLinkedQueue<Integer> qCommands, ConcurrentLinkedQueue<PIC> qDataS, ConcurrentLinkedQueue<MyModelData> qDataR) {
|
||||
public MyModel(ConcurrentLinkedQueue<Integer> qCommands, ConcurrentLinkedQueue<Pic> qDataS, ConcurrentLinkedQueue<MyModelData> qDataR) {
|
||||
qReceivedCommands = qCommands;
|
||||
qDataToView = qDataS;
|
||||
qDataToModel = qDataR;
|
||||
@@ -137,7 +137,7 @@ public class MyModel extends Thread {
|
||||
}
|
||||
|
||||
private void step() {
|
||||
INSTRUCTIONDECODER oBitmask = new INSTRUCTIONDECODER();
|
||||
InstructionDecoder oBitmask = new InstructionDecoder();
|
||||
//Makes one step through the eeprom.
|
||||
oBitmask.decodeAndExecuteCommand(oPIC.getEeprom().getElement(oPIC.getRam().get_Programcounter()), oPIC);
|
||||
//Update view
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package Model;
|
||||
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
|
||||
public class MyModelData {
|
||||
private PIC oPIC;
|
||||
private Pic oPIC;
|
||||
private int iQuartzInterval;
|
||||
private int iVisualInterval;
|
||||
private boolean bWDTEnabled = false;
|
||||
|
||||
private boolean[] abBreakpoints;
|
||||
|
||||
public PIC getPIC() {
|
||||
public Pic getPIC() {
|
||||
return oPIC;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class MyModelData {
|
||||
return bWDTEnabled;
|
||||
}
|
||||
|
||||
public void setPIC(PIC pic) {
|
||||
public void setPIC(Pic pic) {
|
||||
this.oPIC = pic;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
|
||||
public class ReadProgramFile {
|
||||
|
||||
@@ -208,7 +208,7 @@ public class ReadProgramFile {
|
||||
* @param k index of file in String-Array "files".
|
||||
* @param oPIC of the main-function.
|
||||
*/
|
||||
public void readFileAndWriteToEEPROM(PIC oPIC) {
|
||||
public void readFileAndWriteToEEPROM(Pic oPIC) {
|
||||
if (oPCode.size() > 0) {
|
||||
//Integer-array which will contain oPCode as int-values.
|
||||
//Get an twodimensional array with int-values.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package Model;
|
||||
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
|
||||
/**
|
||||
* Class to store program-state. TODO
|
||||
*/
|
||||
public class ProgramStepInformation {
|
||||
private PIC oPIC;
|
||||
private Pic oPIC;
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@ import Control.MyControlModel;
|
||||
import Control.MyControlView;
|
||||
import Model.MyModel;
|
||||
import Model.MyModelData;
|
||||
import Model.Microcontroller.PIC;
|
||||
import Model.Microcontroller.Pic;
|
||||
import View.MyView;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
PIC oPIC = new PIC();
|
||||
Pic oPIC = new Pic();
|
||||
|
||||
ConcurrentLinkedQueue<Integer> qCommandsToModel = new ConcurrentLinkedQueue<Integer>();
|
||||
ConcurrentLinkedQueue<PIC> qDataToView = new ConcurrentLinkedQueue<PIC>();
|
||||
ConcurrentLinkedQueue<Pic> qDataToView = new ConcurrentLinkedQueue<Pic>();
|
||||
ConcurrentLinkedQueue<MyModelData> qDataToModel = new ConcurrentLinkedQueue<MyModelData>();
|
||||
|
||||
MyModel oModel = new MyModel(qCommandsToModel, qDataToView, qDataToModel);
|
||||
@@ -30,7 +30,7 @@ public class Main {
|
||||
//Check if model sent a new pic-element through queue and update view.
|
||||
while (true) {
|
||||
while (!qDataToView.isEmpty()) {
|
||||
PIC pic = qDataToView.poll();
|
||||
Pic pic = qDataToView.poll();
|
||||
oControlView.setPIC(pic);
|
||||
oControlView.updateView();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user