implemented alu
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,7 +29,7 @@ public class ALU {
|
||||
* @param bSubtractionBit
|
||||
* @return
|
||||
*/
|
||||
public int calcValue(int iValue1, int iWRegister, boolean bSubtractionBit) {
|
||||
public int calcAddition(int iValue1, int iWRegister, boolean bSubtractionBit) {
|
||||
//Array with booleans which represent the value of value 1 that will be used for calculation
|
||||
boolean[] abValue1 = new boolean[8];
|
||||
abValue1[0] = ((iValue1 & 0b1) == 0b1);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PIC {
|
||||
*/
|
||||
public void ADDLW(int eightK) {
|
||||
int wRegValue = get_WRegister();
|
||||
int result = ArithmeticLogicUnit.calcValue(eightK, wRegValue, false);
|
||||
int result = ArithmeticLogicUnit.calcAddition(eightK, wRegValue, false);
|
||||
result &= 255;
|
||||
setWRegister(result);
|
||||
|
||||
@@ -197,7 +197,7 @@ public class PIC {
|
||||
int regFileAddrValue = Ram.get_Value_Of_Bank_RP0_Bit_Of_Element_At_Adress(Ram.get_RP0Bit(), registerFileAddress);
|
||||
|
||||
//Calculate result.
|
||||
int result = ArithmeticLogicUnit.calcValue(regFileAddrValue, wRegValue, false);
|
||||
int result = ArithmeticLogicUnit.calcAddition(regFileAddrValue, wRegValue, false);
|
||||
|
||||
Ram.set_Carryflag(ArithmeticLogicUnit.getCarryFlag());
|
||||
Ram.set_Digitcarryflag(ArithmeticLogicUnit.getDigitCarryFlag());
|
||||
@@ -1177,7 +1177,7 @@ public class PIC {
|
||||
public void SUBLW(int eightK) {
|
||||
int wRegValue = get_WRegister();
|
||||
|
||||
int result = ArithmeticLogicUnit.calcValue(eightK, wRegValue, true);
|
||||
int result = ArithmeticLogicUnit.calcAddition(eightK, wRegValue, true);
|
||||
result &= 255;
|
||||
|
||||
Ram.set_Carryflag(ArithmeticLogicUnit.getCarryFlag());
|
||||
@@ -1210,7 +1210,7 @@ public class PIC {
|
||||
//Get value at fileaddress.
|
||||
int regFileAddrValue = Ram.get_Value_Of_Bank_RP0_Bit_Of_Element_At_Adress(Ram.get_RP0Bit(), registerFileAddress);
|
||||
|
||||
int result = ArithmeticLogicUnit.calcValue(regFileAddrValue, wRegValue, true);
|
||||
int result = ArithmeticLogicUnit.calcAddition(regFileAddrValue, wRegValue, true);
|
||||
result &= 255;
|
||||
|
||||
Ram.set_Carryflag(ArithmeticLogicUnit.getCarryFlag());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class GUIRamTable extends JScrollPane {
|
||||
|
||||
JLabel oRam = new JLabel("RAM");
|
||||
|
||||
String[][] assData = {{"0x", "07", "06", "05", "04", "03", "02", "01", "00"}, {"00", "", "", "", "", "", "", "", ""},
|
||||
String[][] assData = {{"0x", "00", "01", "02", "03", "04", "05", "06", "07"}, {"00", "", "", "", "", "", "", "", ""},
|
||||
{"08", "", "", "", "", "", "", "", ""}, {"10", "", "", "", "", "", "", "", ""},
|
||||
{"18", "", "", "", "", "", "", "", ""}, {"20", "", "", "", "", "", "", "", ""},
|
||||
{"28", "", "", "", "", "", "", "", ""}, {"30", "", "", "", "", "", "", "", ""},
|
||||
|
||||
@@ -195,11 +195,13 @@ public class GUITestFileTable extends JScrollPane {
|
||||
* @param iLineToMark
|
||||
*/
|
||||
public void markLine(int iLineToMark) {
|
||||
if (iLineToMark > -1) {
|
||||
oLineInformation.get(iLineToMark * 2).setForeground(getThemeColor()[3]);
|
||||
oLineInformation.get(iLineToMark * 2).setBorder(BorderFactory.createLineBorder(getThemeColor()[3]));
|
||||
oLineInformation.get(iLineToMark * 2 + 1).setForeground(getThemeColor()[3]);
|
||||
oLineInformation.get(iLineToMark * 2 + 1).setBorder(BorderFactory.createLineBorder(getThemeColor()[3]));
|
||||
if (oLineInformation.size() > iLineToMark) {
|
||||
if (iLineToMark > -1) {
|
||||
oLineInformation.get(iLineToMark * 2).setForeground(getThemeColor()[3]);
|
||||
oLineInformation.get(iLineToMark * 2).setBorder(BorderFactory.createLineBorder(getThemeColor()[3]));
|
||||
oLineInformation.get(iLineToMark * 2 + 1).setForeground(getThemeColor()[3]);
|
||||
oLineInformation.get(iLineToMark * 2 + 1).setBorder(BorderFactory.createLineBorder(getThemeColor()[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,11 +210,13 @@ public class GUITestFileTable extends JScrollPane {
|
||||
* @param iLineToUnmark
|
||||
*/
|
||||
public void unmarkLine(int iLineToUnmark) {
|
||||
if (iLineToUnmark > -1) {
|
||||
oLineInformation.get(iLineToUnmark * 2).setForeground(getThemeColor()[0]);
|
||||
oLineInformation.get(iLineToUnmark * 2).setBorder(BorderFactory.createLineBorder(getThemeColor()[2]));
|
||||
oLineInformation.get(iLineToUnmark * 2 + 1).setForeground(getThemeColor()[0]);
|
||||
oLineInformation.get(iLineToUnmark * 2 + 1).setBorder(BorderFactory.createLineBorder(getThemeColor()[2]));
|
||||
if (oLineInformation.size() > iLineToUnmark) {
|
||||
if (iLineToUnmark > -1) {
|
||||
oLineInformation.get(iLineToUnmark * 2).setForeground(getThemeColor()[0]);
|
||||
oLineInformation.get(iLineToUnmark * 2).setBorder(BorderFactory.createLineBorder(getThemeColor()[2]));
|
||||
oLineInformation.get(iLineToUnmark * 2 + 1).setForeground(getThemeColor()[0]);
|
||||
oLineInformation.get(iLineToUnmark * 2 + 1).setBorder(BorderFactory.createLineBorder(getThemeColor()[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user