wiki:HardwareUsersGuides/FPGABoard_v2.2/UserIO

Version 2 (modified by sgupta, 15 years ago) (diff)

--

WARP FPGA Board User I/O

No image "FPGA_Board_UserIO.jpg" attached to HardwareUsersGuides/FPGABoard_v2.2/Images

The FPGA board includes a variety of interactive I/O devices, referred to as User I/O. These interfaces are intended to aid with observing and debugging custom designs in hardware.

Push Buttons

Five push buttons are connected to dedicated FPGA inputs and are arranged in a cross. They are generally referred as up, down, left, right and center. The buttons are normally open connections with external pull down resistors. Thus, the FPGA will observe logic high when a button is pressed, logic low otherwise.

The switches are debounced by a simple low pass filter on the board, but user applications which are sensitive to accidental or repeated rising edges should further debounce the input digitally.

In our standard EDK designs, the down button is assigned to the PowerPC's soft reset input. When pushed and released, the PowerPC will reset and re-enter the user's main() function. If desired, the choice of the reset button can be changed in an EDK project's hardware specification.

DIP Switch

The 4-position DIP switch drives four dedicated inputs on the FPGA. Sliding a switch to the left drives the input to logic low; to the right drives the input to logic high.

LEDs

There are 16 LEDs which can be controlled from user designs.

Eight of these are connected to dedicated FPGA I/O pins- four green, four red.

An additional eight LEDs, all yellow, are connected to the FPGA through an I2C I/O expander (MAX7318, component U39). User designs must use an I2C master in the FPGA to control these LEDs.

Seven Segment Displays

There are three 7-segment displays on the FPGA board. All three are connected to the FPGA through I2C I/O expanders. User designs must use an I2C master in the FPGA to control the displays.

Each display includes eight LED elements- seven forming segments of a numerical digit and one acting as a small decimal point. Each element is controlled individually by separate bits in the I2C I/O expander's register bank.

Your applicaiton must handle the mapping of hexadecimal digits to the 7 LED segments. Example Verilog and C code is included below which implements this mapping.

No image "FPGA_Board_7seg.jpg" attached to HardwareUsersGuides/FPGABoard_v2.2/Images

Verilog Hex -> Seven Segment Mapping Example

module sevenSegmentMap
(
    input   [3:0]   fourBitInput,
    output  [6:0]   hexDisplay
);

reg [6:0]   hexDisplay;

always @(fourBitInput[3:0])
    case (fourBitInput[3:0])
        4'b0001 : hexDisplay = ~(7'b1111001);   // 1
        4'b0010 : hexDisplay = ~(7'b0100100);   // 2
        4'b0011 : hexDisplay = ~(7'b0110000);   // 3
        4'b0100 : hexDisplay = ~(7'b0011001);   // 4
        4'b0101 : hexDisplay = ~(7'b0010010);   // 5
        4'b0110 : hexDisplay = ~(7'b0000010);   // 6
        4'b0111 : hexDisplay = ~(7'b1111000);   // 7
        4'b1000 : hexDisplay = ~(7'b0000000);   // 8
        4'b1001 : hexDisplay = ~(7'b0010000);   // 9
        4'b1010 : hexDisplay = ~(7'b0001000);   // A
        4'b1011 : hexDisplay = ~(7'b0000011);   // b
        4'b1100 : hexDisplay = ~(7'b1000110);   // C
        4'b1101 : hexDisplay = ~(7'b0100001);   // d
        4'b1110 : hexDisplay = ~(7'b0000110);   // E
        4'b1111 : hexDisplay = ~(7'b0001110);   // F
        default : hexDisplay = ~(7'b1000000);   // 0
    endcase
endmodule

C Hex -> Seven Segment Mapping Example

unsigned char sevenSegmentMap(unsigned char x)
{
    switch(x)
    {
        case(0x0) : return 0x007E;
        case(0x1) : return 0x0030;
        case(0x2) : return 0x006D;
        case(0x3) : return 0x0079;
        case(0x4) : return 0x0033;
        case(0x5) : return 0x005B;
        case(0x6) : return 0x005F;
        case(0x7) : return 0x0070;
        case(0x8) : return 0x007F;
        case(0x9) : return 0x007B;

        case(0xA) : return 0x0077;
        case(0xB) : return 0x007F;
        case(0xC) : return 0x004E;
        case(0xD) : return 0x007E;
        case(0xE) : return 0x004F;
        case(0xF) : return 0x0047;
        default   : return 0x0000;
    }
}

Constraints

#FPGA Board v2.2 I/O constraints for User I/O Devices
#
# 8 LEDs directly controlled using the FPGA I/O pins (D10, D11, D13,
# D14, D18, D19, D20, D21)
NET LED<0> LOC = N24 | IOSTANDARD = LVCMOS25; #RED D11
NET LED<1> LOC = N20 | IOSTANDARD = LVCMOS25; #RED D14
NET LED<2> LOC = L18 | IOSTANDARD = LVCMOS25; #RED D19
NET LED<3> LOC = N18 | IOSTANDARD = LVCMOS25; #RED D21
NET LED<4> LOC = M18 | IOSTANDARD = LVCMOS25; #GREEN D10
NET LED<5> LOC = M25 | IOSTANDARD = LVCMOS25; #GREEN D13
NET LED<6> LOC = N19 | IOSTANDARD = LVCMOS25; #GREEN D18
NET LED<7> LOC = P19 | IOSTANDARD = LVCMOS25; #GREEN D20
#
# 5 pushbuttons arranged a cross orientation.
NET PUSHB_CENTER LOC = L23 | IOSTANDARD = LVCMOS25;
NET PUSHB_DOWN LOC = M21 | IOSTANDARD = LVCMOS25;
NET PUSHB_LEFT LOC = N22 | IOSTANDARD = LVCMOS25;
NET PUSHB_RIGHT LOC = M23 | IOSTANDARD = LVCMOS25;
NET PUSHB_UP LOC = N23 | IOSTANDARD = LVCMOS25;
#
# 4-bit DIP Switch (SW5)
NET DIPSW<0> LOC = M17 | IOSTANDARD = LVCMOS25;
NET DIPSW<1> LOC = R18 | IOSTANDARD = LVCMOS25;
NET DIPSW<2> LOC = P17 | IOSTANDARD = LVCMOS25;
NET DIPSW<3> LOC = M16 | IOSTANDARD = LVCMOS25;
#
# 2 IO Expanders that control the three hex displays (D30, D31, D32) and
# and 8 additional LEDs (D16, D17, D33, D34, D35, D36, D37, D38)
NET HEX_SDA LOC = AL18 | IOSTANDARD = LVCMOS33;
NET HEX_SCL LOC = AK17 | IOSTANDARD = LVCMOS33;