clocked_object.hh (14162:6b811c4fdde6) | clocked_object.hh (14163:98099c4cb5c6) |
---|---|
1/* 2 * Copyright (c) 2012-2013, 2015-2016 ARM Limited 3 * Copyright (c) 2013 Cornell University 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 130 unchanged lines hidden (view full) --- 139 void 140 resetClock() const 141 { 142 Cycles elapsedCycles(divCeil(curTick(), clockPeriod())); 143 cycle = elapsedCycles; 144 tick = elapsedCycles * clockPeriod(); 145 } 146 | 1/* 2 * Copyright (c) 2012-2013, 2015-2016 ARM Limited 3 * Copyright (c) 2013 Cornell University 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating --- 130 unchanged lines hidden (view full) --- 139 void 140 resetClock() const 141 { 142 Cycles elapsedCycles(divCeil(curTick(), clockPeriod())); 143 cycle = elapsedCycles; 144 tick = elapsedCycles * clockPeriod(); 145 } 146 |
147 /** 148 * A hook subclasses can implement so they can do any extra work that's 149 * needed when the clock rate is changed. 150 */ 151 virtual void clockPeriodUpdated() {} 152 |
|
147 public: 148 149 /** 150 * Update the tick to the current tick. 151 */ | 153 public: 154 155 /** 156 * Update the tick to the current tick. 157 */ |
152 void updateClockPeriod() const { update(); } | 158 void 159 updateClockPeriod() 160 { 161 update(); 162 clockPeriodUpdated(); 163 } |
153 154 /** 155 * Determine the tick when a cycle begins, by default the current one, but 156 * the argument also enables the caller to determine a future cycle. When 157 * curTick() is on a clock edge, the number of cycles in the parameter is 158 * added to curTick() to be returned. When curTick() is not aligned to a 159 * clock edge, the number of cycles in the parameter is added to the next 160 * clock edge. --- 125 unchanged lines hidden --- | 164 165 /** 166 * Determine the tick when a cycle begins, by default the current one, but 167 * the argument also enables the caller to determine a future cycle. When 168 * curTick() is on a clock edge, the number of cycles in the parameter is 169 * added to curTick() to be returned. When curTick() is not aligned to a 170 * clock edge, the number of cycles in the parameter is added to the next 171 * clock edge. --- 125 unchanged lines hidden --- |