Table of Contents

Using Constraint Files (XDC)

A Xilinx Design Constraints file or XDC file is needed to interface between your SystemVerilog modules and the NEXYS 4. It hooks up the inputs and outputs of your module to pins, buttons, LEDs, switches, etc. on the board. An XDC file is required to generate configuration bit file.

An XDC file is simply a TCL file with TCL commands. These TCL commands add properties to the ports of your SystemVerilog file (properties that indicate where the port should be hooked up). The file is then executed before bitstream generation so that these properties are attached to the design.

To add an XDC file to your project, follow the Adding a Constraints File to your Project tutorial.

Mapping Pins to Ports

Most of the commands in a constraint file simply assign pin locations to top-level ports. Your XDC files will have many commands that follow the format below.

set_property -dict { PACKAGE_PIN <PIN_NAME> IOSTANDARD LVCMOS33 } [get_ports { <PORT_NAME> }];

You will need to make sure that the <PIN_NAME> and <PORT_NAME> match for every top-level port.

The following example command demonstrates assigning the A port of a Verilog design to pin J15 on the FPGA. Below is explained each part of the command.

set_property -dict { PACKAGE_PIN J15 IOSTANDARD LVCMOS33 } [get_ports { A }];

The set_property command is used to attach properties to design elements. Type help set_property in the TCL console to learn more. Two options are being passed to this command, -dict and get_ports. These are explained in further detail in the following sections.

-dict

This argument provides a dictionary set of name/value property pairs all in a single command. In this example, two pairs are being added to the port:

Property Name Property Value
PACKAGE_PIN J15
IOSTANDARD LVCMOS33

get_ports

This argument actually executes the command get_ports{A}, meaning find the top-level port named A. The result of this command is used as the second argument of the set_property command, allowing it to connect the pins from dict to the ports in get_ports.

Master XDC file

Creating XDC files is tedious and repetitive. To make things easier, you're provided with a master XDC file that contains the all XDC constraints for each pin on the NEXYS4 that you will use in these labs.

Rather than typing in all of the constraints, you can copy this file for each lab and modify it as needed. You need to perform these two steps to modify the master XDC file for your top-level design:

  1. Uncomment the lines in the XDC file that correspond to pins that your design uses. Do this by removing the # character at the beginning of the line.
  2. Modify the port names to match the top-level input and output ports of your design. Do this by changing the values inside the curly braces {} of the get_ports { } portion of the command.

TA Feedback