public void fetch() { PcDecode = PC + 4; IrDecode = instructionSet[PC]; rs = peaceOfString(IrDecode, 7, 10); rt = peaceOfString(IrDecode, 11, 15); mipsTable[xDim, yDim] = PC.ToString(); //0 mipsTable[++xDim, yDim] = PcDecode.ToString(); //1 mipsTable[++xDim, yDim] = IrDecode; //2 xDim++; yDim++; }
public void calculateCycles(RichTextBox userCodeData, DataGridView pipRegGrid, DataGridView mipsRegGrid, TextBox pcTextBox) { fillInstructionSet(userCodeData); if (!instructionSet.ContainsKey(PC) || instructionSet[PC] == "00000000000000000000000000000000") { if (gabCycles == 0) { return; } else { gabCycles--; displayPiplineRegisters(pipRegGrid, columnToDisplay++); return; } } if (peaceOfString(instructionSet[PC], 0, 5) == "000100") { PcDecode = PC + 4; IrDecode = instructionSet[PC]; mipsTable[xDim, yDim] = PC.ToString(); //0 mipsTable[++xDim, yDim] = PcDecode.ToString(); //1 mipsTable[++xDim, yDim] = IrDecode; //2 xDim = 0; yDim++; displayPiplineRegisters(pipRegGrid, columnToDisplay++); if (binaryToDecimal(peaceOfString(instructionSet[PC], 6, 10)) == binaryToDecimal(peaceOfString(instructionSet[PC], 11, 15))) { desiredJumpPC = PC + (binaryToDecimal(peaceOfString(instructionSet[PC], 16, 31)) * 4) + 4; desiredLevel = 1; } PC += 4; return; } if (desiredJumpPC == PC || desiredJumpPC == -1) { fetch(); decode(); excute(); memory(); desiredJumpPC = -1; desiredLevel = -1; } else { if (desiredLevel == 1) { fetch(); decode(); excute(); xDim = 0; yDim -= 2; } else if (desiredLevel == 2) { fetch(); decode(); xDim = 0; yDim -= 1; } else if (desiredLevel == 3) { fetch(); xDim = 0; } else { PC = desiredJumpPC; fetch(); decode(); excute(); memory(); } desiredLevel++; } displayPiplineRegisters(pipRegGrid, columnToDisplay++); update(mipsRegGrid, pcTextBox); PC += 4; }