gem5  v21.1.0.2
timing_expr.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014 ARM Limited
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
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 
38 /*
39  * These classes define an expression language over uint64_t with only
40  * a few operators. This can be used to form expressions for the extra
41  * delay required in variable execution time instructions.
42  *
43  * Expressions, in evaluation, will have access to the ThreadContext and
44  * a StaticInst.
45  */
46 
47 #ifndef __CPU_TIMING_EXPR_HH__
48 #define __CPU_TIMING_EXPR_HH__
49 
50 #include "cpu/static_inst.hh"
51 #include "cpu/thread_context.hh"
52 #include "enums/TimingExprOp.hh"
53 #include "params/TimingExpr.hh"
54 #include "params/TimingExprBin.hh"
55 #include "params/TimingExprIf.hh"
56 #include "params/TimingExprLet.hh"
57 #include "params/TimingExprLiteral.hh"
58 #include "params/TimingExprReadIntReg.hh"
59 #include "params/TimingExprRef.hh"
60 #include "params/TimingExprSrcReg.hh"
61 #include "params/TimingExprUn.hh"
62 #include "sim/sim_object.hh"
63 
64 namespace gem5
65 {
66 
70 class TimingExprLet;
71 
74 {
75  public:
79 
86 
88  ThreadContext *thread_, TimingExprLet *let_);
89 };
90 
91 class TimingExpr : public SimObject
92 {
93  public:
94  TimingExpr(const TimingExprParams &params) :
96  { }
97 
98  virtual uint64_t eval(TimingExprEvalContext &context) = 0;
99 };
100 
102 {
103  public:
104  uint64_t value;
105 
106  TimingExprLiteral(const TimingExprLiteralParams &params) :
109  { }
110 
111  uint64_t eval(TimingExprEvalContext &context) { return value; }
112 };
113 
115 {
116  public:
117  unsigned int index;
118 
119  TimingExprSrcReg(const TimingExprSrcRegParams &params) :
122  { }
123 
124  uint64_t eval(TimingExprEvalContext &context);
125 };
126 
128 {
129  public:
131 
132  TimingExprReadIntReg(const TimingExprReadIntRegParams &params) :
134  reg(params.reg)
135  { }
136 
137  uint64_t eval(TimingExprEvalContext &context);
138 };
139 
140 class TimingExprLet : public TimingExpr
141 {
142  public:
145 
146  TimingExprLet(const TimingExprLetParams &params) :
148  defns(params.defns),
149  expr(params.expr)
150  { }
151 
152  uint64_t eval(TimingExprEvalContext &context);
153 };
154 
155 class TimingExprRef : public TimingExpr
156 {
157  public:
158  unsigned int index;
159 
160  TimingExprRef(const TimingExprRefParams &params) :
163  { }
164 
165  uint64_t eval(TimingExprEvalContext &context);
166 };
167 
168 class TimingExprUn : public TimingExpr
169 {
170  public:
171  enums::TimingExprOp op;
173 
174  TimingExprUn(const TimingExprUnParams &params) :
176  op(params.op),
177  arg(params.arg)
178  { }
179 
180  uint64_t eval(TimingExprEvalContext &context);
181 };
182 
183 class TimingExprBin : public TimingExpr
184 {
185  public:
186  enums::TimingExprOp op;
189 
190  TimingExprBin(const TimingExprBinParams &params) :
192  op(params.op),
193  left(params.left),
195  { }
196 
197  uint64_t eval(TimingExprEvalContext &context);
198 };
199 
200 class TimingExprIf : public TimingExpr
201 {
202  public:
206 
207  TimingExprIf(const TimingExprIfParams &params) :
209  cond(params.cond),
212  { }
213 
214  uint64_t eval(TimingExprEvalContext &context);
215 };
216 
217 } // namespace gem5
218 
219 #endif
gem5::TimingExprLet
Definition: timing_expr.hh:140
gem5::TimingExprBin::left
TimingExpr * left
Definition: timing_expr.hh:187
gem5::TimingExprLiteral::value
uint64_t value
Definition: timing_expr.hh:104
gem5::TimingExprIf::TimingExprIf
TimingExprIf(const TimingExprIfParams &params)
Definition: timing_expr.hh:207
gem5::TimingExprBin::op
enums::TimingExprOp op
Definition: timing_expr.hh:186
gem5::TimingExprLet::defns
std::vector< TimingExpr * > defns
Definition: timing_expr.hh:143
gem5::TimingExprRef
Definition: timing_expr.hh:155
gem5::TimingExprBin::TimingExprBin
TimingExprBin(const TimingExprBinParams &params)
Definition: timing_expr.hh:190
gem5::TimingExprReadIntReg
Definition: timing_expr.hh:127
gem5::TimingExprUn::op
enums::TimingExprOp op
Definition: timing_expr.hh:171
gem5::TimingExprBin::right
TimingExpr * right
Definition: timing_expr.hh:188
gem5::TimingExprBin
Definition: timing_expr.hh:183
gem5::TimingExprEvalContext::let
TimingExprLet * let
Context visible as sub expressions.
Definition: timing_expr.hh:83
std::vector< uint64_t >
gem5::TimingExprUn::TimingExprUn
TimingExprUn(const TimingExprUnParams &params)
Definition: timing_expr.hh:174
gem5::TimingExprLiteral::TimingExprLiteral
TimingExprLiteral(const TimingExprLiteralParams &params)
Definition: timing_expr.hh:106
gem5::TimingExprEvalContext::inst
const StaticInstPtr & inst
Special visible context.
Definition: timing_expr.hh:77
gem5::TimingExprLet::expr
TimingExpr * expr
Definition: timing_expr.hh:144
gem5::RefCountingPtr< StaticInst >
gem5::TimingExprIf::trueExpr
TimingExpr * trueExpr
Definition: timing_expr.hh:204
gem5::TimingExpr::eval
virtual uint64_t eval(TimingExprEvalContext &context)=0
gem5::TimingExprLet::TimingExprLet
TimingExprLet(const TimingExprLetParams &params)
Definition: timing_expr.hh:146
gem5::TimingExprUn::arg
TimingExpr * arg
Definition: timing_expr.hh:172
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
gem5::TimingExprSrcReg::TimingExprSrcReg
TimingExprSrcReg(const TimingExprSrcRegParams &params)
Definition: timing_expr.hh:119
gem5::TimingExprLet::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:70
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::TimingExprRef::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:78
sim_object.hh
gem5::TimingExpr
Definition: timing_expr.hh:91
gem5::TimingExprEvalContext::results
std::vector< uint64_t > results
Definition: timing_expr.hh:84
gem5::TimingExprEvalContext::TimingExprEvalContext
TimingExprEvalContext(const StaticInstPtr &inst_, ThreadContext *thread_, TimingExprLet *let_)
Definition: timing_expr.cc:45
gem5::TimingExprEvalContext
Object to gather the visible context for evaluation.
Definition: timing_expr.hh:73
gem5::TimingExprEvalContext::resultAvailable
std::vector< bool > resultAvailable
Definition: timing_expr.hh:85
static_inst.hh
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::TimingExprLiteral::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.hh:111
gem5::TimingExprIf
Definition: timing_expr.hh:200
gem5::TimingExprUn
Definition: timing_expr.hh:168
gem5::TimingExprLiteral
Definition: timing_expr.hh:101
gem5::TimingExprSrcReg::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:60
gem5::TimingExprEvalContext::thread
ThreadContext * thread
Definition: timing_expr.hh:78
gem5::TimingExprRef::TimingExprRef
TimingExprRef(const TimingExprRefParams &params)
Definition: timing_expr.hh:160
gem5::TimingExprReadIntReg::reg
TimingExpr * reg
Definition: timing_expr.hh:130
gem5::TimingExprRef::index
unsigned int index
Definition: timing_expr.hh:158
gem5::TimingExprBin::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:125
gem5::TimingExprSrcReg::index
unsigned int index
Definition: timing_expr.hh:117
gem5::TimingExprIf::cond
TimingExpr * cond
Definition: timing_expr.hh:203
gem5::TimingExprReadIntReg::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:65
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::TimingExprIf::falseExpr
TimingExpr * falseExpr
Definition: timing_expr.hh:205
gem5::TimingExprSrcReg
Definition: timing_expr.hh:114
thread_context.hh
gem5::TimingExprUn::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:90
gem5::TimingExpr::TimingExpr
TimingExpr(const TimingExprParams &params)
Definition: timing_expr.hh:94
gem5::TimingExprIf::eval
uint64_t eval(TimingExprEvalContext &context)
Definition: timing_expr.cc:194
gem5::TimingExprReadIntReg::TimingExprReadIntReg
TimingExprReadIntReg(const TimingExprReadIntRegParams &params)
Definition: timing_expr.hh:132

Generated on Tue Sep 21 2021 12:25:09 for gem5 by doxygen 1.8.17