public void strobe() { Debug.Log("The button has been strobed!!"); if (t_PCin.isOn) { PCscript.pcVal = busScript.busVal; } if (t_MDin.isOn) { MDscript.mdString = busScript.busVal.ToString(); } if (t_MAin.isOn) { MAscript.maVal = busScript.busVal; } if (t_Cin.isOn) { Cscript.cVal = ALUScript.ALUVal; } if (t_Ain.isOn) { Ascript.aVal = busScript.busVal; } if (t_Rin.isOn) { switch (selReg) { case "a": selRegVal = registerABox.text; selRegLoc = Int32.Parse(selRegVal); regChild = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> (); regChild.text = busScript.busVal.ToString(); break; case "b": selRegVal = registerABox.text; selRegLoc = Int32.Parse(selRegVal); regChild = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> (); regChild.text = busScript.busVal.ToString(); break; case "c": selRegVal = registerABox.text; selRegLoc = Int32.Parse(selRegVal); regChild = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> (); regChild.text = busScript.busVal.ToString(); break; } } if (t_IRin.isOn) { InstructionScript.instructionVal = busScript.busVal; } // Read and Write from memory -------------------------------------------------------- if (t_MDRead.isOn) { MDscript.mdString = MemoryScript.memList [MAscript.maVal].hexWord; } // ALU codes ------------------------------------------------------------------------- if (t_INC4.isOn) { ALUScript.ALUVal = busScript.busVal; ALUScript.ALUVal += 4; if (t_Cin.isOn) { Cscript.cVal = ALUScript.ALUVal; } } if (t_ADD.isOn) { ALUScript.ALUVal = busScript.busVal; ALUScript.ALUVal += Ascript.aVal; if (t_Cin.isOn) { Cscript.cVal = ALUScript.ALUVal; } } if (t_SUB.isOn) { ALUScript.ALUVal = busScript.busVal; ALUScript.ALUVal -= Ascript.aVal; if (t_Cin.isOn) { Cscript.cVal = ALUScript.ALUVal; } } //Ending Code ------------------------------------------------------------------------ if (t_END.isOn) { _clock.clearClock(); s_clear.clear(); } else { if (t_END.isOn == false) { _clock.incClock(); } } s_clear.clear(); }
public void Step() { Debug.Log("this button has stepped!!"); step = _clock.getClockVal(); switch (step) { case 0: //PCout, MAin, INC4, Cin, (STROBE), (CLEAR) _clearing.clear(); /* * StartCoroutine(justChill()); * t_PCout.isOn = true; * StartCoroutine(justChill()); * t_Cin.isOn = true; * StartCoroutine(justChill()); * t_MAin.isOn = true; * StartCoroutine(justChill()); * t_INC4.isOn = true; * StartCoroutine(justChill()); * _strobing.strobe (); * StartCoroutine(justChill()); */ busScript.busVal = PCscript.pcVal; MAscript.maVal = busScript.busVal; ALUScript.ALUVal = busScript.busVal; ALUScript.ALUVal += 4; Cscript.cVal = ALUScript.ALUVal; _strobing.strobe(); break; case 1: //Cout, PCin, Read, (STROBE), (CLEAR) _clearing.clear(); StartCoroutine(justChill()); busScript.busVal = Cscript.cVal; StartCoroutine(justChill()); t_MDRead.isOn = true; StartCoroutine(justChill()); t_PCin.isOn = true; StartCoroutine(justChill()); _strobing.strobe(); StartCoroutine(justChill()); break; case 2: //MDout, IRin, (STROBE), (CLEAR) _clearing.clear(); StartCoroutine(justChill()); t_MDout.isOn = true; StartCoroutine(justChill()); t_IRin.isOn = true; StartCoroutine(justChill()); busScript.busVal = MDscript.mdVal; StartCoroutine(justChill()); InstructionScript.instructionVal = busScript.busVal; StartCoroutine(justChill()); _strobing.strobe(); StartCoroutine(justChill()); break; case 3: _clearing.clear(); StartCoroutine(justChill()); switch (opCode) { case "12": //ADD t_Rout.isOn = true; StartCoroutine(justChill()); t_Grb.isOn = true; StartCoroutine(justChill()); t_Ain.isOn = true; StartCoroutine(justChill()); break; case "1": //SUB break; case "2": //ADDI break; case "3": //AND break; case "4": //OR break; case "5": //SHR break; case "6": //SHRA break; case "7": //SHL break; case "8": //SHC break; case "9": //NOT break; case "10": //NEG break; } _strobing.strobe(); StartCoroutine(justChill()); break; case 4: switch (opCode) { case "12": //ADD break; case "1": //SUB break; case "2": //ADDI break; case "3": //AND break; case "4": //OR break; case "5": //SHR break; case "6": //SHRA break; case "7": //SHL break; case "8": //SHC break; case "9": //NOT break; case "10": //NEG break; } break; } }