ptolemy.codegen.vhdl.actor.lib.vhdl
Class AddSubtract

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.codegen.kernel.CodeGeneratorHelper
          extended by ptolemy.codegen.vhdl.kernel.VHDLCodeGeneratorHelper
              extended by ptolemy.codegen.vhdl.actor.lib.vhdl.AddSubtract
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ActorCodeGenerator, ComponentCodeGenerator, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class AddSubtract
extends VHDLCodeGeneratorHelper

A helper class for ptolemy.actor.lib.Uniform.

Since:
Ptolemy II 7.1
Version:
$Id: AddSubtract.java 53046 2009-04-10 23:04:25Z cxh $
Author:
Man-Kit Leung
See Also:
Serialized Form
Accepted Rating:
Green (cxh)
Proposed Rating:
Green (mankit)

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
 
Fields inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
_codeGenerator, _codeStream, _eol, _INDENT1, _INDENT2, _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
AddSubtract(AddSubtract actor)
          Construct a FixConst helper.
 
Method Summary
protected  java.lang.String _generateFireCode()
          Generate fire code.
 java.util.Set getHeaderFiles()
          Get the files needed by the code generated for the FixConst actor.
 java.util.Set getSharedCode()
          Generate the shared code.
 
Methods inherited from class ptolemy.codegen.vhdl.kernel.VHDLCodeGeneratorHelper
_generateVHDLType, _getHelper, _getPortPrecision, _getSourcePortActor, _getSourcePortPrecision, doGenerate, getCodeGenerator, getReference, isSynthesizable
 
Methods inherited from class ptolemy.codegen.kernel.CodeGeneratorHelper
_createBufferSizeAndOffsetMap, _createInputBufferSizeAndOffsetMap, _findClosedParen, _generateBlockCode, _generateBlockCode, _generateTypeConvertMethod, _generateTypeConvertStatement, _generateTypeConvertStatements, _getCastType, _getChannelAndOffset, _getFireFunctionArguments, _getHelper, _getIndentPrefix, _getReference, _getReferenceChannels, _getTypeConvertChannels, _getTypeConvertReference, _getWCET, _indexOf, _parseList, _putGlobalCode, _replaceMacro, addFunctionUsed, addNewTypeUsed, analyzeTypeConvert, checkLocal, checkRemote, codeGenType, copyFilesToCodeDirectory, createOffsetVariablesIfNeeded, generateChannelOffset, generateFireCode, generateFireFunctionCode, generateFireFunctionCode2, generateInitializeCode, generateIterationCode, generateModeTransitionCode, generateName, generateOffset, generatePortReference, generatePostfireCode, generatePrefireCode, generatePreinitializeCode, generateSimpleName, generateTypeConvertFireCode, generateTypeConvertFireCode, generateVariableDeclaration, generateVariableInitialization, generateVariableName, generateWrapupCode, getBufferSize, getBufferSize, getComponent, getDefaultBlocks, getDirector, getDirectorHelper, getFunctionInvocation, getIncludeDirectories, getLibraries, getLibraryDirectories, getModifiedVariables, getNewInvocation, getObject, getParameterValue, getParseTreeCodeGenerator, getPort, getRates, getReadOffset, getReference, getReference, getReference, getSinkChannels, getSize, getSourceChannel, getWriteOffset, isPrimitive, isPrimitive, main, processCode, resetInputPortsOffset, selfTest, setBufferSize, setCodeGenerator, setReadOffset, setWriteOffset, targetType, toString
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getContainedObject, _isMoMLSuppressed, _markContentsDerived, _propagateExistence, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AddSubtract

public AddSubtract(AddSubtract actor)
Construct a FixConst helper.

Parameters:
actor - the associated actor
Method Detail

getSharedCode

public java.util.Set getSharedCode()
                            throws IllegalActionException
Description copied from class: CodeGeneratorHelper
Generate the shared code. This is the first generate method invoked out of all, so any initialization of variables of this helper should be done in this method. In this base class, return an empty set. Subclasses may generate code for variable declaration, defining constants, etc.

Specified by:
getSharedCode in interface ActorCodeGenerator
Overrides:
getSharedCode in class CodeGeneratorHelper
Returns:
An empty set in this base class.
Throws:
IllegalActionException - Not thrown in this base class.

_generateFireCode

protected java.lang.String _generateFireCode()
                                      throws IllegalActionException
Generate fire code. The method reads in the fireBlock from FixConst.c, replaces macros with their values and returns the processed code block.

Overrides:
_generateFireCode in class CodeGeneratorHelper
Returns:
The generated code.
Throws:
IllegalActionException - If the code stream encounters an error in processing the specified code block(s).

getHeaderFiles

public java.util.Set getHeaderFiles()
                             throws IllegalActionException
Get the files needed by the code generated for the FixConst actor.

Specified by:
getHeaderFiles in interface ActorCodeGenerator
Overrides:
getHeaderFiles in class CodeGeneratorHelper
Returns:
A set of strings that are names of the library and package.
Throws:
IllegalActionException - Not Thrown in this subclass.