changeset 83c3e117464e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=83c3e117464e
description:
        cpu: Change literal integer constants to meaningful labels

        fu_pool and inst_queue were using -1 for "no such FU" and -2 for "all 
those
        FUs are busy at the moment" when requesting for a FU and replying. This
        patch introduces new constants NoCapableFU and NoFreeFU respectively.

        In addition, the condition (idx == -2 || idx != -1) is equivalent to
        (idx != -1), so this patch also simplifies that.

diffstat:

 src/cpu/o3/fu_pool.hh         |  13 +++++++++----
 src/cpu/o3/inst_queue_impl.hh |   6 +++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r 1bd9f1b27438 -r 83c3e117464e src/cpu/o3/fu_pool.hh
--- a/src/cpu/o3/fu_pool.hh     Fri Mar 04 20:14:10 2016 -0500
+++ b/src/cpu/o3/fu_pool.hh     Tue May 05 16:47:24 2015 +0100
@@ -134,12 +134,17 @@
     FUPool(const Params *p);
     ~FUPool();
 
+    static constexpr auto NoCapableFU = -2;
+    static constexpr auto NoFreeFU = -1;
     /**
-     * Gets a FU providing the requested capability. Will mark the unit as 
busy,
-     * but leaves the freeing of the unit up to the IEW stage.
+     * Gets a FU providing the requested capability. Will mark the
+     * unit as busy, but leaves the freeing of the unit up to the IEW
+     * stage.
+     *
      * @param capability The capability requested.
-     * @return Returns -2 if the FU pool does not have the capability, -1 if
-     * there is no free FU, and the FU's index otherwise.
+     * @return Returns NoCapableFU if the FU pool does not have the
+     * capability, NoFreeFU if there is no free FU, and the FU's index
+     * otherwise.
      */
     int getUnit(OpClass capability);
 
diff -r 1bd9f1b27438 -r 83c3e117464e src/cpu/o3/inst_queue_impl.hh
--- a/src/cpu/o3/inst_queue_impl.hh     Fri Mar 04 20:14:10 2016 -0500
+++ b/src/cpu/o3/inst_queue_impl.hh     Tue May 05 16:47:24 2015 +0100
@@ -801,21 +801,21 @@
             continue;
         }
 
-        int idx = -2;
+        int idx = FUPool::NoCapableFU;
         Cycles op_latency = Cycles(1);
         ThreadID tid = issuing_inst->threadNumber;
 
         if (op_class != No_OpClass) {
             idx = fuPool->getUnit(op_class);
             issuing_inst->isFloating() ? fpAluAccesses++ : intAluAccesses++;
-            if (idx > -1) {
+            if (idx > FUPool::NoFreeFU) {
                 op_latency = fuPool->getOpLatency(op_class);
             }
         }
 
         // If we have an instruction that doesn't require a FU, or a
         // valid FU, then schedule for execution.
-        if (idx == -2 || idx != -1) {
+        if (idx != FUPool::NoFreeFU) {
             if (op_latency == Cycles(1)) {
                 i2e_info->size++;
                 instsToExecute.push_back(issuing_inst);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to