Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/20088 )

Change subject: sim: Clean up some mild style bugs in clocked_object.hh.
......................................................................

sim: Clean up some mild style bugs in clocked_object.hh.

Clean up some formatting, and also remove redundant inline keywords.
A function defined in place in a class definition is already
automatically inline.

Change-Id: Iaad3a8dda6498c6a6068c2aabc9d6eb11f3d2eb2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20088
Reviewed-by: Jason Lowe-Power <ja...@lowepower.com>
Maintainer: Jason Lowe-Power <ja...@lowepower.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/sim/clocked_object.hh
1 file changed, 32 insertions(+), 36 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh
index b89e1ce..5df404d 100644
--- a/src/sim/clocked_object.hh
+++ b/src/sim/clocked_object.hh
@@ -78,7 +78,8 @@
* Align cycle and tick to the next clock edge if not already done. When
      *  complete, tick must be at least curTick().
      */
-    void update() const
+    void
+    update() const
     {
         // both tick and cycle are up-to-date and we are done, note
         // that the >= is important as it captures cases where tick
@@ -135,7 +136,8 @@
      * to be used only when the global clock is reset. Currently, this done
      * only when Ruby is done warming up the memory system.
      */
-    void resetClock() const
+    void
+    resetClock() const
     {
         Cycles elapsedCycles(divCeil(curTick(), clockPeriod()));
         cycle = elapsedCycles;
@@ -146,12 +148,8 @@

     /**
      * Update the tick to the current tick.
-     *
      */
-    inline void updateClockPeriod() const
-    {
-        update();
-    }
+    void updateClockPeriod() const { update(); }

     /**
* Determine the tick when a cycle begins, by default the current one, but
@@ -167,7 +165,8 @@
      * this tick can be
      *     curTick() + [0, clockPeriod()) + clockPeriod() * cycles
      */
-    inline Tick clockEdge(Cycles cycles = Cycles(0)) const
+    Tick
+    clockEdge(Cycles cycles=Cycles(0)) const
     {
         // align tick to the next clock edge
         update();
@@ -184,7 +183,8 @@
* to that clock edge. When curTick() is not on a clock edge, return the
      * Cycle corresponding to the next clock edge.
      */
-    inline Cycles curCycle() const
+    Cycles
+    curCycle() const
     {
         // align cycle to the next clock edge.
         update();
@@ -202,54 +202,50 @@
      * the future. Precisely, the returned tick can be in the range
      *     curTick() + [clockPeriod(), 2 * clockPeriod())
      */
-    Tick nextCycle() const
-    { return clockEdge(Cycles(1)); }
+    Tick nextCycle() const { return clockEdge(Cycles(1)); }

-    inline uint64_t frequency() const
+ uint64_t frequency() const { return SimClock::Frequency / clockPeriod(); }
+
+    Tick clockPeriod() const { return clockDomain.clockPeriod(); }
+
+    double voltage() const { return clockDomain.voltage(); }
+
+    Cycles
+    ticksToCycles(Tick t) const
     {
-        return SimClock::Frequency / clockPeriod();
+        return Cycles(divCeil(t, clockPeriod()));
     }

-    inline Tick clockPeriod() const
-    {
-        return clockDomain.clockPeriod();
-    }
-
-    inline double voltage() const
-    {
-        return clockDomain.voltage();
-    }
-
-    inline Cycles ticksToCycles(Tick t) const
-    { return Cycles(divCeil(t, clockPeriod())); }
-
-    inline Tick cyclesToTicks(Cycles c) const
-    { return clockPeriod() * c; }
+    Tick cyclesToTicks(Cycles c) const { return clockPeriod() * c; }
 };

 /**
  * The ClockedObject class extends the SimObject with a clock and
  * accessor functions to relate ticks to the cycles of the object.
  */
-class ClockedObject
-    : public SimObject, public Clocked
+class ClockedObject : public SimObject, public Clocked
 {
   public:
     ClockedObject(const ClockedObjectParams *p);

     /** Parameters of ClockedObject */
     typedef ClockedObjectParams Params;
-    const Params* params() const
-    { return reinterpret_cast<const Params*>(_params); }
+    const Params *
+    params() const
+    {
+        return reinterpret_cast<const Params*>(_params);
+    }

     void serialize(CheckpointOut &cp) const override;
     void unserialize(CheckpointIn &cp) override;

-    inline Enums::PwrState pwrState() const
-    { return _currPwrState; }
+    Enums::PwrState pwrState() const { return _currPwrState; }

-    inline std::string pwrStateName() const
-    { return Enums::PwrStateStrings[_currPwrState]; }
+    std::string
+    pwrStateName() const
+    {
+        return Enums::PwrStateStrings[_currPwrState];
+    }

     /** Returns the percentage residency for each power state */
     std::vector<double> pwrStateWeights() const;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/20088
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Iaad3a8dda6498c6a6068c2aabc9d6eb11f3d2eb2
Gerrit-Change-Number: 20088
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Chun-Chen TK Hsu <chunchen...@google.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to