コード例 #1
0
        /// <summary>
        /// Processor Construction Function
        /// </summary>
        /// <param name="insp_"> Shared Instruction Partitioner </param>
        /// <param name="pid_"> Processor ID</param>
        public PIMProc(ref InsPartition insp_, int pid_)
        {
            pid     = pid_;
            ins_p   = insp_;
            L1Cache = new Cache(true);
            //  Shared_Cache = new Cache(config, true);
            ins_w = new InstructionWindow(Config.ins_w_size, pid);

            IPC = PIMConfigs.IPC;
            if (PIMConfigs.use_l1_cache)
            {
                cache_req_queue = new Queue <ProcRequest>();
            }
            MSHR         = new List <ProcRequest>(Config.mshr_size);
            cal_restrict = new Counter(Config.IPC, Config.IPC);
            mem_restrict = new Counter(1, 1);
            alu          = new ALU();
            tlb          = new PageConverter();
            if (PIMConfigs.writeback)
            {
                writeback_req = new List <ProcRequest>();
            }
            //init callback
            read_callback  = new ReadCallBack(handle_read_callback);
            write_callback = new WriteCallBack(handle_write_callback);
        }
コード例 #2
0
        private void insButton_Click(object sender, RoutedEventArgs e)
        {
            InstructionWindow.setLastWindowLocation(Application.Current.MainWindow.Top, Application.Current.MainWindow.Left);
            InstructionWindow instructionWindow = new InstructionWindow();

            instructionWindow.Show();
            InstructionSwitcher.Switch(InstructionSwitcher.home);
        }
コード例 #3
0
        private InstructionWindow GetInstructionWindow(MInstruction instruction)
        {
            InstructionWindow window = new InstructionWindow()
            {
                StartIndex  = -1,
                EndIndex    = -1,
                Instruction = instruction
            };

            for (int i = 0; i < this.record.Frames.Count; i++)
            {
                CoSimulationFrame frame = this.record.Frames[i];

                if (frame.Instructions.Contains(instruction.ID))
                {
                    if (window.StartIndex == -1)
                    {
                        window.StartIndex = i;
                    }


                    if (window.EndIndex == -1 || window.EndIndex < i)
                    {
                        window.EndIndex = i;
                    }


                    MSimulationResult result = frame.MergedResult;

                    if (result.Events != null && result.Events.Count > 0)
                    {
                        foreach (MSimulationEvent simEvent in result.Events)
                        {
                            if (simEvent.Reference == instruction.ID)
                            {
                                window.Events.Add(i);
                                window.RawEvents.Add(simEvent);
                                break;
                            }
                        }
                    }
                }
            }



            return(window);
        }
コード例 #4
0
        private void OnGUI()
        {
            if (GUI.Button(new Rect(sliderOffsetX, Screen.height - 45, 100, 40), "Start recording"))
            {
                this.SourceAvatar.CoSimulator.Recording = true;
            }

            if (record != null)
            {
                if (GUI.Button(new Rect(sliderOffsetX + 220, Screen.height - 45, 100, 40), "Save"))
                {
                    string outputPath = EditorUtility.SaveFilePanel("Select the output file", "", "record", "cosimRecord");

                    try
                    {
                        byte[] data = MMICSharp.Common.Communication.Serialization.SerializeBinary <CoSimulationRecord>(this.record);

                        System.IO.File.WriteAllBytes(outputPath, data);
                    }
                    catch (System.Exception)
                    {
                    }
                }
            }

            if (GUI.Button(new Rect(sliderOffsetX + 330, Screen.height - 45, 100, 40), "Load"))
            {
                string filePath = EditorUtility.OpenFilePanel("Select the file to be loaded", "", "cosimRecord");

                try
                {
                    byte[] data = System.IO.File.ReadAllBytes(filePath);


                    this.record             = MMICSharp.Common.Communication.Serialization.DeserializeBinary <CoSimulationRecord>(data);
                    this.instructionWindows = new List <InstructionWindow>();

                    //Disable the simulation controller
                    GameObject.FindObjectOfType <SimulationController>().enabled = false;


                    //Add the instruction windows
                    foreach (MInstruction instruction in this.record.Instructions)
                    {
                        InstructionWindow w = this.GetInstructionWindow(instruction);

                        if (w.StartIndex == -1)
                        {
                            continue;
                        }

                        if (w.EndIndex == -1)
                        {
                            w.EndIndex = this.record.Frames.Count - 1;
                        }


                        this.instructionWindows.Add(w);
                    }
                }
                catch (System.Exception)
                {
                }
            }


            if (this.SourceAvatar.CoSimulator != null && this.SourceAvatar.CoSimulator.Recording)
            {
                if (GUI.Button(new Rect(sliderOffsetX + 110, Screen.height - 45, 100, 40), "Stop"))
                {
                    this.record = this.SourceAvatar.CoSimulator.GetRecord();
                    this.SourceAvatar.CoSimulator.Recording = false;
                    this.SourceAvatar.GetComponentInParent <SimulationController>().enabled = false;



                    //Create the instrution windows



                    foreach (MInstruction instruction in this.record.Instructions)
                    {
                        InstructionWindow w = this.GetInstructionWindow(instruction);

                        if (w.StartIndex == -1)
                        {
                            continue;
                        }

                        if (w.EndIndex == -1)
                        {
                            w.EndIndex = this.record.Frames.Count - 1;
                        }


                        this.instructionWindows.Add(w);
                    }
                }
            }

            //Only display if a record has been loaded -> To do provide a way to load records from the file system
            if (this.record != null)
            {
                //Update the slider
                sliderValue = GUI.HorizontalSlider(new Rect(sliderOffsetX, Screen.height - 60, Screen.width - (sliderOffsetX * 2), 20), sliderValue, 0, (float)this.record.Frames.Count);

                //Estimate the current index
                frameIndex = (int)sliderValue;

                //Get the current frame
                currentFrame = this.record.Frames[frameIndex];

                //The amount of elements in the present frame
                this.HierachyElements = currentFrame.Results.Count + currentFrame.CoSimulationSolverResults.Count;

                //Handle if out of range
                if (currentHierachyIndex < -1 || currentHierachyIndex > HierachyElements)
                {
                    currentHierachyIndex = -1;
                }


                currentInstruction = null;


                if (currentHierachyIndex == -1)
                {
                    this.SourceAvatar.AssignPostureValues(currentFrame.MergedResult.Posture);
                }
                else if (currentHierachyIndex == 0)
                {
                    this.SourceAvatar.AssignPostureValues(currentFrame.Initial);
                }
                else
                {
                    if (currentHierachyIndex <= currentFrame.Results.Count)
                    {
                        this.SourceAvatar.AssignPostureValues(currentFrame.Results[currentHierachyIndex - 1].Posture);
                        currentInstruction = GetInstructionByID(currentFrame.Instructions[currentHierachyIndex - 1]);
                    }

                    else
                    {
                        this.SourceAvatar.AssignPostureValues(currentFrame.CoSimulationSolverResults[currentHierachyIndex - currentFrame.Instructions.Count - 1].Posture);
                    }
                }



                GUI.color = Color.red;

                this.ShowInstructionWindows();
            }
        }