Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
catkira committed Apr 1, 2024
1 parent 1a6178e commit 939074b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
28 changes: 18 additions & 10 deletions py3gpp/nrBCH.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ def nrBCH(trblk, sfn, hrf, lssb, idxoffset, ncellid):
a[G[j_other]] = payload[i]
j_other += 1
a[G[10]] = hrf
a[G[j_sfn + 0]] = 0
a[G[j_sfn + 1]] = 0
a[G[j_sfn + 2]] = 0
a[G[j_sfn + 3]] = 0
a[G[j_sfn + 0]] = 1 if sfn & 0x08 != 0 else 0
a[G[j_sfn + 1]] = 1 if sfn & 0x04 != 0 else 0
a[G[j_sfn + 2]] = 1 if sfn & 0x02 != 0 else 0
a[G[j_sfn + 3]] = 1 if sfn & 0x01 != 0 else 0

# scramble
tmp_seq = nrPBCHPRBS(ncellid, 0, len(a) * 100)
if lssb in (4, 8):
M = A - 3
else:
M = A - 6
v = 2 * a[SFN_3RD_LSB] + a[SFN_2ND_LSB]
v = 2 * a[G[SFN_3RD_LSB]] + a[G[SFN_2ND_LSB]]
n = v * M
scrambling_seq = tmp_seq[n:][:A]
scrambling_seq_final = np.zeros(A, "int")
Expand All @@ -60,10 +60,9 @@ def nrBCH(trblk, sfn, hrf, lssb, idxoffset, ncellid):
# polar encoding + rate matching
E = 864
NMAX = 9
encoded = nrPolarEncode(bits, 0, nmax = NMAX)
print(f'encoded = {encoded[:20]}')
encoded = nrPolarEncode(bits, 0, nmax = NMAX, iil = True)
rate_matched = nrRateMatchPolar(encoded, 0, E, ibil = False)
print(f'matched = {rate_matched[:20]}')

return rate_matched

if __name__ == '__main__':
Expand All @@ -78,8 +77,17 @@ def nrBCH(trblk, sfn, hrf, lssb, idxoffset, ncellid):
decoded = nrBCHDecode(1 - 2*cdblk, 8, lssb, ncellid)
# nid = 0, lssb = 8, idxoffset = 0, hrf = 0, sfn =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,0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,0,1,1,0,1,0,1], int)
assert np.array_equal(cdblk, desired_cdblk)
27 changes: 27 additions & 0 deletions tests/test_nrBCH.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import numpy as np
from py3gpp.nrBCH import nrBCH

def test_nrBCH():
trblk = np.zeros(24, int)
sfn = 0
hrf = 0
lssb = 8
idxoffset = 0
ncellid = 0
cdblk = nrBCH(trblk, sfn, hrf, lssb, idxoffset, ncellid)
# nid = 0, lssb = 8, idxoffset = 0, hrf = 0, sfn = 0
desired_cdblk = np.array([0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,1,1,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,0,1,1,0,0,1,1,0,1,0,0,1,0,0,1,0,1,0,0,0,0,1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,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