Skip to content

Add pin mapping support #5

@kenkendk

Description

@kenkendk

The TopLevelInput and TopLevelOutput busses should be map-able to pins on the target board.

This could be implemented with an attribute, like this:

[TopLevelOutput]
public interface MyBus : IBus
{
    [Pin("G32")]
    public bool StatusLED { get; set; }
}

The generated VHDL will then be augmented with a constraint file that maps the relevant pins.

This can be further simplified with a board configuration class, i.e.:

public static class ZedBoard_v1
{
    public static string LED0 = "G32";
}

The user code can then map it like this:

using static Zeboard_v1;

[TopLevelOutput]
public interface MyBus : IBus
{
    [Pin(LED0)]
    public bool StatusLED { get; set; }
}

The using static statement allows easy board switching, provided the boards have the same named components. It would also be trivial to write a bait-n-switch class that simply maps items based on compile directives, i.e.:

public static class Board
{
#if BOARDTARGET_ZEDBOARD
    public static string LED0 = "G32";
#elif BOARDTARGET_PYNQ
    public static string LED0 = "F16";
#else
#error Unsupported board
#endif
}

The board can then be used with:

[TopLevelOutput]
public interface MyBus : IBus
{
    [Pin(Board.LED0)]
    public bool StatusLED { get; set; }
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions