Commit Graph

4 Commits

Author SHA1 Message Date
Sean Anderson 139baaffcf tb: Use correct width for Xs
In several cases, not the number of Xs did not match the number of bits.
Correct this.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-03-05 00:03:18 -05:00
Sean Anderson 3b836d3ad0 nrzi_decode: Add reset input
Most other modules in the recieve path are reset when signal_status goes
low. This one didn't, and it was difficult to test because of this. In
particular, we need to ensure that this module behaves correctly when
switching between different bitstreams (such as for loopback).

While implementing this, I found some bugs in the way that nrzi_valid
was handled: it wasn't saved from when the transfer actually happened,
and the data wasn't qualified properly.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-11-30 18:14:23 -05:00
Sean Anderson f6f3f024e4 Add phy_core
This module integrates the PCS with the descrambler, implements the PMA
(which is just the link monitor), and implements loopback and coltest
functions. This is more of the PCS/PMA, but the descrambler is
technically part of the PMD, so it's the "core" instead.

We deviate from the standard in one important way: the link doesn't come
up until the descambler is locked. I think this makes sense, since if
the descrambler isn't locked, then the incoming data will be gibberish.
I suspect this isn't part of the standard because the descrambler
doesn't have a locked output in X3.263, so IEEE would have had to
specify it.

Loopback is actually implemented in the PMD, but it modifies the
behavior in several places. It disables collisions (unless
coltest is enabled). Additionally, we need to force the link up (to
avoid the lengthy stabilization timer), but ensure it is down for at
least once cycle (to ensure the descrambler desynchronizes).

On the test side, we just go through the "happy path," as many of the
edge conditions are tested for in the submodule tests. Several of those
tests are modified so that their helper functions can be reused in this
test. In particular, the rx path is now async so that we can feed it
rx_data.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-11-05 12:37:18 -04:00
Sean Anderson c6f95ce26f Add NRZI support
This adds support for encoding and decoding nrzi data.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-08-24 12:29:09 -04:00