amaranth-lang/amaranth-stdio

`AsyncSerial.Signature` is problematic

Opened this issue · 1 comments

zyp commented

I was reading through the code and noticed that AsyncSerial.Signature contains AsyncSerialRX.Signature and AsyncSerialTX.Signature, and all three of them contains a member named divisor.

Furthermore, AsyncSerial assigns to the inner two:

        m.d.comb += [
            self.rx.divisor.eq(self.divisor),
            self.tx.divisor.eq(self.divisor),
        ]

This implies that they are effectively outputs, despite having a signature denoting them as inputs. I believe this will cause a driver conflict error if you attempt using wiring.connect() on either of the three interfaces.

This is not an immediate problem to me, as I only caught this on a read-through, but it seems like an anti-pattern that deserves some attention.

I agree.