OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Watch Class Reference

#include <Watch.hh>

Inheritance diagram for Watch:
Inheritance graph
Collaboration diagram for Watch:
Collaboration graph

Public Member Functions

 Watch (const SimulatorFrontend &frontend, const ExpressionScript &expression)
 
virtual ~Watch ()
 
virtual bool isTriggered () const
 
virtual std::string description () const
 
virtual StopPointcopy () const
 
virtual const ExpressionScriptexpression () const
 
virtual void setExpression (const ExpressionScript &expression)
 
- Public Member Functions inherited from StopPoint
 StopPoint ()
 
virtual ~StopPoint ()
 
virtual void setEnabled (bool flag)
 
virtual bool isEnabled () const
 
virtual void setDisabledAfterTriggered (bool flag)
 
virtual bool isDisabledAfterTriggered () const
 
virtual void setDeletedAfterTriggered (bool flag)
 
virtual bool isDeletedAfterTriggered () const
 
virtual void setCondition (const ConditionScript &condition)
 
virtual void removeCondition ()
 
virtual const ConditionScriptcondition () const
 
virtual bool isConditional () const
 
virtual void setIgnoreCount (unsigned int count)
 
virtual unsigned int ignoreCount () const
 
virtual bool isConditionOK ()
 
virtual void decreaseIgnoreCount ()
 

Private Member Functions

 Watch (const Watch &source)
 Static copying not allowed (should use copy()).
 

Private Attributes

ExpressionScript expression_
 The expression that is watched.
 
const SimulatorFrontendfrontend_
 The simulator frontend which is used to fetch the current PC.
 
bool isTriggered_
 Flag which tells whether the watch was triggered in current simulation cycle.
 
ClockCycleCount lastCheckedCycle_
 The simulation clock cycle in which the expression was checked the last time.
 

Additional Inherited Members

- Protected Attributes inherited from StopPoint
bool enabled_
 Tells whether the breakpoint is enabled or disabled.
 
bool disabledAfterTriggered_
 Tells if the breakpoint is disabled after it is triggered the next time.
 
bool deletedAfterTriggered_
 Tells if the breakpoint is deleted after it is triggered the next time.
 
bool conditional_
 Tells whether the breakpoint is conditional or not.
 
ConditionScriptcondition_
 The condition which is used to determine whether the breakpoint should be fired or not.
 
unsigned int ignoreCount_
 The number of times the condition is to be ignored before enabling the breakpoint.
 

Detailed Description

Represents a simulation watch point.

Watch stops simulation when user-given expression changes its value.

Definition at line 48 of file Watch.hh.

Constructor & Destructor Documentation

◆ Watch() [1/2]

Watch::Watch ( const SimulatorFrontend frontend,
const ExpressionScript expression 
)

Constructor.

Parameters
frontendUsed to fetch the simulation clock.
expressionThe expression watched.

Definition at line 48 of file Watch.cc.

50 :
53}
bool isTriggered_
Flag which tells whether the watch was triggered in current simulation cycle.
Definition Watch.hh:71
ClockCycleCount lastCheckedCycle_
The simulation clock cycle in which the expression was checked the last time.
Definition Watch.hh:74
const SimulatorFrontend & frontend_
The simulator frontend which is used to fetch the current PC.
Definition Watch.hh:68
virtual const ExpressionScript & expression() const
Definition Watch.cc:88
ExpressionScript expression_
The expression that is watched.
Definition Watch.hh:66

◆ ~Watch()

Watch::~Watch ( )
virtual

Destructor.

Definition at line 58 of file Watch.cc.

58 {
59}

◆ Watch() [2/2]

Watch::Watch ( const Watch source)
private

Static copying not allowed (should use copy()).

Member Function Documentation

◆ copy()

StopPoint * Watch::copy ( ) const
virtual

Copy method for dynamically bound copies.

Implements StopPoint.

Definition at line 65 of file Watch.cc.

65 {
66 StopPoint* aCopy = new Watch(frontend_, expression_);
67 if (conditional_) {
68 assert(condition_ != NULL);
69 ConditionScript* conditionCopy = condition_->copy();
70 assert(conditionCopy != NULL);
71 aCopy->setCondition(*conditionCopy);
72 } else {
73 aCopy->removeCondition();
74 }
75 aCopy->setEnabled(enabled_);
79 return aCopy;
80}
#define assert(condition)
virtual ConditionScript * copy() const
bool enabled_
Tells whether the breakpoint is enabled or disabled.
Definition StopPoint.hh:84
virtual void removeCondition()
Definition StopPoint.cc:142
bool conditional_
Tells whether the breakpoint is conditional or not.
Definition StopPoint.hh:91
virtual void setDeletedAfterTriggered(bool flag)
Definition StopPoint.cc:107
virtual void setEnabled(bool flag)
Definition StopPoint.cc:63
bool disabledAfterTriggered_
Tells if the breakpoint is disabled after it is triggered the next time.
Definition StopPoint.hh:87
bool deletedAfterTriggered_
Tells if the breakpoint is deleted after it is triggered the next time.
Definition StopPoint.hh:89
virtual void setCondition(const ConditionScript &condition)
Definition StopPoint.cc:131
ConditionScript * condition_
The condition which is used to determine whether the breakpoint should be fired or not.
Definition StopPoint.hh:94
unsigned int ignoreCount_
The number of times the condition is to be ignored before enabling the breakpoint.
Definition StopPoint.hh:97
virtual void setDisabledAfterTriggered(bool flag)
Definition StopPoint.cc:85
virtual void setIgnoreCount(unsigned int count)
Definition StopPoint.cc:182
Definition Watch.hh:48

References assert, StopPoint::condition_, StopPoint::conditional_, ConditionScript::copy(), StopPoint::deletedAfterTriggered_, StopPoint::disabledAfterTriggered_, StopPoint::enabled_, expression_, frontend_, StopPoint::ignoreCount_, StopPoint::removeCondition(), StopPoint::setCondition(), StopPoint::setDeletedAfterTriggered(), StopPoint::setDisabledAfterTriggered(), StopPoint::setEnabled(), and StopPoint::setIgnoreCount().

Here is the call graph for this function:

◆ description()

std::string Watch::description ( ) const
virtual

Prints the description string of the stop point.

Each subclass overrides this method to construct a descripting string of itself.

Implements StopPoint.

Definition at line 134 of file Watch.cc.

134 {
135 return std::string("watch for expression '") + expression_.script().at(0) +
136 "' " + StopPoint::description();
137}
virtual std::vector< std::string > script() const
Definition Script.cc:106
virtual std::string description() const =0
Definition StopPoint.cc:239

References StopPoint::description(), expression_, and Script::script().

Here is the call graph for this function:

◆ expression()

const ExpressionScript & Watch::expression ( ) const
virtual

Returns the expression.

Returns
The expression.

Definition at line 88 of file Watch.cc.

88 {
89 return expression_;
90}

References expression_.

Referenced by ProximBreakpointWindow::refreshStopPoints(), setExpression(), and WatchPropertiesDialog::TransferDataToWindow().

◆ isTriggered()

bool Watch::isTriggered ( ) const
virtual

Returns true in case this watch is triggered.

Returns true in case the expression has changed in current simulation cycle.

Returns
The status of the watch.

Implements StopPoint.

Definition at line 110 of file Watch.cc.

110 {
112 // simulation clock has changed since the last expression check,
113 // let's see if the watch expression value has changed
114 try {
116 } catch (const Exception&) {
117 // for example simulation might not be initialized in every
118 // check so the script throws, we'll assume that no triggering
119 // should happen at that case
120 isTriggered_ = false;
121 }
123 }
124 return isTriggered_;
125}
ClockCycleCount cycleCount() const

References SimulatorFrontend::cycleCount(), expression_, frontend_, isTriggered_, lastCheckedCycle_, and ExpressionScript::resultChanged().

Here is the call graph for this function:

◆ setExpression()

void Watch::setExpression ( const ExpressionScript expression)
virtual

Sets the expression the watch is watching.

Parameters
expressionThe new expression.

Definition at line 98 of file Watch.cc.

98 {
100}

References expression(), and expression_.

Here is the call graph for this function:

Member Data Documentation

◆ expression_

ExpressionScript Watch::expression_
mutableprivate

The expression that is watched.

Definition at line 66 of file Watch.hh.

Referenced by copy(), description(), expression(), isTriggered(), and setExpression().

◆ frontend_

const SimulatorFrontend& Watch::frontend_
private

The simulator frontend which is used to fetch the current PC.

Definition at line 68 of file Watch.hh.

Referenced by copy(), and isTriggered().

◆ isTriggered_

bool Watch::isTriggered_
mutableprivate

Flag which tells whether the watch was triggered in current simulation cycle.

Definition at line 71 of file Watch.hh.

Referenced by isTriggered().

◆ lastCheckedCycle_

ClockCycleCount Watch::lastCheckedCycle_
mutableprivate

The simulation clock cycle in which the expression was checked the last time.

Definition at line 74 of file Watch.hh.

Referenced by isTriggered().


The documentation for this class was generated from the following files: