# An Uplink Channel Estimator Using a Dedicated Instruction Set for 5G Small Cells
## 4 Design and Acceleration of Instruction Set
### Pseudo Code Analysis of Algorithm  
From the discussion in Section 3, we know that for a certain pilot subcarrier, the pilot value of the transmitting antenna i1 is \(R1\), and the pilot value of the transmitting antenna i2 is \(R2\); the receiving value of the fourth symbol on the receiving antenna j1 is \(Z1\), and the receiving value of the eleventh symbol is \(Z2\); the receiving value of the fourth symbol on the receiving antenna j2 is \(Z3\), and the receiving value of the eleventh symbol is \(Z4\). The corresponding estimated value of the channel \(H_{i1j}\), \(H_{i2j}\) can be obtained, and the calculation formula can be found in Equations (5) and (6), which are rewritten according to Equation (2). \[H_{i1j}=(Z1^{*}R2+Z2^{*}R1)/(2^{*}R1^{*}R2); \tag{5}\]  
\[H_{i2j}=(Z1^{*}R2-Z2^{*}R1)/(2^{*}R1^{*}R2); \tag{6}\]  
It is easy to find that the LS estimation of multiple subcarriers inevitably requires multiple cyclic Equations (5) and (6). Therefore, we need to use \"For\" to carry out multiple loops in the pseudo code in Algorithm 1. In order to reduce the clock cycle of LS operation and reduce the overhead of pipeline emptying and memory access due to multiple cycles, we need to carry out loop unroll. Pipeline technology can be used as efficiently as possible. According to the capability of the existing SIMD architecture, and in order to eliminate the NOP inserted due to data dependency as much as possible, we need multipoint parallel loop unroll for multiple subcarriers. The pseudo code implementation is shown in Algorithm 1. ```
0:\(Z1[4^{*}\text{N}]\), \(Z2[4^{*}\text{N}]\), R1[4^{*}\text{N}]\), R2[4^{*}\text{N}]\)// \(4^{*}\text{N}\) pilot subcarriers;
0:Hi1][4^{*}\text{N}], Hi2][4^{*}\text{N}]
1:for\(i=0\to N\)do
2:for\(j=4\to N\)do
3://Calculate 4 subcarriers in one cycle
4:\(\text{a[4^{*}i+j]}=Z1[4^{*}i+j]^{*}\) R2[4^{*}i+j]+Z2[4^{*}i+j]^{*}\) R1[4^{*}i+j]; //Subcarrier \(4\text{i}+j\)
5:\(\text{b[4^{*}i+j]}=2^{*}\) R1[4^{*}i+j]^{*}\) R2[4^{*}i+j];
6:\(\text{c[4^{*}i+j]}=Z1[4^{*}i+j]^{*}\) R2[4^{*}i+j]-Z2[4^{*}i+j]^{*}\) R1[4^{*}i+j];
7:\(\text{Hi1j[4^{*}i+j]}=\text{a[4^{*}i+j]}\) / \(\text{b[4^{*}i+j]}\);
8:\(\text{Hi2j[4^{*}i+j]}=\text{c[4^{*}i+j]}\) / \(\text{b[4^{*}i+j]}\);
9:endfor
10:endfor
```  
**Algorithm 1** LS estimation algorithm. The calculation method of the Wiener filter interpolation algorithm is shown in Equation (3). Taking the pilot configuration of 3 GPP TS 38.211 introduced in Section 2 as an example, the interpolation formula of the data subcarrier to be interpolated between the two pilots is shown in Equation (7), where \(H_{ls1}\), \(H_{ls2}\) is the H matrix of the first pilot subcarrier and the second pilot subcarrier, respectively; \(W1\), \(W2\) is the element of the corresponding tap matrix; \(H0\) is the H matrix of the subcarrier to be interpolated. It is easy to find that the interpolation formula of linear interpolation can also be transformed into a form similar to Equation (7). \[H0=W1^{*}H_{ls1}+W2*H_{ls2}; \tag{7}\]  
For linear interpolation, the tap value only needs to be made into a look-up table, and different tap values can be selected according to the pilot interval. For Wiener interpolation, the correlation matrix is generated by the sinc function, and the specific element values can be calculated in advance and put into the look-up table. Before the interpolation module starts to work, the value of the Wiener filter correlation matrix and the SNR in the configuration register are read into the register file, and then called by the operation module. The pseudo code of the interpolation module is shown in Algorithm 2. ```
0: RPP[2, 2], RHP[2, N], n * Hlsk[2, 4] //N is the pilot interval, and the number of pilot subcarriers is 2N, and k is the sequence number of pilot subcarriers (k = 1,2,3...,2*n means interpolation, k = 0,2*n + 1 means extrapolation). 0: n * (N + 1) * H[4 * 4]
1: Hls0[2, 4] = 2 * Hls1[2, 4]-Hls2[2, 4]; //The first and last virtual pilot subcarriers are obtained by linear extrapolation.