
HammingCoder |
ptolemy.actor.lib.comm.HammingCoder |
Encode the information symbols into Hamming code.
Let <i>k</i> denotes parameter <i>uncodedRate</i> and <i>n</i> denotes
parameter <i>codedRate</i>. During each firing, the actor consumes
<i>k</i> bits and encode them into a block of code with length <i>n</i>.
The rate of the code is <i>k/n</i>.
<p>
For a Hamming code, <i>k</i> and <i>n</i> must satisfy the following:
<i>n</i> = 2<i><sup>m</sup></i> - 1
<i>k</i> = 2<sup><i>m</i></sup> - 1 - <i>m</i>;
where <i>m</i> is any positive integer. Note <i>m</i> = <i>n</i> - <i>k</i>.
It is called the order of the Hamming code. The lowest order is <i>m</i> = 2,
and (<i>n</i>, <i>k</i>) = (3, 1).
<p>
The generator matrix G is defined as:
G<i><sub>k*n</sub></i> = [I<i><sub>k</sub></i> | P<i><sub>k*(n-k)</sub></i> ]
where P is called the parity matrix.
The subscript of a matrix indicates its dimension.
<p>
The parity check matrix H is defined as:
H<sub><i>(n-k)*n</i></sub> = [P<sup>T</sup> | I<sub><i>n-k</i></sub> ]
Each column of H must be one of the non-zero <i>n</i> = 2<sup><i>m</i></sup> - 1
combinations of <i>m</i> bits.
<p>
To generate a Hamming code, the <i>k</i> information bits is considered
as a row vector <i><u>X</u></i>. Its Hamming code is
<i><u>Y</u></i> = <i><u>X</u></i> * G.
Hence <i><u>Y</u></i> is a row vector of length <i>n</i>. The result is
then sent to the output port in sequence.
<p>
For more information on Hamming codes, see Proakis, Digital
Communications, Fourth Edition, McGraw-Hill, 2001, pp. 416-424.
<p>
Author(s): Ye Zhou
Version:$Id: HammingCoder.doc.html,v 1.1 2006/02/22 18:40:27 mangal Exp $
Pt.Proposed Rating:Red (eal)
Pt.Accepted Rating:Red (cxh)
uncodedRate
Integer defining the uncode block size. It should be a positive
integer. Its default value is the integer 4.
codedRate
Integer defining the Hamming code block size.
This parameter should be a non-negative integer.
Its default value is the integer 7.