m-labs / nmigen-boards

Board and connector definition files for nMigen
Other
29 stars 13 forks source link

Handle edge case where the same `Subsignal` uses multiple `Connectors` #18

Closed cr1901 closed 5 years ago

cr1901 commented 5 years ago

Occasionally, it is possible a user will want to add their custom Resource to their boards Connectors that matches the following conditions:

omigen already handles this case by hardcoding the connector to use into the Pins string, as per this example on the b Subsignal.

What should the equivalent nmigen behavior be?

My Proposal

vga = [
        ("vga_out", 0,
            Subsignal("hsync", PinsN("3", dir="o", conn=("led", 0))),
            Subsignal("vsync", PinsN("4", dir="o", conn=("led", 0))),

            Subsignal("r", Pins("1 2 3", dir="o", conn=("dio", 0))),
            Subsignal("g", Pins("4 5 6", dir="o", conn=("dio", 0))),
            Subsignal("b", Pins("7", dir="o", conn=("dio", 0)),
                           Pins("1", dir="o", conn=("clkio", 0))),
            Attrs(IOSTANDARD="LVCMOS33", SLEW="FAST")
        )
    ]
whitequark commented 5 years ago

That's already handled by doing something like:

vga = [
        ("vga_out", 0,
            Subsignal("hsync", PinsN("led_0:3", dir="o")),
            Subsignal("vsync", PinsN("led_0:4", dir="o")),

            Subsignal("r", Pins("dio_0:1 dio_0:2 dio_0:3", dir="o")),
            Subsignal("g", Pins("dio_0:4 dio_0:5 dio_0:6", dir="o")),
            Subsignal("b", Pins("dio_0:7 clkio_0:1", dir="o")),
            Attrs(IOSTANDARD="LVCMOS33", SLEW="FAST")
        )
    ]