/** * @brief A coroutine to perform the 'decode' cycle. */ public IEnumerator DecodeCycle() { if (currentlyProcessing) { Debug.Log("Cannot perform decode as CPU is currently processing"); } else { currentlyProcessing = true; ConsoleControl.CONSOLE.LogMessage("Performing Decode Cycle"); yield return(microInstructions.WriteToIR(MDR)); //Decode IR's opcode. busSystem.StartTransferringData(BusControl.BUS_ROUTE.IR_CU); yield return(new WaitForSeconds(clock.GetSpeed())); SetCurrentInstructionFromCU(IR.Opcode()); busSystem.StopTransferringData(BusControl.BUS_ROUTE.IR_CU); currentlyProcessing = false; } }
//DATA_MOVEMENT**********************************************\ /** * @brief Reads the content of the PC into a given register. * @param register - The register to be written to. */ public IEnumerator ReadFromPC(Register register) { busSystem.StartTransferringData(register.RouteToPC); yield return(new WaitForSeconds(clock.GetSpeed())); register.Write(PC.ReadString()); busSystem.StopTransferringData(register.RouteToPC); }