Ejemplo n.º 1
0
 public void Acquire(ReorderBufferEntry reorderBufferEntry, Action onCompletedCallback)
 {
     this.Pool.EventQueue.Schedule (() =>
     {
         this.IsBusy = false;
         onCompletedCallback ();
     }, this.IssueLatency + this.OperationLatency);
     this.IsBusy = true;
 }
Ejemplo n.º 2
0
        public void RegisterRenameOne()
        {
            DecodeBufferEntry decodeBufferEntry = this.DecodeBuffer.First ();

            this.Regs.IntRegs[RegisterConstants.ZERO_REG] = 0;

            DynamicInstruction dynamicInst = decodeBufferEntry.DynamicInstruction;

            if (!dynamicInst.StaticInstruction.IsNop) {
                ReorderBufferEntry reorderBufferEntry = new ReorderBufferEntry (dynamicInst, dynamicInst.StaticInstruction.IDeps, dynamicInst.StaticInstruction.ODeps);
                reorderBufferEntry.Npc = decodeBufferEntry.Npc;
                reorderBufferEntry.Nnpc = decodeBufferEntry.Nnpc;
                reorderBufferEntry.PredNpc = decodeBufferEntry.PredNpc;
                reorderBufferEntry.PredNnpc = decodeBufferEntry.PredNnpc;
                reorderBufferEntry.StackRecoverIndex = decodeBufferEntry.StackRecoverIndex;
                reorderBufferEntry.DirUpdate = decodeBufferEntry.DirUpdate;
                reorderBufferEntry.IsSpeculative = decodeBufferEntry.IsSpeculative;

                foreach (var iDep in reorderBufferEntry.IDeps) {
                    reorderBufferEntry.SrcPhysRegs[iDep] = this.RenameTable[iDep];
                }

                foreach (var oDep in reorderBufferEntry.ODeps) {
                    reorderBufferEntry.OldPhysRegs[oDep] = this.RenameTable[oDep];
                    this.RenameTable[oDep] = reorderBufferEntry.PhysRegs[oDep] = this.GetPhysicalRegisterFile (oDep.Type).Alloc (reorderBufferEntry);
                }

                if (dynamicInst.StaticInstruction.IsMemory) {
                    ReorderBufferEntry loadStoreQueueEntry = new ReorderBufferEntry (dynamicInst, (dynamicInst.StaticInstruction as MemoryOp).MemIDeps, (dynamicInst.StaticInstruction as MemoryOp).MemODeps);

                    loadStoreQueueEntry.Npc = decodeBufferEntry.Npc;
                    loadStoreQueueEntry.Nnpc = decodeBufferEntry.Nnpc;
                    loadStoreQueueEntry.PredNpc = decodeBufferEntry.PredNpc;
                    loadStoreQueueEntry.PredNnpc = decodeBufferEntry.PredNnpc;
                    loadStoreQueueEntry.StackRecoverIndex = 0;
                    loadStoreQueueEntry.DirUpdate = null;
                    loadStoreQueueEntry.IsSpeculative = false;

                    loadStoreQueueEntry.Ea = (dynamicInst.StaticInstruction as MemoryOp).Ea (this);

                    reorderBufferEntry.LoadStoreQueueEntry = loadStoreQueueEntry;

                    foreach (var iDep in loadStoreQueueEntry.IDeps) {
                        loadStoreQueueEntry.SrcPhysRegs[iDep] = this.RenameTable[iDep];
                    }

                    foreach (var oDep in loadStoreQueueEntry.ODeps) {
                        loadStoreQueueEntry.OldPhysRegs[oDep] = this.RenameTable[oDep];
                        this.RenameTable[oDep] = loadStoreQueueEntry.PhysRegs[oDep] = this.GetPhysicalRegisterFile (oDep.Type).Alloc (loadStoreQueueEntry);
                    }

                    this.LoadStoreQueue.Add (loadStoreQueueEntry);
                }

                this.ReorderBuffer.Add (reorderBufferEntry);
            }

            this.DecodeBuffer.RemoveFirst ();
        }
Ejemplo n.º 3
0
        public void RecoverReorderBuffer(ReorderBufferEntry branchReorderBufferEntry)
        {
            Logger.Infof (Logger.Categories.Simulator, "RecoverReorderBuffer({0:s})", branchReorderBufferEntry);
            //TODO
            while (this.ReorderBuffer.Any ()) {
                ReorderBufferEntry reorderBufferEntry = this.ReorderBuffer.Last ();

                if (!reorderBufferEntry.IsSpeculative) {
                    break;
                }

                if (reorderBufferEntry.IsEAComputation) {
                    ReorderBufferEntry loadStoreQueueEntry = this.LoadStoreQueue.Last ();

                    loadStoreQueueEntry.Invalidate ();

                    foreach (var oDep in loadStoreQueueEntry.ODeps) {
                        loadStoreQueueEntry.PhysRegs[oDep].Dealloc ();
                        this.RenameTable[oDep] = loadStoreQueueEntry.OldPhysRegs[oDep];
                    }

                    loadStoreQueueEntry.PhysRegs.Clear ();

                    this.LoadStoreQueue.RemoveLast ();
                }

                reorderBufferEntry.Invalidate ();

                foreach (var oDep in reorderBufferEntry.ODeps) {
                    reorderBufferEntry.PhysRegs[oDep].Dealloc ();
                    this.RenameTable[oDep] = reorderBufferEntry.OldPhysRegs[oDep];
                }

                reorderBufferEntry.PhysRegs.Clear ();

                this.ReorderBuffer.RemoveLast ();
            }
        }
Ejemplo n.º 4
0
        public PhysicalRegister Alloc(ReorderBufferEntry reorderBufferEntry)
        {
            PhysicalRegister freeReg = this.FindFree ();

            if (freeReg == null) {
                throw new NoFreePhysicalRegisterException ();
            }

            freeReg.Alloc (reorderBufferEntry);
            return freeReg;
        }
Ejemplo n.º 5
0
 public void Alloc(ReorderBufferEntry reorderBufferEntry)
 {
     this.State = States.Allocated;
     this.ReorderBufferEntry = reorderBufferEntry;
 }
Ejemplo n.º 6
0
        public void Acquire(ReorderBufferEntry reorderBufferEntry, Action<ReorderBufferEntry> onCompletedCallback)
        {
            FunctionalUnit.Types type = reorderBufferEntry.DynamicInstruction.StaticInstruction.FunctionalUnitType;
            FunctionalUnit fu = this.FindFree (type);

            if (fu != null) {
                fu.Acquire (reorderBufferEntry, () => onCompletedCallback (reorderBufferEntry));
            } else {
                this.EventQueue.Schedule (() => this.Acquire (reorderBufferEntry, onCompletedCallback), 10);
            }
        }