Skip to content

Commit

Permalink
docs/stdlib/crc: minor phrasing improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Apr 11, 2024
1 parent c59447c commit 84dff93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions amaranth/lib/crc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ def algorithm(self):
xor_output=self._xor_output)

def residue(self):
"""Obtain the residual value left in the CRC register after processing a valid trailing CRC.
A trailing CRC data word is also known as a codeword."""
"""Obtain the residual value left in the CRC register after processing a valid trailing CRC."""
# Residue is computed by initialising to (possibly reflected) xor_output, feeding crc_width
# worth of 0 bits, then taking the (possibly reflected) output without any XOR.
if self._reflect_output:
Expand Down Expand Up @@ -273,10 +271,10 @@ class Processor(Elaboratable):
computes every new bit of the CRC in parallel.
The :py:`match_detected` output may be used to validate data with a trailing CRC (also known as
a codeword). If the most recently processed data word(s) form the valid CRC of all the previous
data words since :py:`start` was asserted, the CRC register will always take on a fixed value
known as the :meth:`residue <Parameters.residue>`. The :py:`match_detected` output indicates
whether the CRC register currently contains this residue.
a codeword in coding theory). If the most recently processed data word(s) form the valid CRC of
all the previous data words since :py:`start` was asserted, the CRC register will always take on
a fixed value known as the :meth:`residue <Parameters.residue>`. The :py:`match_detected` output
indicates whether the CRC register currently contains this residue.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions docs/stdlib/crc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Examples
from amaranth.lib.crc.catalog import CRC16_CCITT, CRC16_USB


# Compute a CRC in hardware using the predefined CRC16-CCITT algorithm and the data word
# Compute a CRC in hardware using the predefined CRC16-CCITT algorithm and a data word
# width of 8 bits (in other words, computing it over bytes).
m.submodules.crc16_ccitt = crc16_ccitt = CRC16_CCITT().create()

# Compute a CRC in hardware using the predefined CRC16-USB algorithm and the data word
# Compute a CRC in hardware using the predefined CRC16-USB algorithm and a data word
# width of 32 bits.
m.submodules.crc16_usb = crc16_usb = CRC16_USB(32).create()

Expand Down

0 comments on commit 84dff93

Please sign in to comment.