From e68b0e743c4948862cf43cf7b35cd805829a3322 Mon Sep 17 00:00:00 2001 From: WickedJack99 Date: Fri, 29 Apr 2022 19:30:37 +0200 Subject: [PATCH] Changed some Class names --- bin/Control/MyControlModel.class | Bin 10087 -> 10087 bytes bin/Control/MyControlView.class | Bin 10945 -> 10945 bytes bin/Model/Microcontroller/ALU.class | Bin 3353 -> 3353 bytes bin/Model/Microcontroller/EEPROM.class | Bin 2818 -> 2818 bytes bin/Model/Microcontroller/EepromThread.class | Bin 0 -> 372 bytes .../Microcontroller/INSTRUCTIONDECODER.class | Bin 4135 -> 4135 bytes bin/Model/Microcontroller/PIC.class | Bin 13406 -> 13467 bytes bin/Model/MyModel.class | Bin 4293 -> 4293 bytes bin/Model/MyModelData.class | Bin 1459 -> 1459 bytes bin/Model/ProgramLoader/ReadProgramFile.class | Bin 4767 -> 4767 bytes bin/Model/ProgramStepInformation.class | Bin 348 -> 348 bytes bin/Runtime/Main.class | Bin 1897 -> 1897 bytes src/Control/MyControlModel.java | 6 ++-- src/Control/MyControlView.java | 8 +++--- src/Model/Microcontroller/ALU.java | 2 +- src/Model/Microcontroller/EEPROM.java | 4 +-- src/Model/Microcontroller/EepromThread.java | 13 +++++++++ .../Microcontroller/INSTRUCTIONDECODER.java | 6 ++-- src/Model/Microcontroller/PIC.java | 26 ++++++++---------- src/Model/MyModel.java | 12 ++++---- src/Model/MyModelData.java | 8 +++--- src/Model/ProgramLoader/ReadProgramFile.java | 4 +-- src/Model/ProgramStepInformation.java | 4 +-- src/Runtime/Main.java | 8 +++--- 24 files changed, 56 insertions(+), 45 deletions(-) create mode 100644 bin/Model/Microcontroller/EepromThread.class create mode 100644 src/Model/Microcontroller/EepromThread.java diff --git a/bin/Control/MyControlModel.class b/bin/Control/MyControlModel.class index 04f28a72fdd7e82a636437e7de3d152f56876b27..c28780180511e7aa40563b95ff3dacec4c8883e7 100644 GIT binary patch delta 31 icmaFv_uOxT9WzsA@@5C-xr`wCK1(4Rhz{Zwl>q?2u?naF delta 31 icmaFv_uOxT9W#@s^JWL;xr`wCK1(4Rhz{Zwl>q>?(Fy1P diff --git a/bin/Control/MyControlView.class b/bin/Control/MyControlView.class index 1d271ca09050e2dc6829cf99fe877fbcef21431a..ec8a98a57b5be147ed78559cedd699204af2faf7 100644 GIT binary patch delta 47 ucmX>YdN6dt2Bys9iJNu+$;mm45fI99^MA%3Rv>$GFS{ilh(00uQv?9gIudRG delta 47 ucmX>YdN6dt1}0DEiJNu+$;mm45fI99^MA%3Rv>$GFS{ilh(00uQv?9C8WAo4 diff --git a/bin/Model/Microcontroller/ALU.class b/bin/Model/Microcontroller/ALU.class index b65215d05465e74ffa4e217e9c02d004f4c3553a..4c942e7b0745fec00629cdf8e56b5c7f5e959b41 100644 GIT binary patch delta 27 gcmbO!HB)MWI#W*RM9nima^rU=Mj*A>n&}=F0F3tv5C8xG delta 27 gcmbO!HB)MWI+IW6M9nima^rU=Mj*A>n&}=F0D~6^Pyhe` diff --git a/bin/Model/Microcontroller/EEPROM.class b/bin/Model/Microcontroller/EEPROM.class index eef9a9387ebbff963c38b575abb7b246c880610d..fe9de31d1801dfcd12c9c5b5a01c4158ebec7644 100644 GIT binary patch delta 38 kcmZn?YZ9BF&YD_Kl%Km%hlvrw+HB0o#R_FQu^nIm0O)iJ^#A|> delta 38 kcmZn?YZ9BF&gvQv`*_rkD>-*yqzz~BBiQsVLXWAAcQw3jnR|jvc4#lm04t_D72d!oqQbGSoy{f`0 z_gJi0LFdXiQ(p^O$0rj(dc#XOTG;NQjgFvK8mI4@#Z-r}np!Q`FMXx#LbG#ib8>6g^J#G^8e*jZcNGJdR literal 0 HcmV?d00001 diff --git a/bin/Model/Microcontroller/INSTRUCTIONDECODER.class b/bin/Model/Microcontroller/INSTRUCTIONDECODER.class index 41b84e78f469059f3b16899010ee2a52da584d4b..8595154c7bd22120257c2029c3c857affbf2ec50 100644 GIT binary patch delta 101 zcmZ3kuv}q+x?o;$Nl|HXNoIbYOKNg{N@~$Wi+U`ACo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#EJtmbr~0{ge6D-Jf(<-u@<1q&#TEUSSbT`%0fD2Ba3oTKzU}c@J4f~RM&`REz+nG zk5ZNBYEVSAc%14`L4MTHlc=XgG*c6{Q8S*Qt>~sU3{pG76u@iLfj6iVt=UOsu@|my#5V4 diff --git a/bin/Model/MyModelData.class b/bin/Model/MyModelData.class index 9fa05f66a512e1e22b1a3bb35d7d8bfefd9dc88f..4a24f1785e25e102b200787ce5e7a96e8f80a12f 100644 GIT binary patch delta 27 gcmdnYy_tJLBvWSc#ONnLaD_E#om}0Fna=i2wiq delta 27 gcmdnYy_tJLB$KD}#ONnLaD_E#om}0Ei7 diff --git a/bin/Model/ProgramStepInformation.class b/bin/Model/ProgramStepInformation.class index b86b76049af622b6b6b0413216d5be84f9bab494..abe036e5c7904f8b29e79e1195ee40eb928b7d91 100644 GIT binary patch delta 12 Tcmcb^bcbm|3R7nC#I$b!A#w$5 delta 12 Tcmcb^bcbm|3X`Yv#I$b!AW{V^ diff --git a/bin/Runtime/Main.class b/bin/Runtime/Main.class index 821566090acceda2c5786b981fe8c56f35527286..f0ff056d63f33f20f0e48d1863a57bd8c7b3e22a 100644 GIT binary patch delta 44 rcmaFK_mXeIIi}3yjTgKafz)OhCKV7p*@?Lr#NE!E1{RiQ^ qCommandsForModel, ConcurrentLinkedQueue qDataForModel) { oMyView = view; - this.oPIC = new PIC(); + this.oPIC = new Pic(); this.qCommandsForModel = qCommandsForModel; this.qDataForModel = qDataForModel; oControlButtons = oMyView.getGUIMCMenu().getControlButtons(); diff --git a/src/Control/MyControlView.java b/src/Control/MyControlView.java index 86059b1..709daa8 100644 --- a/src/Control/MyControlView.java +++ b/src/Control/MyControlView.java @@ -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 qCommandsToModel; - public MyControlView(PIC oPIC, MyView view, ConcurrentLinkedQueue qCommands) { + public MyControlView(Pic oPIC, MyView view, ConcurrentLinkedQueue 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; } } \ No newline at end of file diff --git a/src/Model/Microcontroller/ALU.java b/src/Model/Microcontroller/ALU.java index 1557287..42c2ee1 100644 --- a/src/Model/Microcontroller/ALU.java +++ b/src/Model/Microcontroller/ALU.java @@ -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; diff --git a/src/Model/Microcontroller/EEPROM.java b/src/Model/Microcontroller/EEPROM.java index ad9f80e..5cea5f7 100644 --- a/src/Model/Microcontroller/EEPROM.java +++ b/src/Model/Microcontroller/EEPROM.java @@ -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"); } diff --git a/src/Model/Microcontroller/EepromThread.java b/src/Model/Microcontroller/EepromThread.java new file mode 100644 index 0000000..ab31205 --- /dev/null +++ b/src/Model/Microcontroller/EepromThread.java @@ -0,0 +1,13 @@ +package Model.Microcontroller; + +public class EepromThread extends Thread { + + public EepromThread() { + + } + + @Override + public void run() { + + } +} diff --git a/src/Model/Microcontroller/INSTRUCTIONDECODER.java b/src/Model/Microcontroller/INSTRUCTIONDECODER.java index 1cd122c..24aebca 100644 --- a/src/Model/Microcontroller/INSTRUCTIONDECODER.java +++ b/src/Model/Microcontroller/INSTRUCTIONDECODER.java @@ -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."); diff --git a/src/Model/Microcontroller/PIC.java b/src/Model/Microcontroller/PIC.java index 437076a..71bc30e 100755 --- a/src/Model/Microcontroller/PIC.java +++ b/src/Model/Microcontroller/PIC.java @@ -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; diff --git a/src/Model/MyModel.java b/src/Model/MyModel.java index a0c35c5..d42a621 100644 --- a/src/Model/MyModel.java +++ b/src/Model/MyModel.java @@ -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 qReceivedCommands; ConcurrentLinkedQueue qDataToModel; - ConcurrentLinkedQueue qDataToView; + ConcurrentLinkedQueue qDataToView; - public MyModel(ConcurrentLinkedQueue qCommands, ConcurrentLinkedQueue qDataS, ConcurrentLinkedQueue qDataR) { + public MyModel(ConcurrentLinkedQueue qCommands, ConcurrentLinkedQueue qDataS, ConcurrentLinkedQueue 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 diff --git a/src/Model/MyModelData.java b/src/Model/MyModelData.java index 6c788ef..073fc1d 100644 --- a/src/Model/MyModelData.java +++ b/src/Model/MyModelData.java @@ -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; } diff --git a/src/Model/ProgramLoader/ReadProgramFile.java b/src/Model/ProgramLoader/ReadProgramFile.java index de6af33..19fef56 100644 --- a/src/Model/ProgramLoader/ReadProgramFile.java +++ b/src/Model/ProgramLoader/ReadProgramFile.java @@ -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. diff --git a/src/Model/ProgramStepInformation.java b/src/Model/ProgramStepInformation.java index d5d36b9..183fdfa 100755 --- a/src/Model/ProgramStepInformation.java +++ b/src/Model/ProgramStepInformation.java @@ -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; } diff --git a/src/Runtime/Main.java b/src/Runtime/Main.java index 4c34fc9..f757098 100755 --- a/src/Runtime/Main.java +++ b/src/Runtime/Main.java @@ -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 qCommandsToModel = new ConcurrentLinkedQueue(); - ConcurrentLinkedQueue qDataToView = new ConcurrentLinkedQueue(); + ConcurrentLinkedQueue qDataToView = new ConcurrentLinkedQueue(); ConcurrentLinkedQueue qDataToModel = new ConcurrentLinkedQueue(); 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(); }