Package ptolemy.domains.de.lib.aspect
Class CrossbarSwitch
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.actor.lib.aspect.AtomicCommunicationAspect
-
- ptolemy.domains.de.lib.aspect.BasicSwitch
-
- ptolemy.domains.de.lib.aspect.CrossbarSwitch
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,CommunicationAspect
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Decorator
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class CrossbarSwitch extends BasicSwitch
This actor is anCommunicationAspect
that, when itsBasicSwitch.sendToken(Receiver, Receiver, Token)
method is called, delays the delivery of the specified token to the specified receiver according to a delays on input buffers, delays on output buffers and delays in the switch fabric of a crossbar switch. This actor is used the same way as theBasicSwitch
; just the switch fabric implemented here is different. I.e. this switch can potentially exhibit better throughput performance as some tokens can be processed in parallel by the switch fabric. For more information on how a crossbar switch works please refer to the http://en.wikipedia.org/wiki/Crossbar_switch General Properties.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Patricia Derler
- Pt.AcceptedRating:
- Red (derler)
- Pt.ProposedRating:
- Yellow (derler)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.domains.de.lib.aspect.BasicSwitch
BasicSwitch.BasicSwitchAttributes
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.Integer,java.util.TreeSet<TimedEvent>>
_switchFabricQueue
Switch fabric queues for every output port.protected java.util.HashMap<java.lang.Integer,FIFOQueue>
_waitingOnSwitchFabricQueue
Queue that stores tokens that have been put into the input queue but cannot be processed by the switch fabric because the crossbar switch for this connection is busy.-
Fields inherited from class ptolemy.domains.de.lib.aspect.BasicSwitch
_inputBufferDelay, _inputTokens, _ioPortToSwitchInPort, _ioPortToSwitchOutPort, _nextFireTime, _numberOfPorts, _outputBufferDelay, _outputTokens, _switchFabricDelay, inputBufferDelay, numberOfPorts, outputBufferDelay, switchFabricDelay
-
Fields inherited from class ptolemy.actor.lib.aspect.AtomicCommunicationAspect
_parameters, _tokenCount
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.CommunicationAspect
decoratorHighlightColorName
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description CrossbarSwitch(CompositeEntity container, java.lang.String name)
Construct a CrossbarSwitch with a name and a container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_scheduleRefire()
Schedule a refiring of the actor at the current or a future time.java.lang.Object
clone(Workspace workspace)
Clone this actor into the specified workspace.void
fire()
Move tokens from the input queue to the switch fabric, move tokens from the switch fabric to the output queues and send tokens from the output queues to the target receivers.void
initialize()
Initialize actor variables.-
Methods inherited from class ptolemy.domains.de.lib.aspect.BasicSwitch
_getNextFireTime, _getPortID, attributeChanged, createDecoratorAttributes, createIntermediateReceiver, getReceiver, postfire, reset, sendToken, setContainer, setPortIn, setPortOut
-
Methods inherited from class ptolemy.actor.lib.aspect.AtomicCommunicationAspect
_sendToReceiver, decoratedObjects, isGlobalDecorator, registerListener, sendCommunicationEvent
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
_switchFabricQueue
protected java.util.HashMap<java.lang.Integer,java.util.TreeSet<TimedEvent>> _switchFabricQueue
Switch fabric queues for every output port. A token is in the switch fabric queue if it can be processed and for the amount of time defined by the delay.
-
_waitingOnSwitchFabricQueue
protected java.util.HashMap<java.lang.Integer,FIFOQueue> _waitingOnSwitchFabricQueue
Queue that stores tokens that have been put into the input queue but cannot be processed by the switch fabric because the crossbar switch for this connection is busy.
-
-
Constructor Detail
-
CrossbarSwitch
public CrossbarSwitch(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a CrossbarSwitch with a name and a container. The container argument must not be null, or a NullPointerException will be thrown. This actor will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.- Parameters:
container
- The container.name
- The name of this actor.f- Throws:
IllegalActionException
- If the container is incompatible with this actor.NameDuplicationException
- If the name coincides with an actor already in the container.
-
-
Method Detail
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone this actor into the specified workspace. The new actor is not added to the directory of that workspace (you must do this yourself if you want it there). The result is a new actor with the same ports as the original, but no connections and no container. A container must be set before much can be done with this actor.- Overrides:
clone
in classBasicSwitch
- Parameters:
workspace
- The workspace for the cloned object.- Returns:
- A new Bus.
- Throws:
java.lang.CloneNotSupportedException
- If cloned ports cannot have as their container the cloned entity (this should not occur), or if one of the attributes cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String)
,NamedObj.setDeferringChangeRequests(boolean)
-
fire
public void fire() throws IllegalActionException
Move tokens from the input queue to the switch fabric, move tokens from the switch fabric to the output queues and send tokens from the output queues to the target receivers. When moving tokens between queues the appropriate delays are considered.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classBasicSwitch
- Throws:
IllegalActionException
- Thrown if token cannot be sent to target receiver.
-
initialize
public void initialize() throws IllegalActionException
Initialize actor variables.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classBasicSwitch
- Throws:
IllegalActionException
- If the superclass throws it or the switch table could not be parsed from the actor parameters.
-
_scheduleRefire
protected void _scheduleRefire() throws IllegalActionException
Schedule a refiring of the actor at the current or a future time. The actor is refired at current time if there are tokens waiting to be processed by the switch fabric and the state of the crossbar switch indicates that the connection is free. It is refired at a future time if any of the queues contains tokens.- Overrides:
_scheduleRefire
in classBasicSwitch
- Throws:
IllegalActionException
- If actor cannot be refired at the computed time.
-
-