LTE Primopredajnik
Loading...
Searching...
No Matches
receiver.crc_checker.CRCChecker Class Reference

Public Member Functions

 __init__ (self, int poly=0x1021, int init=0xFFFF)
tuple[np.ndarray, bool] check (self, np.ndarray bits_with_crc)

Public Attributes

 poly = poly
 init = init

Protected Member Functions

np.ndarray _crc16 (self, np.ndarray bits)

Detailed Description

CRC checker za PBCH (RX strana).

Parameters
----------
poly : int, optional
    CRC polinom (default: 0x1021, CRC-16-CCITT).
init : int, optional
    Početna vrijednost CRC registra (default: 0xFFFF).

Examples
--------
>>> import numpy as np
>>> from rx.crc_checker import CRCChecker
>>>
>>> payload = np.array([1, 0, 1, 1, 0, 1], dtype=np.uint8)
>>> crc = CRCChecker()
>>>
>>> crc_bits = crc._crc16(payload)
>>> bits_with_crc = np.concatenate([payload, crc_bits])
>>>
>>> payload_rx, ok = crc.check(bits_with_crc)
>>> ok
True

Member Function Documentation

◆ _crc16()

np.ndarray receiver.crc_checker.CRCChecker._crc16 ( self,
np.ndarray bits )
protected
Izračunava CRC16 remainder nad ulaznim bitovima.

Parameters
----------
bits : np.ndarray
    Ulazni bitovi (0/1), shape (N,).

Returns
-------
np.ndarray
    CRC remainder (16 bita), shape (16,).

Notes
-----
- Implementacija je bit-po-bit.
- Identična je CRC funkciji korištenoj u PBCH TX enkoderu.

◆ check()

tuple[np.ndarray, bool] receiver.crc_checker.CRCChecker.check ( self,
np.ndarray bits_with_crc )
Provjerava CRC nad PBCH payload-om.

Parameters
----------
bits_with_crc : np.ndarray
    Bitovi koji sadrže payload + CRC (npr. 40 bita).

Returns
-------
payload_bits : np.ndarray
    Informacijski bitovi (bez CRC-a).
ok : bool
    True ako CRC prolazi, False inače.

Examples
--------
>>> import numpy as np
>>> crc = CRCChecker()
>>> bits = np.array([1, 0, 1, 0], dtype=np.uint8)
>>> bits_crc = np.concatenate([bits, crc._crc16(bits)])
>>> payload, ok = crc.check(bits_crc)
>>> ok
True

The documentation for this class was generated from the following file:
  • receiver/crc_checker.py