ptolemy.actor.lib.comm
Class HammingDecoder
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.HammingDecoder
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
- public class HammingDecoder
- extends Transformer
Decode a (n, k) Hamming code, where n is specified by
parameter codedRate and k is specified by parameter
uncodedRate.
The Hamming code can correct one-bit error.
To encode a Hamming code, the HammingCoder consumes k information bits
during each firing and consider them as a row vector X. Its
Hamming code is Y = X * G.
If there is no error in Y,
Y * HT should be a zero vector of length n - k.
Otherwise S = Y * HT is called the
syndrome. Let S be the i-th column of H. The HammingDecoder
declares there is an error at the i-th element of Y.
For more information on Hamming codes, see HammingCoder and Proakis, Digital
Communications, Fourth Edition, McGraw-Hill, 2001, pp. 448-450.
- Since:
- Ptolemy II 3.0
- Version:
- $Id: HammingDecoder.java,v 1.15 2004/04/13 03:01:39 cxh Exp $
- Author:
- Rachel Zhou
- See Also:
HammingCoder,
Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Method Summary |
void |
attributeChanged(Attribute attribute)
If the attribute being changed is uncodedRate or
uncodedRate, then verify that it is a positive integer.
|
void |
fire()
If the attributes has changed, check the validity of
uncodedRate and codedRate. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
uncodedRate
public Parameter uncodedRate
- Integer defining the uncode block size. It should be a positive
integer. Its default value is the integer 4.
codedRate
public Parameter codedRate
- Integer defining the Hamming code block size.
This parameter should be a non-negative integer.
Its default value is the integer 7.
HammingDecoder
public HammingDecoder(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 uncodedRate or
uncodedRate, then verify that it is a positive integer.
Set the tokenConsumptionRate and tokenProductionRate.
- Overrides:
attributeChanged in class NamedObj
- Parameters:
attribute - The attribute that changed.
- Throws:
IllegalActionException - If initialState is negative
or uncodedRate is non-positive or any element of
polynomialArray is non-positive.
fire
public void fire()
throws IllegalActionException
- If the attributes has changed, check the validity of
uncodedRate and codedRate. Generate the parity matrix.
Read "uncodedRate" number of tokens from the input port
and compute the syndrome. If the syndrome is non-zero, correct
one-bit error and send the decoded result to the output.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - Not thrown in this base class.