/** * @brief Inialise the Control Unit. */ IEnumerator Start() { //Wait until the insturction set it loaded. yield return(LoadInstructionSet()); //Link in the micro instructions. microInstructions = gameObject.GetComponent <MicroInstructions>(); microInstructions.LinkCPUcomponents( PC, MAR, MDR, IR, GPA, GPB, PSR, memory, ALU, clock, busSystem ); //Set up the first instruction in the CU. SetCurrentInstructionFromCU(0); //Set up the buttons. InitialiseButtons(); loading = false; }
public void Parse() { foreach (var microInstructionTuple in _microInstructionTuples) { var microInstruction = new MicroInstruction(); microInstruction.MicroInstructionString = microInstructionTuple.Item3; string[] microCommands = microInstructionTuple.Item3.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); microInstruction.SBUSSourceBinary = _microInstructionDictionaries.SBUSDictionary[microCommands[0]]; microInstruction.DBUSSourceBinary = _microInstructionDictionaries.DBUSDictionary[microCommands[1]]; microInstruction.ALUOperationBinary = _microInstructionDictionaries.ALUOperationDictionary[microCommands[2]]; microInstruction.RBUSDestinationBinary = _microInstructionDictionaries.RBUSDictionary[microCommands[3]]; microInstruction.OtherOperationsBinary = _microInstructionDictionaries.OtherOperationDictionary[microCommands[4]]; microInstruction.MemoryOperationsBinary = _microInstructionDictionaries.MemoryOperationDictionary[microCommands[5]]; microInstruction.SBUSSourceString = microCommands[0]; microInstruction.DBUSSourceString = microCommands[1]; microInstruction.ALUOperationString = microCommands[2]; microInstruction.RBUSDestinationString = microCommands[3]; microInstruction.OtherOperationsString = microCommands[4]; microInstruction.MemoryOperationsString = microCommands[5]; microInstruction.RamificationConditionString = microCommands[6]; ComputeJump(microInstruction); MicroInstructions.Add(microInstruction); //Console.WriteLine("Address: " + microInstructionTuple.Item2 + " " + microInstruction.GetMicroInstructionBinary() + " Length:" + microInstruction.GetMicroInstructionBinary().Length); } MicroInstructions.ForEach(mistr => MicroInstructionsBinaryList.Add(new SimpleMicroInstruction { MicroInstructionBinary = mistr.GetMicroInstructionBinary(), MicroInstructionString = mistr.MicroInstructionString })); }