Commit Graph

4 Commits

Author SHA1 Message Date
Sean Anderson 3ec1f4d77d Automatically dump signals
While manually dumping signals with a macro works OK for standalone
modules, it doesn't work when multiple modules are included. Instead,
create a second top-level module to dump signals. Inspired (once again)
by [1].

[1] https://github.com/steveicarus/iverilog/issues/376#issuecomment-709907692
Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-10-30 14:20:48 -04:00
Sean Anderson 548e5b5b51 Convert all reg assignments to initial
As it turns out,

	reg foo = 0;

is not the same as

	reg foo; initial foo = 0;

but instead is equivalent to

	reg foo; always @(*) foo = 0;

This is rather silly. Convert all existing (lucky) examples to the
second form.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-10-16 17:48:43 -04:00
Sean Anderson ebcb8cc056 mdio: Support
The 802.3.22.2.4.3 requires that the phy not respond to reads of and
ignore writes to unimplemented extended registers. When writing the mdio
module, I expected that such read/writes would not be acked by the
registers. However, that behavior is not especially nice for wishbone
masters which don't expect it. Instead, allow the slave to return an
error instead. We need an extra saved_err variable, since we might not
be able to set bad immediately (when ce is low).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-08-29 21:25:25 -04:00
Sean Anderson f1b345299e Add mdio module
This module implements the MII management interface ("MDIO"), and
translates frames into classic wishbone reads/writes. We use a
"state_counter" to keep track of how many additional bits we expect to
recieve before continuing on to the next field in the frame. We require
a preamble because it prevents ambiguity, and omitting it doesn't seem
to be very popular (seeing as it was removed for c45). Generally, even
if we find an error in the frame, we still procede through the states as
usual. This prevents any spurious reads/writes caused by misinterpreting
an unaligned data stream.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-08-27 15:59:29 -04:00