clocked_object.hh (9987:7efa5d115a4e) clocked_object.hh (10000:99bd071911cf)
1/*
2 * Copyright (c) 2012-2013 ARM Limited
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * Copyright (c) 2013 Cornell University
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 19 unchanged lines hidden (view full) ---

30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Andreas Hansson
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
38 */
39
40/**
41 * @file
42 * ClockedObject declaration and implementation.
43 */
44
45#ifndef __SIM_CLOCKED_OBJECT_HH__

--- 67 unchanged lines hidden (view full) ---

113
114 /**
115 * Create a clocked object and set the clock domain based on the
116 * parameters.
117 */
118 ClockedObject(const ClockedObjectParams* p) :
119 SimObject(p), tick(0), cycle(0), clockDomain(*p->clk_domain)
120 {
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);
121 }
122
123 /**
124 * Virtual destructor due to inheritance.
125 */
126 virtual ~ClockedObject() { }
127
128 /**

--- 6 unchanged lines hidden (view full) ---

135 Cycles elapsedCycles(divCeil(curTick(), clockPeriod()));
136 cycle = elapsedCycles;
137 tick = elapsedCycles * clockPeriod();
138 }
139
140 public:
141
142 /**
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 /**
143 * Determine the tick when a cycle begins, by default the current
144 * one, but the argument also enables the caller to determine a
145 * future cycle.
146 *
147 * @param cycles The number of cycles into the future
148 *
149 * @return The tick when the clock edge occurs
150 */

--- 49 unchanged lines hidden ---
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 ---