Event attributes for the purpose of code generation. More...
#include <cgp_eventconfig.h>
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< InputTrigger > | mTriggers |
List of triggers (input events only) | |
std::vector< OutputAction > | mActions |
List of actions to perform (output events only) | |
TimeConstraint | mTimeConstraint |
Timer definition (indicate timer event iff mInitialValue non-empty) | |
Protected Member Functions | |
virtual AttributeCodeGeneratorEvent & | DoAssign (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 |
An event may be an input, output or internal event,
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.
struct AttributeCodeGeneratorEvent::InputTrigger |
Definition at line 153 of file cgp_eventconfig.h.
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 |
struct AttributeCodeGeneratorEvent::TimeConstraint |
Definition at line 185 of file cgp_eventconfig.h.
|
inline |
Query type
Definition at line 138 of file cgp_eventconfig.h.
|
inline |
Query type
Definition at line 141 of file cgp_eventconfig.h.
|
inline |
Query type
Definition at line 144 of file cgp_eventconfig.h.
|
inline |
Query type
Definition at line 147 of file cgp_eventconfig.h.
|
protectedvirtual |
Copy method
rSrcAttr | Source to copy from |
Definition at line 44 of file cgp_eventconfig.cpp.
|
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.
rTr | TokenReader to read from |
rLabel | Section to read |
pContext | Read context to provide contextual information |
Exception |
|
Definition at line 126 of file cgp_eventconfig.cpp.
|
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.
rTw | TokenWriter to write to |
rLabel | Section to write |
pContext | Read context to provide contextual information |
Exception |
|
Definition at line 55 of file cgp_eventconfig.cpp.
EventType AttributeCodeGeneratorEvent::mType |
Event type
Definition at line 135 of file cgp_eventconfig.h.
Int AttributeCodeGeneratorEvent::mPriority |
Priority
Definition at line 150 of file cgp_eventconfig.h.