Class PtidesPreemptiveEDFDirector

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class PtidesPreemptiveEDFDirector
    extends PtidesPreemptiveEDFDirector
    Code generator adapter associated with the PtidesPreemptiveEDFDirector class. This adapter generates Luminary specific code. This director starts a task for each actor. Each task has a specified name, stack size, priority and function code to execute. User can introduce annotations in an actor to specify these values. In particular, this adapter class looks for the "_stackSize" and "_priority" parameters and use their values to create the tasks. If these parameters are not specified, the code generator uses the default value 80 for stack size, and 0 for priority. Each task executes a given function which consists of the actor initialization, fire and wrapup code.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Jia Zou, Isaac Liu, Jeff C. Jensen
    Pt.AcceptedRating:
    red (jiazou)
    Pt.ProposedRating:
    red (jiazou)
    • Constructor Detail

      • PtidesPreemptiveEDFDirector

        public PtidesPreemptiveEDFDirector​(PtidesDirector ptidesPreemptiveEDFDirector)
        Construct the code generator adapter associated with the given PtidesBasicDirector.
        Parameters:
        ptidesPreemptiveEDFDirector - The associated director ptolemy.domains.ptides.kernel.PtidesBasicDirector
    • Method Detail

      • generateAdditionalCodeFiles

        public java.util.Map<java.lang.String,​java.lang.String> generateAdditionalCodeFiles()
                                                                                           throws IllegalActionException
        Generate the assembly file associated for this PtidyOS program. Here we return an empty string, but the target specific adapter should overwrite it.
        Overrides:
        generateAdditionalCodeFiles in class PtidesPreemptiveEDFDirector
        Returns:
        The generated assembly file code.
        Throws:
        IllegalActionException - If thrown while getting the configuration or if the configuration cannot be found or if thrown while the getting the codeBlock.
      • generateFireCode

        public java.lang.String generateFireCode()
                                          throws IllegalActionException
        Generate the director fire code. The code creates a new task for each actor according to their specified parameters (e.g. stack depth, priority, and etc.). The code also initiates the task scheduler.
        Overrides:
        generateFireCode in class Director
        Returns:
        The generated fire code.
        Throws:
        IllegalActionException - Not thrown in this class.
      • generateFireFunctionCode

        public java.lang.String generateFireFunctionCode()
                                                  throws IllegalActionException
        Generate the fire function code. The code contains the function code for each actor. It is a collection of global functions, one for each actor that is visible to this director adapter. Creating each new task requires one of these function as parameter. It is the code that the task executes. When the inline parameter is checked, the task function code is generated in generatePreinitializeCode() which is outside the main function.
        Overrides:
        generateFireFunctionCode in class Director
        Returns:
        The fire function code.
        Throws:
        IllegalActionException - If there is an exception in generating the task function code.
      • generateInitializeCode

        public java.lang.String generateInitializeCode()
                                                throws IllegalActionException
        Generate the initialize code. This generates the hardware initialization code and creates the queues for all referrable port channels.
        Overrides:
        generateInitializeCode in class PtidesPreemptiveEDFDirector
        Returns:
        The generated initialize code.
        Throws:
        IllegalActionException - If the adapter associated with an actor throws it while generating initialize code for the actor.
      • generateVariableInitialization

        public java.lang.String generateVariableInitialization()
                                                        throws IllegalActionException
        Generate variable initialization for the referenced parameters. This overrides the super class method and returns an empty string. It avoids generating any offset variables.
        Overrides:
        generateVariableInitialization in class Director
        Returns:
        code The empty string.
        Throws:
        IllegalActionException - Not thrown in this class.
      • getSharedCode

        public java.util.Set getSharedCode()
                                    throws IllegalActionException
        Generate the shared code. This is the first generate method invoked out of all, so any initialization of variables of this adapter should be done in this method. In this base class, return an empty set. Subclasses may generate code for variable declaration, defining constants, etc.
        Overrides:
        getSharedCode in class PtidesPreemptiveEDFDirector
        Returns:
        An empty set in this base class.
        Throws:
        IllegalActionException - Not thrown in this base class.
      • _generateInitializeHardwareCode

        protected java.lang.String _generateInitializeHardwareCode()
                                                            throws IllegalActionException
        Generate the initialization code for any hardware component that is used.
        Returns:
        code initialization code for hardware peripherals
        Throws:
        IllegalActionException - If thrown while getting the adapter or generating hardware initialization code.