Without guidance, the implementation tool will randomly bond your inputs and outputs to pins on the FPGA. This is, suffice it to say, not a very good situation. It's smart enough not to catch the FPGA on fire, but not smart enough to do anything particularly useful. This is where the User Constraint File steps in, here to save the day, like a really boring superhero.
There are four main categories of components that you might be interested in using: clocks, pushbuttons, DIP switches (all inputs), and the LEDs (output). CSE378.ucf is the standard UCF file we'll be using, and it contains all of these that you could possibly want.
To use the logic analyzer, you need to add the following output ports to your design:
The two ground ports MUST BE CONNECTED TO GND!. The LA_TRIG port should be connected to CLK. The other two ports (LA_A0, LA_A1) are for your own use. To connect these on the board, download the CSE378.ucf file and be sure to remove the comments from lines at the end with LA_* in the name.
On the logic Analyzer, the setup file is in My Documents/Left Digilent Expansion Header Cable.tla. This assigns the name opcode for LA_A0(7:2) and PC for LA_A1(7:0). You don't need to actually connect these signals to these pins. This is just the default names for the output waveforms.
SYSTEM_CLOCK
". There is a certain formula which will be reused
for every signal we'll deal with:
LOC
, IOSTANDARD
, and SLEW
.LOC
determines the pin location of the input/output, and
changes to it will render that input/output nonfunctional;
IOSTANDARD
determines the signaling standard on the wire attached
to the pin, and could either render the I/O unfunctional, or cause permanent
hardware damage if set incorrectly (i.e., to anything other than what it's
set to by default); and SLEW
does mysterious voodoo that is more
of an EE thing than anything we need to be concerned with.
SYSTEM_CLOCK
requires (as do the other clocks) a couple extra
steps. See that line about TNM_NET
? Change both mentions of
SYSTEM_CLOCK
to match your own net. In addition, change the
timespec "TS_SYSTEM_CLOCK"
to read timespec "TS_FOO"
,
where FOO
is your net, and change the "SYSTEM_CLOCK
"
later in the line to match as well.
# NET "MGT_CLK_P" LOC = "F16"; # NET "MGT_CLK_N" LOC = "G16"; # NET "EXTERNAL_CLOCK_P" LOC = "G15"; # NET "EXTERNAL_CLOCK_N" LOC = "F15"; NET "CLK" LOC = "AJ15"; # NET "FPGA_SYSTEMACE_CLOCK" LOC = "AH15"; # NET "ALTERNATE_CLOCK" LOC = "AH16"; # NET "MGT_CLK_P" IOSTANDARD = LVDS_25; # NET "MGT_CLK_N" IOSTANDARD = LVDS_25; # NET "EXTERNAL_CLOCK_P" IOSTANDARD = LVDS_25; # NET "EXTERNAL_CLOCK_N" IOSTANDARD = LVDS_25; NET "CLK" IOSTANDARD = LVCMOS25; # NET "FPGA_SYSTEMACE_CLOCK" IOSTANDARD = LVCMOS25; # NET "ALTERNATE_CLOCK" IOSTANDARD = LVCMOS25; NET "CLK" TNM_NET = "CLK"; TIMESPEC "TS_CLK" = PERIOD "CLK" 10.00 ns HIGH 50 %;Now that that's done, more fun is to be had with the other three categories.
In any case, these map to PB_UP
, PB_DOWN
,
PB_LEFT
, PB_RIGHT
, and PB_ENTER
lines
in the UCF file.
NET "RESET" LOC = "AG5"; # NET "PB_UP" LOC = "AH4"; # NET "PB_DOWN" LOC = "AG3"; # NET "PB_LEFT" LOC = "AH1"; # NET "PB_RIGHT" LOC = "AH2"; NET "RESET" IOSTANDARD = LVTTL; # NET "PB_UP" IOSTANDARD = LVTTL; # NET "PB_DOWN" IOSTANDARD = LVTTL; # NET "PB_LEFT" IOSTANDARD = LVTTL; # NET "PB_RIGHT" IOSTANDARD = LVTTL;
These map to SW_0
through SW_3
, with SW_3 on the
left-hand side.
NET "mode" LOC = "AC11"; # NET "SW_1" LOC = "AD11"; # NET "SW_2" LOC = "AF8"; # NET "SW_3" LOC = "AF9"; NET "mode" IOSTANDARD = LVCMOS25; # NET "SW_1" IOSTANDARD = LVCMOS25; # NET "SW_2" IOSTANDARD = LVCMOS25; # NET "SW_3" IOSTANDARD = LVCMOS25;
The user-controllable LEDs, as with the DIP switches, are numbered from right
to left, and are active-low. They map to LED_0
through
LED_3
.
NET "PC[2]" LOC = "AC4"; NET "PC[3]" LOC = "AC3"; NET "PC[4]" LOC = "AA6"; NET "PC[5]" LOC = "AA5"; NET "PC[2]" IOSTANDARD = LVTTL; NET "PC[3]" IOSTANDARD = LVTTL; NET "PC[4]" IOSTANDARD = LVTTL; NET "PC[5]" IOSTANDARD = LVTTL; NET "PC[2]" DRIVE = 12; NET "PC[3]" DRIVE = 12; NET "PC[4]" DRIVE = 12; NET "PC[5]" DRIVE = 12; NET "PC[2]" SLEW = SLOW; NET "PC[3]" SLEW = SLOW; NET "PC[4]" SLEW = SLOW; NET "PC[5]" SLEW = SLOW;