ptolemy.actor.lib.comm
Class DeScrambler
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Transformer
ptolemy.actor.lib.comm.DeScrambler
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class DeScrambler
- extends Transformer
Descramble the input bit sequence using a feedback shift register.
The taps of the feedback shift register are given by the polynomial
parameter. The initial state of the shift register is given by the
initialState parameter. This is a self-synchronizing descrambler that
will exactly reverse the operation of the Scrambler if the polynomials
are the same. The low-order bit of the polynomial should always be set.
For more information, see the documentation for the Scrambler actor
and Lee and Messerschmitt, Digital Communication, Second Edition,
Kluwer Academic Publishers, 1994, pp. 595-603.
- Since:
- Ptolemy II 3.0
- Version:
- $Id: DeScrambler.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee and Ye Zhou
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
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 |
DeScrambler(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name. |
Method Summary |
void |
attributeChanged(Attribute attribute)
If the attribute being changed is polynomial, then
verify that is a positive integer and the lower-order bit is 1. |
void |
fire()
Read bit from the input port and fill it into the shift register
to descramble. |
void |
initialize()
Initialize the actor by resetting the shift register state
equal to the value of initialState. |
boolean |
postfire()
Record the most recent shift register state as the new
initial state for the next iteration. |
Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, 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 |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, 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, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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 |
polynomial
public Parameter polynomial
- Integer defining a polynomial with binary coefficients.
The coefficients indicate the presence (1) or absence (0)
of a tap in a feedback shift register. This parameter should
contain a positive integer with the lower-order bit being 1.
Its default value is the integer 0440001.
initialState
public Parameter initialState
- Integer defining the initial state of the shift register.
The n-th bit of the integer indicates the value of the
n-th register. This parameter should be a non-negative
integer. Its default value is the integer 1.
_shiftReg
private int _shiftReg
_latestShiftReg
private int _latestShiftReg
DeScrambler
public DeScrambler(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the given container and name.
The output and trigger ports are also constructed.
- Parameters:
container
- The container.name
- The name of this actor.
- Throws:
IllegalActionException
- If the entity cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- If the attribute being changed is polynomial, then
verify that is a positive integer and the lower-order bit is 1.
- Overrides:
attributeChanged
in class NamedObj
- Parameters:
attribute
- The attribute that changed.
- Throws:
IllegalActionException
- If polynomial is
non-positive or the lower-order bit is not 1.
fire
public void fire()
throws IllegalActionException
- Read bit from the input port and fill it into the shift register
to descramble. Compute the parity and send it to the output port.
- Specified by:
fire
in interface Executable
- Overrides:
fire
in class AtomicActor
- Throws:
IllegalActionException
- Not thrown in this base class.
initialize
public void initialize()
throws IllegalActionException
- Initialize the actor by resetting the shift register state
equal to the value of initialState.
- Specified by:
initialize
in interface Initializable
- Overrides:
initialize
in class AtomicActor
- Throws:
IllegalActionException
- If the parent class throws it.
postfire
public boolean postfire()
throws IllegalActionException
- Record the most recent shift register state as the new
initial state for the next iteration.
- Specified by:
postfire
in interface Executable
- Overrides:
postfire
in class AtomicActor
- Returns:
- True if execution can continue into the next iteration.
- Throws:
IllegalActionException
- If the base class throws it.