1/* 2 * Copyright (c) 2012-2013 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 9 * to a hardware implementation of the functionality of the software 10 * licensed hereunder. You may use the software subject to the license 11 * terms below provided that you ensure that this notice is replicated --- 19 unchanged lines hidden (view full) --- 31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 * 38 * Authors: Andreas Hansson |
39 * Christopher Torng |
40 */ 41 42/** 43 * @file 44 * ClockedObject declaration and implementation. 45 */ 46 47#ifndef __SIM_CLOCKED_OBJECT_HH__ --- 67 unchanged lines hidden (view full) --- 115 116 /** 117 * Create a clocked object and set the clock domain based on the 118 * parameters. 119 */ 120 ClockedObject(const ClockedObjectParams* p) : 121 SimObject(p), tick(0), cycle(0), clockDomain(*p->clk_domain) 122 { |
123 // Register with the clock domain, so that if the clock domain 124 // frequency changes, we can update this object's tick. 125 clockDomain.registerWithClockDomain(this); |
126 } 127 128 /** 129 * Virtual destructor due to inheritance. 130 */ 131 virtual ~ClockedObject() { } 132 133 /** --- 6 unchanged lines hidden (view full) --- 140 Cycles elapsedCycles(divCeil(curTick(), clockPeriod())); 141 cycle = elapsedCycles; 142 tick = elapsedCycles * clockPeriod(); 143 } 144 145 public: 146 147 /** |
148 * Update the tick to the current tick. 149 * 150 */ 151 inline void updateClockPeriod() const 152 { 153 update(); 154 } 155 156 /** |
157 * Determine the tick when a cycle begins, by default the current 158 * one, but the argument also enables the caller to determine a 159 * future cycle. 160 * 161 * @param cycles The number of cycles into the future 162 * 163 * @return The tick when the clock edge occurs 164 */ --- 49 unchanged lines hidden --- |