Skip to content

Commit

Permalink
Reset CRC start and valid signals on use so they don't get processed …
Browse files Browse the repository at this point in the history
…for multiple clocks
  • Loading branch information
John-K authored Oct 10, 2024
1 parent b6bf515 commit e5fa582
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion amaranth/lib/crc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,12 @@ def elaborate(self, platform):
if self._matrix_g[j][i]:
bit ^= data_in[j]
m.d.sync += crc_reg[i].eq(bit)
m.d.sync += self.valid.eq(0)
with m.Elif(self.start):
m.d.sync += crc_reg.eq(self._initial_crc)
m.d.sync += [
crc_reg.eq(self._initial_crc),
self.start.eq(0)
]

# Check for residue match, indicating a valid codeword.
if self._reflect_output:
Expand Down

0 comments on commit e5fa582

Please sign in to comment.