Parity

source

Parity(
   block_size: int = 8, debug: Debug = Debug.DEPLOY
)

A Parity EDAC System to deal with data that needs parity code added

Args

  • debug (Debug, optional) : Debug Level. Defaults to DEPLOY.

Methods:

._decode

source

._decode(
   data: int
)

Check the if the data is same as the given parity code

Args

  • data (int) : given data
  • check (int) : parity bit

Returns

  • tuple : (error, data, error bits)
  • error (bool) : If any error happens in the data
  • data (int) : the corrected data (0 for CI)
  • bits (list) : the index of the error bits CI for Cannot Identify

._encode

source

._encode(
   data: int
)

encode the given integer (was bytes)

Args

  • data (int) : given integer

Returns

  • int : integer that is encoded