Skip to content

Replace Python-based CRC methods with C++ variants #731

@kerel-fs

Description

@kerel-fs

gr-satellites provides a C++ implementation of generic CRCs in (satellites/crc.h). Starting with GNU Radio 3.10, this got upstreamed in gr-digital (gr-digital/include/gnuradio/digital/crc.h).

At the same time, there are multiple Python-based implementations that could be deprecated and replaced with using the C++ implementation, eg. check_eseo_crc.crc16_ccitt_zero:

def crc16_ccitt_zero(data):
crc = 0
for byte in data:
tbl_idx = ((crc >> 8) ^ byte) & 0xff
crc = (crc_table[tbl_idx] ^ (crc << 8)) & 0xffff
return crc & 0xffff

As recently described, this can be replaced with something like

from . import crc
crc_function = crc(16, 0x1021, 0xffff, 0x0, False, False)

# ....
crc_function.compute(...)

(Non-exhaustive) list of Python-based CRC implementations in gr-satellites

  • check_eseo_crc.crc16_ccitt_zero
  • check_cc11xx_crc.crc16
  • check_tt64_crc.crc16_arc
  • check_crc16_ccitt_false.crc16_ccitt_false

Note that the underlying blocks themself are deprecated, replaced by the crc_check block. So maybe they should not be modified but replaced instead?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions