The XS-40 board connects all eight data lines from the parallel port to the FPGA. The lower six data lines (Bits 5 to 0) connect to standard FPGA I/O pins. The upper two data lines (Bits 7 and 6) connect to two FPGA “mode” pins. This arrangement allows the PC to control the FPGA operating mode, and is necessary to allow the PC to download the configuration bitstream into the FPGA. The mode pins can be used as inputs for your system, but they must be handled differently. The technique used here instantiates device-specific hardware to access the mode pins as inputs. Verilog “wires” are used to establish the connection to the mode pin hardware. Once this has been accomplished, the “wires” can be used as you would conventional inputs.
Step 1: Declare four “wires” as follows:
wire MD2PadToBuffer, MD0PadToBuffer;
wire MD2, MD0;
Step 2: Instantiate the device-specific hardware for the mode pins, and connect the “wires” to the hardware:
MD2 Mode2_Pad (.I(MD2PadToBuffer));
IBUF Mode2_Buffer (.I(MD2PadToBuffer),
.O(MD2));
MD0 Mode0_Pad (.I(MD0PadToBuffer));
IBUF Mode0_Buffer (.I(MD0PadToBuffer),
.O(MD0));
The wire MD2 corresponds to Bit 7 of the parallel port, and wire MD0 corresponds to Bit 6 of the parallel port. Thus, you can use MD2 and MD0 as inputs to your system.
You may find it more convenient to create a single eight-bit bus for the entire parallel port. In addition to the two steps above, do the following:
Step 3: Declare a six-bit input bus for the lower six parallel port bits:
input [5:0] LowerPPort;
Step 4: Create an eight-bit bus for the entire parallel port
assign PPort = {MD2, MD0, LowerPPort};