|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.kernel.util.NamedObj ptolemy.codegen.kernel.CodeGeneratorHelper ptolemy.codegen.actor.Director ptolemy.codegen.c.actor.sched.StaticSchedulingDirector ptolemy.codegen.c.domains.giotto.kernel.GiottoDirector ptolemy.codegen.c.targets.openRTOS.domains.giotto.kernel.GiottoDirector
public class GiottoDirector
Code generator helper associated with the GiottoDirector class. This class is also associated with a code generator.
Red (sssf) |
Red (sssf) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
---|
CodeGeneratorHelper.Channel, CodeGeneratorHelper.VariableScope |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private static int |
_MAX_PRIORITY_LEVEL
|
Fields inherited from class ptolemy.codegen.actor.Director |
---|
_director, _eol, _INDENT1, _INDENT2, _INDENT3, _INDENT4 |
Fields inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper |
---|
_codeGenerator, _codeStream, _parseTreeCodeGenerator, _portConversions, _referencedParameters |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary | |
---|---|
GiottoDirector(GiottoDirector giottoDirector)
Construct the code generator helper associated with the given GiottoDirector. |
Method Summary | |
---|---|
private int |
_depthInGiottoHierarchy()
Return how may Giotto directors are above this director. |
private java.lang.String |
_generateActorsCode()
Generates methods for all the actors seen by this director * @exception IllegalActionException |
protected java.lang.String |
_generateBlockCode(java.lang.String blockName,
java.util.List args)
Given a block name, generate code for that block. |
(package private) java.lang.String |
_generateDriverCode()
Generate the content of driver methods. |
private static java.lang.String |
_generateDriverName(NamedObj namedObj)
Generate sanitized name for the given named object. |
protected java.lang.String |
_generateFireCode()
Generate the fire code for the director. |
protected java.lang.String |
_generateInputVariableDeclaration()
Generate input variable declarations. |
(package private) java.lang.String |
_generateOutputDriverCode()
Generate the content of output driver methods. |
protected java.lang.String |
_generateOutputVariableDeclaration()
Generate output variable declarations. |
private java.lang.String |
_generatePortVariableDeclarations(Actor actor)
Generate PORT variables. |
java.lang.String |
_generateTypeConvertFireCode(IOPort source,
IOPort sink)
Generate the type conversion fire code. |
private java.util.ArrayList<java.lang.String>[] |
_getActorFrequencyTable()
Generates a two dimensional array of actors at each frequency |
private java.lang.String |
_getActorName(Actor actor)
Generates a string of the actor's name |
private java.util.List<Actor> |
_getActors(int frequencyValue)
|
private java.util.HashSet<java.lang.Integer> |
_getAllFrequencies()
Generates a set of the different frequencies seen by this Giotto Director |
private int |
_getFrequency(Actor actor)
Determines the frequeny of the actor passed in as a parameter |
private double |
_getPeriod()
Determines the period of this Giotto Director. |
private java.lang.String |
_getPortName(IOPort port)
Generates a string representation of the port's name |
private int |
_getPriority(Actor actor)
Determines the true frequency of the actor , which can be used as it's priority I.E. |
private int |
_getStackSize(java.util.List<Actor> actors)
Determines the stack size necessary for the actors passed in |
private java.lang.String |
_getThreadName(int frequencyValue)
Generates the name of a thread for a specified frequency value. |
private boolean |
_isTopDirectorFSM()
Determines if this director is inside an FSM director |
private boolean |
_isTopGiottoDirector()
Determines if this Giotto director is the top most Giotto Director |
private int |
_lcm(int[] array)
This method was copied from the GiottoScheduler method. |
private java.lang.String |
_targetType(Type ptType)
Determines the target type of Type. |
private java.lang.String |
_typeConversion(TypedIOPort source,
TypedIOPort sink)
Determines which type conversion is necessary when going from the source to the sink port |
java.lang.String |
generateFireCode()
Generate the fire code for the director. |
java.lang.String |
generateFireFunctionCode()
Generate The fire function code. |
java.lang.String |
generateInitializeCode()
Generate the initialize code. |
java.lang.String |
generateMainLoop()
Generate C code for the content of the main loop. |
void |
generateModeTransitionCode(java.lang.StringBuffer code)
Generate the mode transition code. |
java.lang.String |
generateMyThreads()
Generate code to create the threads. |
java.lang.String |
generatePostFireCode()
Generate the postfire code. |
java.lang.String |
generatePreinitializeCode()
Generate the preinitialize code. |
java.lang.String |
generateSchedulerThread(java.lang.String period)
Generate code for the scheduler thread. |
void |
generateTransferInputsCode(IOPort inputPort,
java.lang.StringBuffer code)
Generate code for transferring enough tokens to complete an internal iteration. |
void |
generateTransferOutputsCode(IOPort outputPort,
java.lang.StringBuffer code)
Generate code for transferring enough tokens to fulfill the output production rate. |
java.lang.String |
generateVariableDeclaration()
Generate a variable declaration for the period parameter, if there is one. |
java.lang.String |
getDriverReference(TypedIOPort port,
java.lang.String[] channelAndOffset,
boolean forComposite,
boolean isWrite,
CodeGeneratorHelper helper)
Return a reference to the driver. |
java.util.Set |
getHeaderFiles()
Get the files needed by the code generated from this helper class. |
java.lang.String |
getReference(TypedIOPort port,
java.lang.String[] channelAndOffset,
boolean forComposite,
boolean isWrite,
CodeGeneratorHelper helper)
Return an unique label for the given port channel referenced by the given helper. |
double |
getWCET()
Return the worst case execution time (WCET) seen by this director. |
Methods inherited from class ptolemy.codegen.c.domains.giotto.kernel.GiottoDirector |
---|
_createDynamicOffsetVariables, _createOffsetVariablesIfNeeded, _createOffsetVariablesIfNeeded, _updatePortBufferSize, createOffsetVariablesIfNeeded, getBufferSize |
Methods inherited from class ptolemy.codegen.actor.Director |
---|
_ceilToPowerOfTwo, _getIndentPrefix, _updateConnectedPortsOffset, _updatePortOffset, generateCodeForGet, generateCodeForSend, generateOffset, generatePostfireCode, generateVariableInitialization, generateWrapupCode, getComponent, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getReference, getReferenceChannels |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static int _MAX_PRIORITY_LEVEL
Constructor Detail |
---|
public GiottoDirector(GiottoDirector giottoDirector)
giottoDirector
- The associated
ptolemy.domains.giotto.kernel.GiottoDirectorMethod Detail |
---|
public java.lang.String generateFireCode() throws IllegalActionException
generateFireCode
in interface ActorCodeGenerator
generateFireCode
in class StaticSchedulingDirector
IllegalActionException
- If thrown by the superclass or thrown
while generating code for the director.public java.lang.String generateFireFunctionCode() throws IllegalActionException
generateFireFunctionCode
in interface ActorCodeGenerator
generateFireFunctionCode
in class Director
IllegalActionException
- If thrown while generating fire code.public java.util.Set getHeaderFiles() throws IllegalActionException
getHeaderFiles
in interface ActorCodeGenerator
getHeaderFiles
in class Director
IllegalActionException
- Not Thrown in this base class.public java.lang.String generateInitializeCode() throws IllegalActionException
generateInitializeCode
in interface ComponentCodeGenerator
generateInitializeCode
in class GiottoDirector
IllegalActionException
- If thrown while appending to the the
block or processing the macros.public java.lang.String generateMainLoop() throws IllegalActionException
generateMainLoop
in class StaticSchedulingDirector
IllegalActionException
- If thrown while traversing the model.public void generateModeTransitionCode(java.lang.StringBuffer code) throws IllegalActionException
generateModeTransitionCode
in interface ActorCodeGenerator
generateModeTransitionCode
in class Director
code
- The string buffer that the generated code is appended to.
IllegalActionException
- Not thrown in this base class.public java.lang.String generateMyThreads() throws IllegalActionException
IllegalActionException
- If thrown while accessing the model.public java.lang.String generatePostFireCode() throws IllegalActionException
IllegalActionException
- If thrown while appending to the the
block or processing the macros.public java.lang.String generatePreinitializeCode() throws IllegalActionException
generatePreinitializeCode
in interface ActorCodeGenerator
generatePreinitializeCode
in class GiottoDirector
IllegalActionException
- Not thrown in this base class.public java.lang.String getReference(TypedIOPort port, java.lang.String[] channelAndOffset, boolean forComposite, boolean isWrite, CodeGeneratorHelper helper) throws IllegalActionException
getReference
in class Director
port
- The given port.channelAndOffset
- The given channel and offset.forComposite
- Whether the given helper is associated with
a CompositeActorisWrite
- The type of the reference. True if this is
a write reference; otherwise, this is a read reference.helper
- The specified helper.
IllegalActionException
- If the helper throws it while
generating the label.public java.lang.String getDriverReference(TypedIOPort port, java.lang.String[] channelAndOffset, boolean forComposite, boolean isWrite, CodeGeneratorHelper helper) throws IllegalActionException
port
- The port whose information is desired.channelAndOffset
- The given channel and offset.forComposite
- Whether the given helper is associated with
a CompositeActorisWrite
- The type of the reference. True if this is
a write reference; otherwise, this is a read reference.helper
- The specified helper.
IllegalActionException
- If the helper throws it while
generating the label.public java.lang.String generateSchedulerThread(java.lang.String period) throws IllegalActionException
period
- The period of the Giotto director.
IllegalActionException
- If thrown while accessing
the model.public void generateTransferInputsCode(IOPort inputPort, java.lang.StringBuffer code) throws IllegalActionException
generateTransferInputsCode
in class GiottoDirector
inputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.
IllegalActionException
- If thrown while transferring tokens.public void generateTransferOutputsCode(IOPort outputPort, java.lang.StringBuffer code) throws IllegalActionException
generateTransferOutputsCode
in class GiottoDirector
outputPort
- The port to transfer tokens.code
- The string buffer that the generated code is appended to.
IllegalActionException
- If thrown while transferring tokens.public java.lang.String generateVariableDeclaration() throws IllegalActionException
generateVariableDeclaration
in interface ActorCodeGenerator
generateVariableDeclaration
in class StaticSchedulingDirector
IllegalActionException
- If the helper class for the model
director cannot be found.protected java.lang.String _generateBlockCode(java.lang.String blockName, java.util.List args) throws IllegalActionException
_generateBlockCode
in class CodeGeneratorHelper
blockName
- The name of the block.args
- A list of arguments to be passed to the code block.
IllegalActionException
- If illegal macro names are found, or if
there is a problem parsing the code block from the helper .c file.protected java.lang.String _generateFireCode() throws IllegalActionException
_generateFireCode
in class CodeGeneratorHelper
IllegalActionException
- If the thread code cannot be generated.protected java.lang.String _generateInputVariableDeclaration() throws IllegalActionException
IllegalActionException
- If thrown while
getting port information.protected java.lang.String _generateOutputVariableDeclaration() throws IllegalActionException
IllegalActionException
- If thrown while
getting port information.private int _depthInGiottoHierarchy()
private java.lang.String _generateActorsCode() throws IllegalActionException
IllegalActionException
private static java.lang.String _generateDriverName(NamedObj namedObj)
namedObj
- The named object for which the name is generated.
java.lang.String _generateDriverCode() throws IllegalActionException
IllegalActionException
java.lang.String _generateOutputDriverCode() throws IllegalActionException
IllegalActionException
public java.lang.String _generateTypeConvertFireCode(IOPort source, IOPort sink) throws IllegalActionException
source
- The source port, ignored by this method.sink
- The sink port, ignored by this method.
IllegalActionException
- Not thrown in this base class.public double getWCET() throws IllegalActionException
getWCET
in class Director
IllegalActionException
- If there is a problem determining
the WCET or a problem accessing the model.private java.lang.String _generatePortVariableDeclarations(Actor actor) throws IllegalActionException
IllegalActionException
private java.util.ArrayList<java.lang.String>[] _getActorFrequencyTable() throws IllegalActionException
IllegalActionException
private java.util.List<Actor> _getActors(int frequencyValue)
private java.lang.String _getActorName(Actor actor)
actor
- private java.util.HashSet<java.lang.Integer> _getAllFrequencies() throws IllegalActionException
IllegalActionException
private java.lang.String _getPortName(IOPort port)
port
- private int _getFrequency(Actor actor) throws IllegalActionException
actor
- * @exception IllegalActionException
IllegalActionException
private int _getPriority(Actor actor) throws IllegalActionException
actor
- * @exception IllegalActionException
IllegalActionException
private double _getPeriod() throws IllegalActionException
IllegalActionException
private int _getStackSize(java.util.List<Actor> actors)
actors
- private java.lang.String _getThreadName(int frequencyValue)
frequencyValue
-
private boolean _isTopGiottoDirector()
private boolean _isTopDirectorFSM()
private int _lcm(int[] array)
private java.lang.String _typeConversion(TypedIOPort source, TypedIOPort sink)
source
- - the source portsink
- - the sink port
private java.lang.String _targetType(Type ptType)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |