CompileDES  3.13
Executable-Code Generation from Synchronised libFAUDES Automata

Event attributes for the purpose of code generation. More...

#include <cgp_eventconfig.h>

Inheritance diagram for AttributeCodeGeneratorEvent:
Inheritance graph

Classes

struct  InputTrigger
 Typedef for an individual trigger condition. More...
 
struct  OutputAction
 Typedef for an individual output action. More...
 
struct  TimeConstraint
 Typedef for timer specification (internal events only) More...
 

Public Types

enum  EventType { ETInput , ETOutput , ETInternal }
 Event types.
 

Public Member Functions

 AttributeCodeGeneratorEvent (void)
 Default constructor (internal event)
 
 AttributeCodeGeneratorEvent (const AttributeCodeGeneratorEvent &rOtherAttr)
 Copy constructor.
 
virtual bool IsDefault (void) const
 Test for default value (never)
 
virtual void Clear (void)
 Clear to default.
 
bool Input (void) const
 
bool Output (void) const
 
bool Internal (void) const
 
bool Timer (void) const
 

Public Attributes

EventType mType
 
Int mPriority
 
std::vector< InputTriggermTriggers
 List of triggers (input events only)
 
std::vector< OutputActionmActions
 List of actions to perform (output events only)
 
TimeConstraint mTimeConstraint
 Timer definition (indicate timer event iff mInitialValue non-empty)
 

Protected Member Functions

virtual AttributeCodeGeneratorEventDoAssign (const AttributeCodeGeneratorEvent &rSrcAttr)
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 

Detailed Description

An event may be an input, output or internal event,

  • input events are generated by edges on variable values,
  • timer events are generated by the elapse of timers,
  • output events introduce edges on variables, and
  • internal events are for synchronisation only.

Thus, semantics are meant to match the simulator plug-in with a signal based device. However, the current implementation of the code generator does not support stochastic properties and the timer construct is only a subset of Alur's semantics of timed automata.

Note: in contrast to simfaudes, all priorities are non-negative from the range [0,10000]. CompileDES internally re-maps priorities to ensure that input-events and timer events are preferred over other events.

File i/o by example. Typically, each attribute resides within the definition of the respective event; see also CodeGenerator.

% Output-event configuration with one set-action and one clear-action
% Note: PC1 and PC2 is an abstract address to be interpreted in the context of the target platform
<Output>
<Priority val="20"/>
<Actions>
PC1 +Set+
PC2 +Clr+
</Actions>
</Output>
% Output-event configuration with one execute action
% Note: "beep(); is an abstract expression  to be interpreted in the context of the target platform
<Output>
<Priority val="21"/>
<Actions>
"beep();" +Execute+
</Actions>
</Output>
% Input-event configuration with two trigger conditions
% Note: PB4 and PB5 are again abstract addresses; the static-flag triggers the event on program
% start-up provided that the line-level PB4 evaluates high
<Input>
<Priority val="10"/>
<Triggers>
PB4 +PosEdge+ +Static+
PB5 +NegEdge+
</Triggers>
</Input>
</Event>
% Timer-event configuration configuration
% Note: the timer starts from the top value TIME#15s when the event alpha occurs and stops when beta
% occurs; when it reaches 0, the timer-event is triggered; the top value is interpreted in the
% context of the target platform
<Internal>
<Priority val="0"/>
<Timer val="TIME#15s">
<ResetEvents> alpha </ResetEvents>
<StartEvents> alpha </StartEvents>
<StopEvents> beta   </StopEvents>
</Internal>
% Plain event configuration
<Internal>
<Priority val="50"/>
</Internal>

Definition at line 112 of file cgp_eventconfig.h.


Class Documentation

◆ AttributeCodeGeneratorEvent::InputTrigger

struct AttributeCodeGeneratorEvent::InputTrigger

Definition at line 153 of file cgp_eventconfig.h.

Class Members
string mAddress Abstract address.
bool mPos Positive edge triggers event.
bool mNeg Negative edge triggers event.
bool mStatic Fake an initial edge on initialisation to sense static levels.
bool mExe Evaluate literal expression to trigger event.

◆ AttributeCodeGeneratorEvent::OutputAction

struct AttributeCodeGeneratorEvent::OutputAction

Definition at line 170 of file cgp_eventconfig.h.

Class Members
string mAddress Abstract address.
bool mSet Set bit.
bool mClr Clear bit.
bool mExe Literal expression i.e.

function call

◆ AttributeCodeGeneratorEvent::TimeConstraint

struct AttributeCodeGeneratorEvent::TimeConstraint

Definition at line 185 of file cgp_eventconfig.h.

Class Members
string mInitialValue Initial value (literal to allow for advanced units, empty string for "not a timer")
EventSet mStartEvents Events that start this timer.
EventSet mStopEvents Events that stop this timer.
EventSet mResetEvents Events that reset this timer.

Member Function Documentation

◆ Input()

bool AttributeCodeGeneratorEvent::Input ( void  ) const
inline

Query type

Definition at line 138 of file cgp_eventconfig.h.

◆ Output()

bool AttributeCodeGeneratorEvent::Output ( void  ) const
inline

Query type

Definition at line 141 of file cgp_eventconfig.h.

◆ Internal()

bool AttributeCodeGeneratorEvent::Internal ( void  ) const
inline

Query type

Definition at line 144 of file cgp_eventconfig.h.

◆ Timer()

bool AttributeCodeGeneratorEvent::Timer ( void  ) const
inline

Query type

Definition at line 147 of file cgp_eventconfig.h.

◆ DoAssign()

AttributeCodeGeneratorEvent & AttributeCodeGeneratorEvent::DoAssign ( const AttributeCodeGeneratorEvent rSrcAttr)
protectedvirtual

Copy method

Parameters
rSrcAttrSource to copy from
Returns
Ref to this attribute

Definition at line 44 of file cgp_eventconfig.cpp.

◆ DoRead()

void AttributeCodeGeneratorEvent::DoRead ( TokenReader &  rTr,
const std::string &  rLabel = "",
const Type *  pContext = 0 
)
protectedvirtual

Reads the attribute from TokenReader, see faudes::AttributeVoid for public wrappers.

If the current token indicates an event configuration, the method reads that section. Else it does nothing. Exceptions may only be thrown on invalid data within the section. The label argument is ignored, we use the hardcoded section "Input", "Output" and "Internal". The context argument is ignored.

Parameters
rTrTokenReader to read from
rLabelSection to read
pContextRead context to provide contextual information
Exceptions
Exception
  • IO error (id 1)

Definition at line 126 of file cgp_eventconfig.cpp.

◆ DoWrite()

void AttributeCodeGeneratorEvent::DoWrite ( TokenWriter &  rTw,
const std::string &  rLabel = "",
const Type *  pContext = 0 
) const
protectedvirtual

Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.

Writes the event configuration data. The label argument is ignored, we use the hardcoded sections "Input", "Output" and "Internal". The context argument is ignored.

Parameters
rTwTokenWriter to write to
rLabelSection to write
pContextRead context to provide contextual information
Exceptions
Exception
  • IO error (id 2)

Definition at line 55 of file cgp_eventconfig.cpp.

Member Data Documentation

◆ mType

EventType AttributeCodeGeneratorEvent::mType

Event type

Definition at line 135 of file cgp_eventconfig.h.

◆ mPriority

Int AttributeCodeGeneratorEvent::mPriority

Priority

Definition at line 150 of file cgp_eventconfig.h.


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