コード例 #1
0
 public void RegistrateCmd(CmdBase cmd)
 {
     Commands.Add(cmd.Signature, cmd);
     cmd.Contract = contract;
 }
コード例 #2
0
 /// <summary>
 /// Send a command to the server.
 /// </summary>
 /// <param name="cmd"></param>
 /// <exception cref="IOException">If socket is not connected</exception>
 /// <exception cref="InvalidOperationException"></exception>
 /// <exception cref="ObjectDisposedException"></exception>
 public void Send(CmdBase cmd)
 {
     _socket.Send(cmd);
 }
コード例 #3
0
 private void OnItemSelectionChanged(object sender, CmdBase cmdBase)
 {
     vsHelper.UpdateShellCommandUI(false);
 }
コード例 #4
0
 public void CmdPush(CmdBase sCmd)
 {
     m_lCmds.AddFirst(sCmd);
 }
コード例 #5
0
 private void OnAuthed(CmdBase command, CommandReply reply)
 {
     LogWriter(LogPrio.Trace, "We have not authenticated.");
     _authed = true;
     RequestEvents();
 }
コード例 #6
0
 public Task <TRlt> SendCmd <TD, TRlt>(CmdBase <TD, TRlt> command)
 {
     mediator ??= serviceProvider.GetService <IMediator>();
     return(mediator.Send <TRlt> (command));
 }
コード例 #7
0
 public void Add(CmdBase cmd)
 {
     lock (_items)
         _items.Enqueue(cmd);
 }
コード例 #8
0
ファイル: Counter.cs プロジェクト: GoneUp/MipsCycler
        public static void Count(Stack <CmdBase> instructions, bool forwarding, int hazardBubbels, int jumpBubbels, int branchBubbels, bool perCycleOutput)
        {
            //Pipline Stages: IF, ID, EX, MEM, WB

            /*
             * Ansatz:
             * Stack der die fünf Stages darstellen soll. solange ausführen bis initale Liste leer is, runden zurückgeben
             */
            Queue <CmdBase> stages         = new Queue <CmdBase>();
            List <CmdBase>  controlHazards = new List <CmdBase>();
            List <CmdBase>  dataHazards    = new List <CmdBase>();

            int cycle = 0;

            while (instructions.Count != 0 || stages.Count > 0)
            {
                cycle++;
                if (perCycleOutput)
                {
                    printStages(stages, cycle - 1);
                }

                if (stages.Count > 5 || instructions.Count == 0)
                {
                    stages.Dequeue(); //remove last wb stage
                }
                if (stages.Count > 5)
                {
                    continue; //bubbels
                }
                if (instructions.Count == 0)
                {
                    continue;                          //skip enqueue part
                }
                CmdBase nextCmd = instructions.Pop();

                //Data Hazards, let our cmd WAIT if we need from a cmd before
                var array    = stages.ToArray();
                var usedRegs = new List <byte>();
                if (array.Length > 0)
                {
                    usedRegs.AddRange(array[array.Length - 1].getDstRegisters());
                    if (array.Length > 1)
                    {
                        usedRegs.AddRange(array[array.Length - 2].getDstRegisters());
                    }
                }
                var actualRegs = nextCmd.getSourceRegisters();

                bool match = false;
                actualRegs.ForEach(ourReg => usedRegs.ForEach(prevReg => { if (ourReg == prevReg)
                                                                           {
                                                                               match = true;
                                                                           }
                                                              }));

                if (match && !(forwarding))
                {
                    //hazard dete
                    for (int i = 0; i < hazardBubbels; i++)
                    {
                        stages.Enqueue(new CmdBubble(""));
                    }
                    dataHazards.Add(nextCmd);
                }

                stages.Enqueue(nextCmd);

                //let the next instruction AFTER our wait
                if (nextCmd is CmdBranch && instructions.Count > 0)
                {
                    //branch penalty
                    for (int i = 0; i < branchBubbels; i++)
                    {
                        stages.Enqueue(new CmdBubble(""));
                    }
                    controlHazards.Add(nextCmd);
                }
                else if (nextCmd is CmdJ && instructions.Count > 0)
                {
                    //Jump penealty
                    for (int i = 0; i < jumpBubbels; i++)
                    {
                        stages.Enqueue(new CmdBubble(""));
                    }
                    controlHazards.Add(nextCmd);
                }
            }


            Console.WriteLine("=======================");
            Console.WriteLine("Data Hazards: ");
            dataHazards.ForEach(e => Console.WriteLine("At: " + e));
            Console.WriteLine("Control Hazards: ");
            controlHazards.ForEach(e => Console.WriteLine("At: " + e));
            Console.WriteLine("=======================");
            Console.WriteLine("Cycle count: " + cycle);
        }