soc/cores/code_8b10b: Minor cosmetic cleanups.

This commit is contained in:
Florent Kermarrec 2021-03-03 08:54:31 +01:00
parent 2e531e0ec7
commit 2fd7451fc9
1 changed files with 25 additions and 24 deletions

View File

@ -129,20 +129,20 @@ table_3b4b = [
0b0010,
0b1010,
0b0110,
0b0001, # primary D.x.7
0b0001, # Primary D.x.7
]
table_3b4b_unbalanced = [bool(disparity(c, 4)) for c in table_3b4b]
table_3b4b_flip = list(table_3b4b_unbalanced)
table_3b4b_flip[3] = True
table_4b3b = reverse_table_flip(table_3b4b, table_3b4b_flip, 4)
# alternative D.x.7
# Alternative D.x.7
table_4b3b[0b0111] = 0b0111
table_4b3b[0b1000] = 0b0111
table_4b3b_kn = reverse_table(table_3b4b, 4)
table_4b3b_kp = reverse_table([~x & 0b1111 for x in table_3b4b], 4)
# primary D.x.7 is not used
# Primary D.x.7 is not used
table_4b3b_kn[0b0001] = 0b000
table_4b3b_kn[0b1000] = 0b111
table_4b3b_kp[0b1110] = 0b000
@ -162,7 +162,7 @@ class SingleEncoder(Module):
# # #
# stage 1: 5b/6b and 3b/4b encoding
# Stage 1: 5b/6b and 3b/4b encoding.
code5b = self.d[:5]
code6b = Signal(6, reset_less=True)
code6b_unbalanced = Signal(reset_less=True)
@ -193,8 +193,8 @@ class SingleEncoder(Module):
)
]
alt7_rd0 = Signal(reset_less=True) # if disparity is -1, use alternative D.x.7
alt7_rd1 = Signal(reset_less=True) # if disparity is +1, use alternative D.x.7
alt7_rd0 = Signal(reset_less=True) # If disparity is -1, use alternative D.x.7.
alt7_rd1 = Signal(reset_less=True) # If disparity is +1, use alternative D.x.7.
self.sync += [
alt7_rd0.eq(0),
alt7_rd1.eq(0),
@ -210,7 +210,7 @@ class SingleEncoder(Module):
)
]
# stage 2 (combinatorial): disparity control
# Stage 2 (combinatorial): disparity control.
output_6b = Signal(6)
disp_inter = Signal()
self.comb += [
@ -268,8 +268,7 @@ class Encoder(Module):
for e1, e2 in zip(encoders, encoders[1:]):
self.comb += e2.disp_in.eq(e1.disp_out)
for d, k, output, disparity, encoder in \
zip(self.d, self.k, self.output, self.disparity, encoders):
for d, k, output, disparity, encoder in zip(self.d, self.k, self.output, self.disparity, encoders):
self.comb += [
encoder.d.eq(d),
encoder.k.eq(k)
@ -350,6 +349,7 @@ class StreamEncoder(stream.PipelinedActor):
# # #
# Encoders
encoder = Encoder(nwords, True)
self.submodules += encoder
@ -374,6 +374,7 @@ class StreamDecoder(stream.PipelinedActor):
# # #
# Decoders
decoders = [Decoder(True) for _ in range(nwords)]
self.submodules += decoders