public override void Execute() { CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "Call override Execute()."); switch (caching.TYPE) { case COMMAND_TYPE.NON_CACHE: if (!SystemBus.IsBusy()) { SystemBus.TakeBus(); CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "take SystemBus."); //for (int i = 0; i < 6; i++) //{ // FormDrawer.BrickUP(caching.TYPE); //} SystemBus.FreeBus(); CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "free SystemBus."); base.state = CONTROLLER_STATE.EXECUTED; OnCahed(); } else { base.OnSetRequest(); Console.WriteLine(Name + " go to INTERRUPT case."); base.state = CONTROLLER_STATE.INTERRUPT; } break; case COMMAND_TYPE.NON_CACHE_CTRL: if (!SystemBus.IsBusy()) { SystemBus.TakeBus(); Console.WriteLine(Name + " take SystemBus."); //for (int i = 0; i < 6; i++) //{ // FormDrawer.BrickUP(caching.TYPE); //} SystemBus.FreeBus(); Console.WriteLine(Name + " free SystemBus."); base.state = CONTROLLER_STATE.EXECUTED; } else { base.OnSetRequest(); Console.WriteLine(Name + " go to INTERRUPT case."); base.state = CONTROLLER_STATE.INTERRUPT; } break; } }
public override void Execute() { //Console.WriteLine("Call override Execute() in MPController."); CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "Call override Execute()."); switch (base.currient.TYPE) { case COMMAND_TYPE.CACHE: base.Decode(); base.Execute(); //base.Remove(); //base.state = CONTROLLER_STATE.READY; base.OnExecuted(); break; case COMMAND_TYPE.CACHE_CTRL: base.Decode(); if (!SystemBus.IsBusy()) { SystemBus.TakeBus(); CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "take SystemBus."); base.Execute(); SystemBus.FreeBus(); CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "free SystemBus."); //base.Remove(); base.state = CONTROLLER_STATE.READY; } else { base.OnSetRequest(); //base.currient.DEFERRED = true; Console.WriteLine(Name + " go to INTERRUPT case."); base.state = CONTROLLER_STATE.INTERRUPT; } break; case COMMAND_TYPE.NON_CACHE: own_cache.Caching(base.currient); if (own_cache.state == CONTROLLER_STATE.WAITING) { cache_thread.Interrupt(); Thread.Sleep(100); } //_own_cache.Simulator(); if (own_cache.state == CONTROLLER_STATE.EXECUTED) { CoreExtensions.ConsoleLog(Thread.CurrentThread.Name, "Get execution form own CC."); base.Decode(); base.Execute(); base.currient.COMPLITE = true; own_cache.state = CONTROLLER_STATE.END; //base.Remove(); base.state = CONTROLLER_STATE.READY; } break; case COMMAND_TYPE.NON_CACHE_CTRL: own_cache.Caching(base.currient); if (own_cache.state == CONTROLLER_STATE.WAITING) { cache_thread.Interrupt(); } //_own_cache.Simulator(); if (own_cache.state == CONTROLLER_STATE.EXECUTED) { Console.WriteLine("Get execution in " + Name); base.Decode(); base.currient.COMPLITE = true; //base.Remove(); base.state = CONTROLLER_STATE.READY; } break; } }