The Sparta Modeling Framework
|
Operation Node (e.g. +,-,*,/) More...
#include <ExpressionNodeTypes.hpp>
Public Member Functions | |
Operation () | |
Default constructor with null operations and no type. | |
Operation (const Operation &rhp) | |
Copy constructor. Deep copies the operands of the operation. | |
Operation (operation_t type, ExpressionNode *op1, ExpressionNode *op2=nullptr, ExpressionNode *op3=nullptr) | |
Contruct with operation type and operands. | |
virtual Operation * | clone_ () const override |
Deep copy of the content of this item. | |
void | addOperand (ExpressionNode *op) |
Manually add an operand. | |
virtual double | evaluate_ () const override |
Compute value of this item in simulation. | |
virtual bool | supportsCompression () const override |
virtual void | start () override |
virtual void | end () override |
virtual void | dump (std::ostream &o, bool show_range=true, bool resolve_subexprs=true) const override |
Dump the content of this expression item. | |
virtual void | getClocks (std::vector< const Clock * > &clocks) const override |
Populates a vector with the clocks found in this subexpression node. | |
Public Member Functions inherited from sparta::statistics::expression::ExpressionNode | |
ExpressionNode (const ExpressionNode &)=delete | |
No copy-constructable. | |
ExpressionNode * | clone () const |
uint32_t | getStats (std::vector< const StatisticInstance * > &results) const |
Gets the statistics present in this expression. | |
double | evaluate () |
Compute value of this item in simulation. Must be implemented by subclass. | |
Public Attributes | |
operation_t | type_ |
Type of operation to perform. | |
std::vector< std::unique_ptr< ExpressionNode > > | operands_ |
All operands (subexpressions) in this node. | |
Operation Node (e.g. +,-,*,/)
Definition at line 20 of file ExpressionNodeTypes.hpp.
|
inline |
Default constructor with null operations and no type.
Definition at line 35 of file ExpressionNodeTypes.hpp.
|
inline |
Copy constructor. Deep copies the operands of the operation.
Definition at line 42 of file ExpressionNodeTypes.hpp.
|
inline |
Contruct with operation type and operands.
type | Type of operation |
op1 | Operand 1 (required). Must not be nullptr |
op2 | Optional operand 2 |
op3 | Optional operand 3 |
Definition at line 59 of file ExpressionNodeTypes.hpp.
|
inlinevirtual |
Definition at line 76 of file ExpressionNodeTypes.hpp.
|
inline |
Manually add an operand.
Definition at line 86 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Deep copy of the content of this item.
To be overridden by subclasses
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 79 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Dump the content of this expression item.
o | Ostream to write to |
show_range | Should the range be shown in any subexpression nodes. |
resolve_subexprs | Should any referenced statistic defs be expanded to their full expressions so that this becomes an expression containing only counters. |
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 180 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 174 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Compute value of this item in simulation.
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 90 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Populates a vector with the clocks found in this subexpression node.
clocks | Vector of clocks to which any found clocks will be appended. This vector is not cleared. |
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 209 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 169 of file ExpressionNodeTypes.hpp.
|
inlineoverridevirtual |
Every SI needs to make an estimation (ahead of simulation) whether it's a good candidate for compression or not. There are some obvious good choices such as integral counters and constants. As for generic StatisticDef expressions, we make an estimation that we are a good candidate for compression if all of our operands say that they support compression, and this SI expression does NOT have a divide anywhere in it.
Compress it?
"counterA + counterB" yes
"counterA * counterB" yes
"statdefA - statdefB" depends on what those statdef's are going to do
"counterA / counterB" NO
The rational for not trying to compress an SI with a divide in its expression is that double-precision values tend to compress less than integral values do. The zlib compression library supports a small variety of compression algorithms however, and we should try them all. If RLE is used, doubles may not be worth the performance hit. But this is under design / up in the air at the moment, and is implementation detail to the outside world either way.
Implements sparta::statistics::expression::ExpressionNode.
Definition at line 142 of file ExpressionNodeTypes.hpp.
std::vector<std::unique_ptr<ExpressionNode> > sparta::statistics::expression::Operation::operands_ |
All operands (subexpressions) in this node.
Definition at line 30 of file ExpressionNodeTypes.hpp.
operation_t sparta::statistics::expression::Operation::type_ |
Type of operation to perform.
Definition at line 25 of file ExpressionNodeTypes.hpp.