New Radio periodically allocates resource blocks to a Synchronization Signals and Physical Broadcast Channel (SS/PBCH) block in TS 38.11 Section 7.4.3 of Release 15. The SS portion of the SS/PBCH block contains the Primary Synchronization Signal (PSS) and the Secondary Synchronization Signal. The PBCH portion of the SS/PBCH block contains the Master Information Block (MIB) and Demodulation Reference Signals (PBCH DM-RS) which serves as a reference for demodulating the MIB. The SS/PBCH block is repeated every 2 frames (TS 38.213 Section 4.1 Release 15) which is a time period of 20 msec.

Collectively this block is used by user equipment (UE) to search for and identify 5G NR cells. This is accomplished by encoding the cell id in to the PSS & SS and the  beam id & MIB contents inside the DM-RS, and PBCH. The physical cell id (called $N^{cell}_{id}$ in the standard) is divided in to two parts (TS 38.211 Section 7.4.2.1, Release 15) such that

$$N^{cell}_{id} = 3 N^1_{id} + N^2_{id}$$

Where $N^{1}_id$ is in the set {0,...,335} and $N^{2}_id$ is in the set {0,1,2} which makes 1008 unique 5G physical cell ids (3*335 + 3). The SS/PBCH block is generated and transmitted 4 or 8 times depending on the number of beams used in the cell search procedure. The beam id (0-4 or 0-7)  is encoded in the PBCH-DMRS which means that the PBCH-DMRS changes for each of these bursts. The bursts are placed in consecutive slots. The exact symbol placement within a slot will be discussed later

## Primary Synchronization Signal (PSS)

The PSS generation is described in TS 38.211 Section 7.4.2.2.1 of Release 15 which creates a BPSK modulated sequence using $N^2_{id}$ as the only input. Since $N^2_{id}$ must be in the set {0,1,2} this means there are only 3 unique PSS sequences which simplifies the search space for the primary synchornization sequence and thus initial cell discovery.

First, a bit sequence $x(m)$ is generated. The initial 7 values are seeded according to

n x(n)
0 0
1 1
2 1
3 0
4 1
5 1
6 1

And the rest of the sequence is generated recursively using

$$x(i+7) = (x(i + 4) + x(i)) \% 2$$

This sequence is then sampled at an offset of $N^2_{id}$ and BPSK modulated so that

$$d_{PSS}(n) = 1 - 2x ( (n + 43 N^2_{id}) \% 127)$$

This can be generated in python

def pss_gen(N_id2=0):
d_pss = np.empty(12)
x = np.zeros(127)
x[0:7] = np.array([0,1,1,0,1,1,1])
for ii in range(7, 127):
x[ii] = (x[ii-3] + x[ii-7]) % 2

for n in range(127):
m = (n + 43*N_id2) % 127
d_pss[n] = 1 - 2*x[m]
return d_pss

Notice that the definition of the PSS is 127 bits long before it begins repeating. As we will see in the SS/PBCH block mapping below, the PSS is only 127 bits long. Again, since there are only 3 unique PSS signals generated it is the first clue that a 5G NR cell is present and gives a small portion of the physical cell id.

## Secondary Synchrronization Signal (SSS)

The SSS is one of 336 sequences depending on $N^2_{id}$ portion of the physical cell id and is also a BPSK signal 127 bits long. The SSS details are in TS 38.211 Section 7.4.2.3.1, Release 15. There are two m-sequences $x_0$ and $x_1$ defined to compute the SSS

n x_0(n) x_1(n)
0 0 1
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0

$$x_0(i+7) = (x_0(i+4) + x_0(i)) \% 2$$

$$x_1(i+7) = (x_0(i+1) + x_0(i)) \% 2$$

They are each indexed based on offsets defined as $m_0$ and $m_1$:

$$m_0 = 15 \cdot \lfloor N^1_{id} / 112 \rfloor + 5 N^1_{id}$$

$$m_1 = N^1_{id} % 112$$

Then the actual sequence $d_{SSS}$ is

$$d_{SSS}(n) = \left[1 - 2x_0\left(\left(n+m_0\right) \% 127\right) \right] \left[1 - 2x_1\left(\left(n+m_1\right) \% 127 \right) \right]$$

After a user equipment identifies the PSS, the 336 SSS sequences are searched to find the whole physical cell id.

A python function that generates SSS data looks like this

def sss_gen(N_id1=0):
d_sss = np.empty(12)
x = np.zeros(127)
x_0[0:7] = np.array([0,0,0,0,0,0,1])
x_1[0:7] = np.array([0,0,0,0,0,0,1])
for ii in range(0, 120):
x_0[ii] = (x_0[ii+4] + x_0[ii+1]) % 2
x_1[ii] = (x_1[ii+4] + x_1[ii+1]) % 2
m_0 = 15 * int(math.floor(N_id1 / 112)) + 5*N_id1
m_1 = int(math.floor(N_id1 / 112))

for n in range(127):
d_sss[n] = (1 - 2*x_0[(n + m_0) % 127]) * (1 - 2*x_1((n+m_1) % 127))
return d_sss

## PBCH DM-RS

The PBCH DM-RS is a QPSK modulated PN sequence generated using the gold sequence. The signal generation is described in TS 38.211 Section 7.4.1.4.1, Release 15. The gold sequence seed depends on two parameters

1. $\overline{i_{SSB}}$ which is related to the id of the synchronization signal block this belongs to
2. $N^{cell}_{id}$, the physical cell id

$$c_init = 2^11 (\overline{i_{SSB}} + 1) (\lfloor N^{cell}_{id}/4 \rfloor + 1) + 2^6(\overline{i_{SSB}} + 1) + (N^{cell}_{id} \% 4)$$

Given the gold sequence generated by $c_init$ the DM-RS is given by $r(m)$

$$r(m) = \frac{1}{\sqrt{2}} (1-2\cdot c(2m)) + j\frac{1}{\sqrt{2}} (1-2\cdot c(2m+1))$$

As we will see in the following section, the PBCH signal maps 144 subcarriers for the PBCH DM-RS which means that $r(m)$ is a sequence of 144 QPSK symbols.

## PBCH data

The PBCH data payload comes from a polar encoding of MIB data. The details of generating that bitstream will be covered in a future post. For now, TS 38.211 7.3.3.1 descibes the procedure for scrambling the block of bits provided as the PBCH payload. The sequence is $M_{bit}$ bits long, which we know is 864 bits that will be mapped to 462 QPSK modulated symbols. The 864-bits provided as the PBCH data payload ($b(i)$) will be scrambled with a gold sequence ($c(i)$) using $c_init=N^{cell}_{id}$. The sequence is indexed using an a multiple $v$ of $M_{bit}$ where

• for $L_{MAX} = 4$: $v is the two least significant bits of SS/PBCH block index ($i_{SSB})
• for $L_{MAX} = 8$ or $L_{MAX} = 64$ : $v is the three least significant bits of SS/PBCH block index ($i_{SSB})

The scrambed bit sequence $b(i)$ is then

$$\widetilde{b}(i) = (b(i) + c(i + v M_{bit})) \% 2$$

That bit sequence is then QPSK modulated.

# Mapping Synchronization Signals in the SS/PBCH Block

The SS/PBCH block is a set of 20 resource blocks across 4 OFDM symbols. Since there are 20 resource blocks * 12 subcarriers per resource block this block is 240 subcarriers across 4 symbols. The placement of PSS, SSS, and PBCH to subcarriers across these symbols is defined by Table  7.4.3.1-1 in TS 38.211 Section 7.4.3.1, Release 15. Symbol 0 of the SS/PBCH block contains the PSS starting with subcarrier 56. The SSS is placed on symbol 2 also starting at subcarrier 56. The PBCH is spread across symbols 1, 2, 3 in the following manner

In this mapping scheme 576 subcarriers across the 4 symbols are allocated to the PBCH with 240 PBCH symbols in OFDM symbol 1 & 3 and 96 PBCH symbols in OFDM symbol 2. PBCH symbol data is allocated by first filling mapping the sequence in ascending subcarrier number and filling each OFDM symbol before advancing to the next one.

The PBCH subcarriers have the PBCH DM-RS interleaved with the MIB data such that every fourth subcarrier in the block is DM-RS data. The starting point for interleaving is dependent on $v = N^{cell}_{id} \% 4$.

In symbols 1 and 3, the DM-RS subcarriers are numbered 0 + v, ..., 236 + v. In symbol 2 the DM-RS subcarriers are numbered 0+v, ..., 44+v and 192+v, ..., 236+v. Every fourth subcarrier in those blocks are occupied by DM-RS data and the remaining PBCH subcarriers receive MIB data. Since there are 576 subcarriers across the SS/PBCH block allocated to the PBCH with a 25%/75% split between DM-RS and MIB data that means the DM-RS occupies 144 subcarriers and MIB data occupies 432.

Putting all of this together, the data required to fill in OFDM symbols for the PSS, SSS, and PBCH DM-RS are available (except for the MIB data) and can be allocated to the resource elements. Using $N^{cell}_{id}=0$ and $L_{MAX}=4$ as an example the SS/PBCH without the MIB data looks look the following

## Mapping SS/PBCH to a frame

As previously mentioned, TS 38.213 Section 4.1 (Release 15) specifies that half frames with SS/PBCH blocks occur with a period of at least 2 frames. Each SS/PBCH block is intended to be associated with a spatial beam to aid in better cell coverage than could be achieved with a uniform wider beam. The same sections describes how to map SS/PBCH blocks to OFDM symbols within a half frame. Remember that there are $L_{MAX}$ SS/PBCH blocks

For a half frame that contains SS/PBCH blocks there are 5 cases for determining which OFDM symbols will contain a SS/PBCH block which depends on a combination of the numerology (subcarrier spacing) and carrier frequency. The following table outlines the cases and which subcarrier spacings they apply to as well as the sub-cases depending on the carrier frequency. The OFDM symbol count begins with 0 being the first symbol of the first slot in the half-frame.

Case Subcarrier Spacing (kHz) Carrier Frequency Criteria indeces Offset multiples (n)
A 15 kHz Carrier < 3 GHz {2, 8} 14 * n 0, 1
A 15 kHz 3 GHz < Carrier < 6 GHz {2, 8} 14 * n 0, 1, 2, 3
B 30 kHz < 3 GHz {4, 8, 16, 20} 14 * n 0
B 30 kHz 3 GHz < Carrier < 6 GHz {4, 8, 16, 20} 14 * n 0, 1
C 30 kHz Carrier < 3 GHz paired spectrum {2, 8} 14 * n 0, 1
C 30 kHz 3 GHz < Carrier < 6 GHz paired spectrum {2, 8} 14 * n 0, 1, 2, 3
C 30 kHz Carrier < 2.4 GHz unpaired spectrum {2, 8} 14 * n 0, 1
C 30 kHz 2.4 GHz < Carrier < 6 GHz unpaired spectrum {2, 8} 14 * n 0, 1, 2, 3
D 120 kHz Carrier > 6 GHz {4, 8, 16, 20} 28 * n 0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18
E 240 kHz Carrier > 6 GHz {8, 12, 16, 20, 32, 36, 40, 44} 56 * n 0, 1, 2, 3, 5, 6, 7, 8

To illustrate this the following pictures show which OFMD symbols contain SS/PBCH block data. In each diagram, the dark green shows the candidate symbol to begin an SS/PBCH block which would contain the PSS. The orange symbols would contain the SSS and some PBCH data. The blue symbols would contain PBCH data. The remainer of the colors alternate shades of gray to show slot boundaries