Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pin mapping support #5

Open
kenkendk opened this issue Aug 11, 2017 · 0 comments
Open

Add pin mapping support #5

kenkendk opened this issue Aug 11, 2017 · 0 comments

Comments

@kenkendk
Copy link
Owner

kenkendk commented Aug 11, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant