Basic Entry & not About this tutorial This tutorial consists of an introduction to creating simple circuits on an FPGA using a variety of methods. There are two ways to create the circuit: using or by using. You have to do both of these methods, one at a time. For the method, you can either add a pre-existing file or create a new file using the wizard. You only have to use one of these methods. How to use this tutorial This tutorial consists of several steps broken down over multiple slides. Read each slide carefully and then press Space, scroll down or click the Forward arrow to advance the slides. Also pay attention to things highlighted in green, these are usually important.
Basic Entry & not In this Lab exercise, we will design a 2-to-1 multiplexer (MUX) using the following two types of design entry: 1 using ISE (Xilinx Corp.) 2 entry using any text editor After design entry (either schematic capture or entry), ModelSim (Mentor Graphic Corp.) will be used to simulate and verify the design (with debugging performed as needed). After the design is fully verified, we will use ISE to synthesize the design into a Spartan 3 FPGA configuration data file which will then be downloaded onto a Spartan 3 printed circuit board (PCB) where the implemented design will be verified.
Basic Entry & not The 2-to-1 multiplexer has three inputs (two data inputs and one select input) and one data output. Data Inputs: Din0, Din1 Select Input: Sel Data Output: Dout Logic Function: when Sel=0, Dout=Din0 when Sel=1, Dout=Din1 Boolean Logic Equation: Dout = Din0 * Sel + Din1 * Sel
Basic of this Lab Basic Entry & not 1 Create a new project using ISE Click here 2 Create circuit using one of the following: capture using ISE Click here file Click here 3 Simulation using ModelSim Click here 4 Synthesize design to an FPGA Click here 5 and verify design Click here
Basic Click the start menu, and type in Project. Then look for 64-bit Project Navigator and click on it. Entry & not
Basic After ISE is launched, we will create a new project in File... Entry & not
Basic Entry & not IMPORTANT For lab sessions it is highly recommended that the project directory be on a flash drive or the C: drive (and not your H: drive) to maximize performance during synthesis and simulation. Furthermore there are known problems with using the H: drive. Backup your project to the H: drive if you must after you finish the lab. Again Should you fail to observe this, and use the H: drive to store your lab, and problems ensue, I will not be helpful. To be honest I will laugh at you.
Basic Entry Create a new project under the directory C:\TEMP\ or another directory of your choice, and give the project a descriptive name such as Lab0. Also set the Top-level source type: to HDL if your are using or if you are using. Click Next. & not
Basic Entry The Spartan 3 Starter Kit PCB board uses a Xilinx Spartan3 XC3S200 FPGA chip which is packaged in a flat thin 256-pin (FT256) Ball Grid Array, so make the following changes highlighted in green. Make sure you select -SE Mixed as well. Click Next when you re done. & not
Basic The next page displays a summary of the new project. Click Finish when you re done to exit. Create circuit Entry & not
Read carefully Basic Entry & not of the following 1 Click here 2 Click here
in ISE Basic Now we create a blank sheet for schematic capture. First, click Project New Source... Entry & not
in ISE Basic Click in the left frame and type in the name for your schematic, for example mux21. Entry & not
in ISE Basic This summary page is displayed and we can click Finish. Entry & not
in ISE Basic Your file should be open by default. Click Symbols in the row of tabs, highlighted in green below, to begin placing components. Entry & not
in ISE Basic Here we have selected an and2 gate and placed it neatly on the sheet. Entry & not
in ISE Basic Entry & not A Helpful Suggestion Being neat and placing your components with ample space surrounding them will save you a lot of trouble. It will make things easy for the auto-router, which will make things easy for you.
in ISE Basic Entry Repeat the previous operations until all components are placed on the schematic. In this example, we will use two AND2s, one OR2 and one INV. & not
in ISE Basic Select the add wire icon to begin connecting all components with wires. Entry & not
in ISE Basic Entry To connect two components with a wire, left click mouse on the start point and then left click mouse on the destination point. Note the crosshairs, and only click if you see them. & not
in ISE Basic Entry & not A Helpful Hint If you ve placed the parts neatly with enough space between components, the autorouter should handle all connections neatly. You will still need to add atleast three wires manually, so don t worry if the autorouter fails to work properly.
in ISE Basic Your circuit should end up looking like the circuit below Entry & not
in ISE Basic Entry You will still need to manually add three wires for your inputs. Just left click an input and then move the mouse to the left and double-click. Do this for all three inputs. & not
in ISE Basic Select the add marker icon, then move the mouse over an input/output look for the crosshairs and click. Do this for all 4 inputs/outputs. Entry & not
in ISE Basic Entry Your circuit should look like below. Note the direction of the marker arrows. & not
in ISE Basic Entry Change the names of the markers to something more descriptive by double-clicking on them. You can also do this to the internal connections, but this is not necessary. See next slide for the names of the inputs and outputs. & not
in ISE Basic Make sure you use the following labels on the markers. Entry & not
in ISE Basic Click the Check icon. If you were neat and careful, it should pass. Save your work and proceed to Simulation. Otherwise fix every error and do not proceed until it passes. Onto Simulation Entry & not
Basic Entry & not Read very carefully Choose ONE of the following methods to add the multiplexer file to your project. 1 Add a pre-existing file to the project Click here 2 Create a new file and edit it Click here
Add an existing file Basic Open Notepad, enter the following code and save the file as mux.vhd. Make sure that Notepad doesn t automatically add.txt to the end of it. Entry & not
Add an existing file Basic Entry Click on Project Add Copy of Source... This helps keeps things neat and in one place. Add Copy... uses the file in its current location, which may be anywhere. & not
Add an existing file Basic Look for your file and click Open. It should now be added to the project. Onto Simulation Entry & not
Add an existing file Basic Click on Project New Source... Entry & not
Add an existing file Basic Select module and give the file a name. Entry & not
Add an existing file Basic Add the port names and directions as shown. Entry & not
Add an existing file Basic Click Finish to exit the wizard. Entry & not
Add an existing file Basic Add the following line of code. Dout <= (Din0 and not Sel) or (Din1 and Sel); Save the file and proceed to Simulation. Onto Simulation Entry & not
with ModelSim Basic Entry Choose Simulation mode in the tab, and select the your file. Then expand ModelSim Simulator double-click Simulate Behavioral Model. Alternatively you can right-click as shown and select run.? & not
with ModelSim Basic The following ModelSim window should pop-up. Entry & not
with ModelSim Basic Entry & not We will force the inputs and observe the output. By comparing them with the desired output we can verify that the circuit is working properly. We will test all possible input combinations, and observe the output for each combination. Important This is called exhaustive testing and it is not practical for larger circuits, generally circuits with 6 or more inputs.
with ModelSim Basic Entry & not The basic force statement format is: force signal-name state-value time For example: force Din0 0 100, 1 200 means signal Din0 is forced to logic 0 at 100 time units and is forced to logic 1 at 200 time units. Enter the following commands in the console.
with ModelSim Basic Entry & not Now enter the command run 400 This command runs the simulation for 400 time units, by default ns. Observe the output waveform and look for the expected Dout values for all possible inputs of Din0, Din1, and Sel.
with ModelSim Basic Entry We can use the GUI to force signals by right clicking on the signal name and select Force. Below is an explanation of the dialog that pops up. Note that this also prints the force command in the console window. & not
with ModelSim Basic Clocking is useful for periodic signals, such as clocks. Right click on a signal and select clock. Below is the dialog with explanations of the options. This also prints the command in the console window. Entry & not
with ModelSim Basic Entry We can save console commands to a file and then tell ModelSim to run the contents of the file. Save the following to a file called mux.do. Make sure Notepad does not automatically add a.txt extension. & not
with ModelSim Basic Click Tools Tcl Execute Macro Entry & not
with ModelSim Basic Look for your mux.do file and click Open to run it. Entry & not
with ModelSim Basic Entry & not WARNING If you observe any incorrect results during simulation, go back and debug your circuit. Do not under any circumstances proceed any further. LEGAL AGREEMENT I verify that I have simulated my circuit properly to the best of my knowledge, and in the event that problems ensue due to improper simulation of my circuit, the GTA at his sole discretion may laugh at me and/or refuse to help me and my partner I agree
Synthesize Basic Select Implementation mode, then select the file to be synthesized and the double-click on Synthesize. You can also right-click on Synthesize and select Run. Entry & not
Synthesize Basic Entry & not We need a constraints file to ensure that inputs and outputs go to the desired pins. Final Warning If you have stored your project on the H: drive, this step will fail every time. Make sure your project is not stored on the H: drive.
Synthesize Basic Select Project New Source... Entry & not
Synthesize Basic Click Implementation Constraints File in the left frame and type in the name for the constraints file, for example mux21. Then click Next and Finish. Entry & not
Synthesize Basic Entry Double click on the I/O Pin Planning (PlanAhead) - Post- under Under Constraints to launch PlanAhead. For future reference you can just skip the previous two step and ISE will automatically offer to add a constraints file to the project. & not
Synthesize Basic Click on Din0, enter F12 as the pin and click Apply to make the changes permanent. Entry & not
Synthesize Basic Entry Make sure you constrain all inputs and outputs as shown below, highlighted in green. Make sure to save your constraints, and then exit PlanAhead. & not
Synthesize Basic Now double-click on Implement to use your constraints. to FPGA Entry & not
and Basic Connect the 5V DC power cable to the power input on the demo board (J4). Entry & not
and Basic Entry & not A Helpful Hint If you see a series of numbers and flashing lights, don t fret. This is just a test configuration stored in the flash memory on the PCB and you can manipulate the various switches and buttons to see what happens. Another Helpful Hint You can zoom in and out with F7 and F8 to make it easier to place the components.
and Basic Connect the download cable between the PC parallel port and the demo board (J7). Carefully note the position of the label on the cable. Entry & not
and Basic Double-click on Generate Programming File. Entry & not
and Basic Double-click on Configure Target Device. Entry & not
and Basic Click OK on the dialog box that pops up. Entry & not
and Basic Double-click on Boundary Scan. Entry & not
and Basic Click on the Initialize Chain button. You will learn more about Boundary Scan later on in. Entry & not
and Basic Entry Click on Yes to assign the Programming File you previously generated to the FPGA. & not
and Basic Find the Programming File, it should have a.bit extension, and click open. Entry & not
and Basic Click Bypass on the next dialog box. Entry & not
and Basic Click OK on the next page. Entry & not
and Basic Double-click Program on the left hand side and look for the words Program Succeeded to appear on the bottom. If it fails, try again. If it fails more than three times, call the GTA. Entry & not
and Basic Entry That s it, you re done. Play around with the circuit and see if it works. If it does call the GTA and show it. If it doesn t, try and figure out what s wrong if it doesn t work as expected. When you re done, close impact and click No on the dialog box. & not
Common Basic Entry & not Click Here Click Here Click Here
Basic Entry & not The above is a harmless dialog box that may pop up, click No and go on your merry way. Return
ModelSim not Basic Entry & not The above means that ISE can t find, so you have to tell it where it is.
ModelSim not Basic Go to Edit Preferences Entry & not
ModelSim not Basic Enter the location highlighted in green in the Integrated Tools menu, or use the... to find graphically. Return Entry & not
Basic Entry & not ModelSim wants to associatiate itself with.vhdl files. I d recommend you click No. Return