# Low-Complexity Channel Codes for Reliable Molecular Communication via Diffusion
## 2 Materials and Methods
### TCH Codes  
Channel coding is based on correcting up to several errors, by providing immunity to the transmitted signal. Channel coding improves the communication link's reliability, but it also implies a reduction in the overall transmission rate, due to implicit code rate \(k/n\). TCH codes are a class of binary, nonlinear, non-systematic, and cyclic block codes of length \(n=2^{m}\), where \(m\) is any positive integer. For efficiency reasons, the all-zero codeword was excluded from the code set and the inverse (binary negation) of any codeword is always another valid codeword [23]. TCH block codes are identified as \(\text{TCH}(n,k,t)\) where \(n\) represents the code length, \(k\) identifies the number of information bits in a code word and \(t\) is its error-correcting capacity. With \(P_{i}\) being a theoretically generated set of Base Polynomials, which give the whole structure for any of these codes, we can write [24]  
\[n=2^{m},m\in\mathbb{N} \tag{16}\]  
\[k=m+\log_{2}(h)+1 \tag{17}\]  
\[d_{min}^{TCH}\geq 2t_{TCH}+1 \tag{18}\]  
\[d_{min}^{TCH}\leq H_{d}[P_{i}(x),\{P_{j}(x^{r})\}\text{mod }n_{TCH}]\leq n_{TCH}-d_{min}^{TCH} \tag{19}\]  
\[P_{i}(x)=P_{j}(x^{r})\text{mod }n_{TCH},i\
eq j\forall t_{TCH}\in\mathbb{N}. \tag{20}\]  
As usual, their error-correcting capacity, \(t_{TCH}\), depends on the minimum distance, \(d_{min}^{TCH}\), between the polynomials, where \(H_{d}\) stands for the Hamming distance between any two polynomials. TCH codes are also balanced codes, that is, the number of zeros equals the number of ones in each codeword, which is an important feature for MC systems. We can derive TCH codes of nearly any length, however, the most important class of TCH codes which originated all of them, are based on the so-called Basic TCH Polynomials (B-TCH). B-TCH polynomials with degree \(n\) are obtained by the following equation  
\[P(x)=\sum_{i=0}^{p-1}a_{i}x^{K_{i}},a^{i}\in GF(q),q=p^{k},k\in\mathbb{N} \tag{21}\]  
where the exponents \(K_{i}\) satisfy the equation  
\[a^{K_{i}}=1+a^{2i+1},i=0,1,\ldots,\frac{p-1}{2}-1. \tag{22}\]  
In these expressions, \(p\) is a prime number obeying the following condition:  
\[p=n_{TCH}+1=2^{m}+1. \tag{23}\]  
Prime number that verify this condition can be written as  
\[F_{i}=2^{2^{i}}+1,i\in\mathbb{N} \tag{24}\]  
and so they are in fact Fermat numbers (\(F_{i}\)). Only five code lengths obey these rules, which means that we can only generate pure TCH polynomials for codes with lengths of 2, 4, 16, 256, and 65,536. TCH codes originated by B-TCH polynomials have both good cross and autocorrelation. Their autocorrelation is always three-valued, with values \(n\), 0, and -4, and its distribution is perfectly characterized for any \(n\)[25]. This translates into a great advantage for higher sized TCH codes, such as TCH codes length \(n\geq 256\) since these sequences tend to get closer to a Dirac impulse, as shown in Figure 3.  
Conceptually, the TCH receiver is based on a group of correlators to compare the received word. As usual, and by comparing the outputs of the correlators it becomes possible to choose the sequence that corresponds to the highest correlation or the most likely word sent. In the TCH receiver, depicted in Figure 4, correlation is done in the frequency domain using two FFT's, a complex multiplication and an IFFT, which, together with some optimizations, accelerates the decoding process. For example, and as FFT's of length \(n\) process \(n\) codewords simultaneously, the efficiency increases with the code length \(n\). Furthermore since both, real and imaginary parts are also processed simultaneously, that further decreases the processing time to half, again doubling the receiver efficiency.