Beruflich Dokumente
Kultur Dokumente
Glenn Sweeney
Home
Projects
Tutorials
Photography
Contact
Tutorials
>
Mojo FPGA Tutorials
>
Contents
1 Introduction
2 Creating the Project
3 Adding a Source File
4 Modifying the Code
5 Assigning the Pins
6 Configuring ISE
7 Programming the Mojo
Introduction
The tutorials on Embedded Micro do a very good job with setting up the development environment, but
ex pect you to use a pre-designed ISE project. This document will teach you how to make your own
project from scratch, without relying on the Mojo-Base file that ships with the device.
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
1/10
17/6/2014
The resulting project from this tutorial is not a replacement for the full-featured Mojo-Base project.
However, once you have learned to configure your own project, you will be able to include the parts of
the Mojo-Base code that you would like without problem! Because of this, I still highly recommend
following through the Embedded Micro tutorials. Their tutorials will show you how to use some of the
unique features of this development board, such as the interface to the onboard microcontroller.
2/10
17/6/2014
this case, the Mojo board has a Spartan6-XC6SLX9 onboard. The package used is a TQG144, and the
speed grade is "-2".
You can also choose between Verilog and VHDL in this menu, in the "Preferred Language" field. - this
tutorial uses Verilog.
Once this is all set, go ahead and click Nex t, then Finish.
3/10
17/6/2014
Make sure that the "Add to project" box is checked, and then click Nex t.
In the nex t window, you can define ports. These are the inputs and outputs of your module. For this
ex ample, we are going to create a port for the reset button, and a port for a single LED on the board. To
do so, we will create a port named RESET_N (the _N is to indicate that the port is inverted - that is, the
reset button produces a HIGH signal when unpressed, and a LOW signal when pressed). Make sure this
port's direction is an input.
Then, make another port named LED, and mark it as an output.
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
4/10
17/6/2014
Remember, if you want to double check that your code looks right, you can just click on the screenshot
above.
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
5/10
17/6/2014
Again, check that Add to project is selected, and then click Nex t, and then Finish.
The .UCF file is used to describe a lot of different constraints for your project. ISE provides a variety of
tools and wizards to help you configure this automatically. However, for now, we only need two very
simple constraints, and so we are going to write them in manually.
Attaching a port (or NET, in the file syntax ) to a pin follows the following syntax :
NET "name" LOC = Pn;
where the "name" ex actly matches the port name in the module, and Pn refers to the pin number on the
part. These are labeled on the Mojo board, and additionally are documented in the pinout
specification document for the part , or the package and pinout pdf file available from Xilinx .
However, there is no information on the board or in the documentation for which pins on the FPGA are
already used on the Mojo board!
If you're looking for this pinout information, please see my Mojo pinout tutorial!
However, for this tutorial, we're going to use the switch on pin 38, and the LED on pin 123. So, the
content of the .UCF file will be:
NET "RESET_N" LOC = P38;
NET "LED"
LOC = P123;
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
6/10
17/6/2014
After you've made your .UCF file, make sure both it and the .v file are saved.
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. To do so, first make sure your module file is highlighted in the file
hierarchy in the top left of your screen.
Nex t, in the bottom left, go to the "design" tab, and right click on "Generate Programming File".
7/10
17/6/2014
In this menu, we need to tell ISE to generate a binary file. This file is what we will load into the FPGA
through the mojo_loader application.
To do this, check the box on the "-g Binary:" row under general options. This will enable output of a .bin
file during synthesis.
Select OK.
This process will take several minutes. W hen it is complete, switch to the mojo_loader application you
installed during the Mojo setup process.
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
8/10
17/6/2014
In this application, select the serial port your Mojo is plugged into. Unless you have multiple USB-serial
devices plugged in, there will probably be only one option in this menu.
Then, click "Open Bin File", and navigate to the project working directory folder.
W ith "Store to Flash" and "Verify Flash" checked, click Load, and wait for Done to appear in the bar.
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!
Comentarios
No tienes permiso para aadir comentarios.
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
9/10
17/6/2014
http://www.glennsweeney.com/tutorials/mojo-fpga-tutorials/creating-a-mojo-project
10/10