## 3 Testbench Implementation of D&F Co-Operative 5G Network
Therefore, after both N\({}_{\rm ID}^{\rm I}\) and N\({}_{\rm ID}^{\rm I}\) are detected, and the physical cell ID (N\({}_{\rm ID}^{\rm C}\)) can be calculated as N\({}_{\rm ID}^{\rm C}\) = N\({}_{\rm ID}^{\rm I}\) + 3N\({}_{\rm ID}^{\rm I}\) inside the _Cell ID Detection_ block. Now, with the known N\({}_{\rm ID}^{\rm C}\) and **RG** (time/frequency resource grid), the PBCH DM-RS is extracted and correlated with each reference PBCH DM-RS. After that, the A channel and SNR estimations using PBCH DM-RS symbols for each possible DM-RS sequence are performed and estimated, respectively, in the same block. \(\hat{\bf H}\), \(\hat{\bf N}\), and **RG** are used to extract the received PBCH symbols from the SS/PBCH block, for which this step is implemented in the _PBCH Extraction/MMSE Equalization_ block from the diagram, and MMSE equalization is performed on the PBCH symbols employing estimated channel and noise information after obtaining subcarriers of the PBCH. Then, the equalized PBCH symbols (\(\bf{RG}_{\rm RE}^{\rm PBCH}\)) are demodulated and descrambled in the _NR PBCH Demodulation_ block. PBCH payload carries broadcast channel (BCH) payload which includes the master information block (MIB) and can be obtained through 24 bits of decoded PBCH transport block in the _NR BCH Decode_ block. It should be noted that the D&F protocol obtains, by means of IMB  
Figure 6: Proposed flowchart to hardware interface of 5G decode-and-forward relay node. mation of the system frame number (SFN), the subcarrier spacing for system information block 1 (SIB1), and the frequency offset between SSB and resource grid. Once the signal parameters are known, the received signal (\(\hat{\mathbf{Y}}_{\text{DF}}^{1}\)) is resampling to the nominal sampling rate and is adjusted to the frame origin through timing offset, which is performed from \(\mathbf{T}_{\text{c}}^{\text{c}}(\cdot)\) function in the NR decode-and-encode Algorithm 1. This correction step has been achieved by performing timing estimation by cross-correlation with the known reference signals. Therefore, the CP-OFDM demodulation on full bandwidth is realized by the \(\mathbf{n}\mathbf{r}\mathbf{C}_{\text{d}}^{\text{p}\text{d}\text{dm}}(\cdot)\) function, where the \(\mathbf{N}_{\text{ID}}^{\text{C}}\), \(\mathbf{I}_{\text{MIB}}\), and \(\mathbf{I}_{\text{OFDM}}^{\text{NR}}\) are required as input parameters. In order to minimize the effects of noise and channel distortion, Algorithm 1 implements MMSE equalizer over the demodulated signal (\(\mathbf{Y}\)), which has been developed considering single and multiple antennas. After the steps described above, Algorithm 1 is in condition to execute the decode and encode of the physical, control, and data channels, as well as determining other reference signals of the 5G downlink signal in each time slot (\(\mathbf{N}_{\text{sl}}\)). It should be highlighted that the low-density parity-check (LDPC) technique has been considered to decode and encode the DL-SCH channel, fulfilling the 3 GPP standard [35]. Besides, in the proposed algorithm, the sub-indices \((\cdot)^{\text{d}}\) and \((\cdot)^{\text{e}}\) in the functions describe the processes of decoding and encoding, and the sub-indices \((\cdot)^{\text{b}}\) and \((\cdot)^{\text{s}}\) in the outputs of the functions represent data bits and data symbols, respectively. The \(\mathbf{NR-P^{c}}\) function, mapping each channel in the resource grid, and the \(\hat{\mathbf{x}}\) subframe to the output of the function, is obtained. Accordingly, concatenating each subframe is performed by mean of the \(\mathbf{Cat}(\cdot)\) function, from which all frames retransmitting are saved. \(\hat{\mathbf{X}}\), the resultant signal to the output of Algorithm 1, is modulated by the _nCP-OFDM modulate_ block. After that, an appropriate portion of SS burst is added to the modulated signal.