Class HammingDecoder

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    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$
    Author:
    Ye Zhou
    See Also:
    HammingCoder
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (eal)
    • Field Detail

      • 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.
    • Method Detail

      • 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<TypedIOPort>
        Throws:
        IllegalActionException - Not thrown in this base class.