Tutorials‎ > ‎Mojo FPGA Tutorials‎ > ‎

Creating a Mojo Project (Brief)

This tutorial was made for the Mojo v3 board using Xilinx ISE 14.6 on Windows 7.

Important: Before following this tutorial, make sure you have your development environment set up properly. The guys at Embedded Micro do a much better job describing this process than I could. See their tutorials at:


This tutorial teaches you to make a barebones Xilinx ISE project compatible with the Mojo FPGA development board.

The final code will toggle an LED with the push of the Reset button on the board.

Creating the Project

  1. Open ISE Design Suite
  2. Go to [File --> New Project...]. Give the project a name and location on your machine.
  3. The working directory can be the same as the project location, though I prefer to make it a subdirectory to keep the project folder cleaner.
  4. Enter a description, if you wish.
  5. Select Next.

The next window allows you to enter information about the hardware you are targeting.

  1. Family: Spartan6
  2. Device: XC6SLX9
  3. Speed: -2
  4. Preferred Language: This tutorial uses Verilog.
  5. Click Next, then Finish.

Adding a Source File

  1. To add the first source file, navigate to [Project --> New Source...]
  2. Select Verilog Module on the left
  3. Give the source a name, and place the file in a subdirectory if you wish.
  4. Click Next.

Every module has a number of ports that provide input and output, similar to parameters and return values of a function in a language like C or Python. We define these now:

  1. RESET_N will be an input
  2. LED will be an output
  3. To complete the source file, click Next, and Finish.

Modifying the Code

The reset button on the Mojo board generates a HIGH voltage when the button is unpressed. So, to get the LED to turn on when the button is pressed, we will need to invert the signal from the button. To do this, we use the "~" (NOT) symbol.

In Verilog, the "assign" command is used to connect two nets together. So, in order to tie the LED and reset button together, we write the following line:

assign LED = ~RESET_N;

This line goes inside the module (between the declaration and the EndModule line).

Assigning the Pins

ISE needs to know what pins on the FPGA each port in the module is connected to. To do this, we use an additonal file in the project:

  1. Navigate to [Project --> Add Source...].
  2. Choose "Implementation Constraints File" from the lefthand menu
  3. Give the constraints file a name (such as mojo_pinout)
  4. Click Next, and Finish.

Inside the file, we write lines in a special syntax to attach ports to physical pins. For this project, the content of the .UCF file should be:

NET "LED"     LOC = P123;

Configuring ISE

At this point, our code is all set to go. However, we still need to configure a setting inside ISE to make sure we generate the correct output.
  1. Highlight the module in the hierarchy window to the top left of the screen.
  2. In the bottom left, under the "design" tab, right click on "Generate Programming File"
  3. Choose "Process Properties..."
  4. Check the box on the line starting with "-g Binary"
  5. Click OK.

Programming the Mojo

To generate the binary file, first ensure the module file is selected in the file hierarchy. Then, double click on "Generate Programming File" in the bottom left.

Then, open the mojo_loader application, select the binary file from the project, and upload it to the Mojo.

Now, when you press the button on your Mojo, the LED closest to the button should light!

Thank you for following this tutorial. If you have any questions about it, or something didn't work right, don't hesitate to reach out to me from the Contact page! Also, check out the verbose version in case this wasn't enough information for you.