Ejemplo n.º 1
0
        private void markReservationStationFull(ReservationStationEntry resStationEntry)
        {
            switch (resStationEntry.instr.executionType)
            {
            case Instruction.ExecutionType.Branch:
                Statistics.branchExecutionUnitsFull++;
                break;

            case Instruction.ExecutionType.FloatingPoint:
                Statistics.floatingExecutionUnitsFull++;
                break;

            case Instruction.ExecutionType.Logical:
            case Instruction.ExecutionType.Integer:
                Statistics.integerExecutionUnitsFull++;
                break;

            case Instruction.ExecutionType.Mem:
                Statistics.memoryExecutionUnitsFull++;
                break;

            case Instruction.ExecutionType.MultDiv:
                Statistics.multDivExecutionUnitsFull++;
                break;

            default:
                System.Console.WriteLine("ERROR:ExecutionStage.canIssue, unknown Execution Type");
                break;
            }
        }
Ejemplo n.º 2
0
        private ExecutionUnit[] getTargetUnitArray(ReservationStationEntry resStationEntry)
        {
            ExecutionUnit[] targetUnitArray;

            switch (resStationEntry.instr.executionType)
            {
            case Instruction.ExecutionType.Branch:
                targetUnitArray = this.branchUnits;
                break;

            case Instruction.ExecutionType.FloatingPoint:
                targetUnitArray = this.fpUnits;
                break;

            case Instruction.ExecutionType.Logical:
            case Instruction.ExecutionType.Integer:
                targetUnitArray = this.intUnits;
                break;

            case Instruction.ExecutionType.Mem:
                targetUnitArray = this.memUnits;
                break;

            case Instruction.ExecutionType.MultDiv:
                targetUnitArray = this.multDivUnits;
                break;

            default:
                System.Console.WriteLine("ERROR:ExecutionStage.canIssue, unknown Execution Type");
                targetUnitArray = null;
                break;
            }
            return(targetUnitArray);
        }
Ejemplo n.º 3
0
 public void acceptIssue(ReservationStationEntry resStationEntry)
 {
     ExecutionUnit[] targetUnitArray = this.getTargetUnitArray(resStationEntry);
     for (int i = 0; i < targetUnitArray.Length; i++)
     {
         if (targetUnitArray[i].busy == false)
         {
             targetUnitArray[i].LoadInstruction(resStationEntry);
             break;
         }
     }
 }
Ejemplo n.º 4
0
 public void acceptIssue(ReservationStationEntry resStationEntry)
 {
     ExecutionUnit[] targetUnitArray = this.getTargetUnitArray(resStationEntry);
     for (int i = 0; i < targetUnitArray.Length; i++)
     {
         if (targetUnitArray[i].busy == false)
         {
             targetUnitArray[i].LoadInstruction(resStationEntry);
             break;
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Loads an instruction into the Execution Unit
        /// </summary>
        /// <param name="_instr"></param>
        public void LoadInstruction(ReservationStationEntry _entry)
        {
            this.entry = _entry;
            this.busy  = true;
            Random rand = new Random();

            switch (entry.instr.executionType)
            {
            case Instruction.ExecutionType.Branch:
                this.remainingCycles = Config.branchExeLatency;
                break;

            case Instruction.ExecutionType.FloatingPoint:
                this.remainingCycles = Config.fpExeLatency;
                break;

            case Instruction.ExecutionType.Logical:
            case Instruction.ExecutionType.Integer:
                this.remainingCycles = Config.intExeLatency;
                break;

            case Instruction.ExecutionType.Mem:
                this.remainingCycles = Config.memExeLatency;
                break;

            case Instruction.ExecutionType.MultDiv:
                this.remainingCycles = Config.mulDivExeLatency;
                break;

            default:
                System.Console.WriteLine("ERROR:Execution unit constructor, unknown Execution Type");
                break;
            }


            // Check to see if it is a memory instruction so we can add the delays
            if (entry.instr.executionType == Instruction.ExecutionType.Mem)
            {
                // Check to see if we missed level 1
                if (rand.Next(100) < Config.level1CacheDataMissPercent)
                {
                    Statistics.level1DataCacheMisses++;
                    this.remainingCycles += Config.level1CacheMissPenalty;
                    // Check to see if we missed level 2
                    if (rand.Next(100) < Config.level2CacheMissPercent)
                    {
                        Statistics.level2CacheMisses++;
                        this.remainingCycles += Config.level2CacheMissPenalty;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Tells the Reorder Buffer that execution has finished on an instruction inside the given resEntry
        /// </summary>
        /// <param name="resStationEntry"></param>
        /// <returns>The RRF Tag index</returns>
        public int executionFinished(ReservationStationEntry resStationEntry)
        {
            RobEntry robEntry;
            robEntry = this.buffer.FirstOrDefault(_robEntry => _robEntry.instruction == resStationEntry.instr);
            if (robEntry == null)
            {
                System.Console.WriteLine("ROB.executionFinished(): An instruction finished but was not found in the ROB buffer");
                return -1;
            }

            robEntry.finished = true;
            return robEntry.renameReg;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Tells the Reorder Buffer that execution has finished on an instruction inside the given resEntry
        /// </summary>
        /// <param name="resStationEntry"></param>
        /// <returns>The RRF Tag index</returns>
        public int executionFinished(ReservationStationEntry resStationEntry)
        {
            RobEntry robEntry;

            robEntry = this.buffer.FirstOrDefault(_robEntry => _robEntry.instruction == resStationEntry.instr);
            if (robEntry == null)
            {
                System.Console.WriteLine("ROB.executionFinished(): An instruction finished but was not found in the ROB buffer");
                return(-1);
            }

            robEntry.finished = true;
            return(robEntry.renameReg);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Takes a reservation station entry and checks to see if it can be issued
        /// 
        /// This is competed by checking the appropriate list of execution units to
        /// see if there is one available
        /// <returns>true if the instruction can be issued and false if not</returns>
        /// </summary>
        public bool canIssue(ReservationStationEntry resStationEntry)
        {
            ExecutionUnit[] targetUnitArray = this.getTargetUnitArray(resStationEntry);
            for (int i = 0; i < targetUnitArray.Length; i++)
            {
                // if there is room return true
                if (targetUnitArray[i].busy == false)
                    return true;
            }

            // If we check all of the exeuction units, and they are all busy == true, then there is no room
            markReservationStationFull(resStationEntry);
            return false;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Takes a reservation station entry and checks to see if it can be issued
        ///
        /// This is competed by checking the appropriate list of execution units to
        /// see if there is one available
        /// <returns>true if the instruction can be issued and false if not</returns>
        /// </summary>
        public bool canIssue(ReservationStationEntry resStationEntry)
        {
            ExecutionUnit[] targetUnitArray = this.getTargetUnitArray(resStationEntry);
            for (int i = 0; i < targetUnitArray.Length; i++)
            {
                // if there is room return true
                if (targetUnitArray[i].busy == false)
                {
                    return(true);
                }
            }

            // If we check all of the exeuction units, and they are all busy == true, then there is no room
            markReservationStationFull(resStationEntry);
            return(false);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Puts the instruction into the reservation station, filling the entries
        /// Note this does not check if ResStation is full, as that check is done at a higher level
        /// </summary>
        public void ReceiveInstruction(Instruction instr, int robTag)
        {
            // The reservation station entry we're creating
            ReservationStationEntry thisEntry;

            // The fields in the entry
            int  op1 = 0, op2 = 0;
            bool valid1 = false, valid2 = false;

            SetUpOp(ref op1, ref valid1, instr.source1, instr.source1Imm);
            SetUpOp(ref op2, ref valid2, instr.source2, instr.source2Imm);

            thisEntry = new ReservationStationEntry(op1, valid1, op2, valid2, robTag, instr);

            this.buffer.Add(thisEntry);
        } // End ReceiveInstruction
Ejemplo n.º 11
0
        /// <summary>
        /// Loads an instruction into the Execution Unit
        /// </summary>
        /// <param name="_instr"></param>
        public void LoadInstruction(ReservationStationEntry _entry)
        {
            this.entry = _entry;
            this.busy = true;
            Random rand = new Random();

            switch (entry.instr.executionType)
            {
                case Instruction.ExecutionType.Branch :
                    this.remainingCycles = Config.branchExeLatency;
                    break;
                case Instruction.ExecutionType.FloatingPoint :
                    this.remainingCycles = Config.fpExeLatency;
                    break;
                case Instruction.ExecutionType.Logical :
                case Instruction.ExecutionType.Integer :
                    this.remainingCycles = Config.intExeLatency;
                    break;
                case Instruction.ExecutionType.Mem :
                    this.remainingCycles = Config.memExeLatency;
                    break;
                case Instruction.ExecutionType.MultDiv :
                    this.remainingCycles = Config.mulDivExeLatency;
                    break;
                default :
                    System.Console.WriteLine("ERROR:Execution unit constructor, unknown Execution Type");
                    break;
            }

            // Check to see if it is a memory instruction so we can add the delays
            if (entry.instr.executionType == Instruction.ExecutionType.Mem)
            {
                // Check to see if we missed level 1
                if (rand.Next(100) < Config.level1CacheDataMissPercent)
                {
                    Statistics.level1DataCacheMisses++;
                    this.remainingCycles += Config.level1CacheMissPenalty;
                    // Check to see if we missed level 2
                    if (rand.Next(100) < Config.level2CacheMissPercent)
                    {
                        Statistics.level2CacheMisses++;
                        this.remainingCycles += Config.level2CacheMissPenalty;
                    }
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Puts the instruction into the reservation station, filling the entries
        /// Note this does not check if ResStation is full, as that check is done at a higher level
        /// </summary>
        public void ReceiveInstruction(Instruction instr, int robTag)
        {
            // The reservation station entry we're creating
            ReservationStationEntry thisEntry;

            // The fields in the entry
            int op1 = 0, op2 = 0;
            bool valid1 = false, valid2 = false;

            SetUpOp(ref op1, ref valid1, instr.source1, instr.source1Imm);
            SetUpOp(ref op2, ref valid2, instr.source2, instr.source2Imm);

            thisEntry = new ReservationStationEntry(op1, valid1, op2, valid2, robTag, instr);

            this.buffer.Add(thisEntry);
        }
Ejemplo n.º 13
0
        private ExecutionUnit[] getTargetUnitArray(ReservationStationEntry resStationEntry)
        {
            ExecutionUnit[] targetUnitArray;

            switch (resStationEntry.instr.executionType)
            {
                case Instruction.ExecutionType.Branch:
                    targetUnitArray = this.branchUnits;
                    break;
                case Instruction.ExecutionType.FloatingPoint:
                    targetUnitArray = this.fpUnits;
                    break;
                case Instruction.ExecutionType.Logical:
                case Instruction.ExecutionType.Integer:
                    targetUnitArray = this.intUnits;
                    break;
                case Instruction.ExecutionType.Mem:
                    targetUnitArray = this.memUnits;
                    break;
                case Instruction.ExecutionType.MultDiv:
                    targetUnitArray = this.multDivUnits;
                    break;
                default:
                    System.Console.WriteLine("ERROR:ExecutionStage.canIssue, unknown Execution Type");
                    targetUnitArray = null;
                    break;
            }
            return targetUnitArray;
        }
Ejemplo n.º 14
0
 private void markReservationStationFull(ReservationStationEntry resStationEntry)
 {
     switch (resStationEntry.instr.executionType)
     {
         case Instruction.ExecutionType.Branch:
             Statistics.branchExecutionUnitsFull++;
             break;
         case Instruction.ExecutionType.FloatingPoint:
             Statistics.floatingExecutionUnitsFull++;
             break;
         case Instruction.ExecutionType.Logical:
         case Instruction.ExecutionType.Integer:
             Statistics.integerExecutionUnitsFull++;
             break;
         case Instruction.ExecutionType.Mem:
             Statistics.memoryExecutionUnitsFull++;
             break;
         case Instruction.ExecutionType.MultDiv:
             Statistics.multDivExecutionUnitsFull++;
             break;
         default:
             System.Console.WriteLine("ERROR:ExecutionStage.canIssue, unknown Execution Type");
             break;
     }
 }