Thursday, May 10, 2012

FPGA hello world - Led blink - Part III

  Hello everybody!
 As promissed a century ago, in this post I'll show how to assign pins to our FPGA hello world, aka Led blink, how to generate our bitstream and how to program our FPGA. So let's do it!
  We have two choices:

  1) In menu Tools/PlanAhead - Pre-synthesis or
  2) In the design windows, in User Constraints, just double click in I/O Pin Planning (PlanAhead) - Pre-synthesis In both cases, it will ask you to create an UCF file. Accept it by clicking Yes.



  You'll note a new file helloworld.ucf, double clicking it will open PlanAhead. We can see all ports that we have declared before:
  led(8) - output
  clk - input
  updown - input

  Now it's time to assign pins to signals. In this board we have:

  Led 0 - R14
  Led 1 - C3
  Led 2 - E6
  Led 3 - D6
  Led 4 - D13
  Led 5 - A7
  Led 6 - G9
  Led 7 - A8
  clock - C9
  updown - L13 (switch SW0)

  Here we can see in PlanAhead all pins assigned.



  Note that we have again two options. Using PlanAhead we can click in the Site column and chose which pin to use or ISE, double click in Edit Constraints (Text) and type all constraints. Normally I assing one by PlanAhead and copy the rest in text mode which I think is faster.
  Once done we can implement our design by clicking in Implement Design at Design tab in ISE.


  Now it's time to generate our programming file by clicking in Generate Programming File (durrr). Once done, we click in Configure Target Device which will opens Impact. It will ask you to create a new project file, just click Yes.
  Go to menu Edit/Launch Wizard. Select Configure devices using Boundary-Scan (JTAG) and select our helloworld.bit file. Bypass all 3 others devices. In the next window, check Pulse PROG, click in Apply and OK.


  In the image above we can see that our FPGA is assigned with helloworld.bit and the others 3 device were bypassed. Now right-click over the green FPGA and select Program.
  And it's done! (I really wish that your leds are blinking!!! LOL)
  
  Marcelo


Read more ►

FPGA hello world - Led blink - Part II

  Hello!
  In this post I'll show you how to simulate our hello world design.
  In ISE, in Design tab, select View Simulation as in the image below


  Now we "compile" our design as usual. First we select in Hierarchy our helloworld entity and click first in Behavioral Check Syntax and then Simulate Behavioral Model.


  After click in Simulate, a new program will be launch - ISim.We'll have all signals defined in our design there.

  We select all signals and we add them to wave window. We can drag and drop them or right clicking all selected signals and selection Add to wave window.
  We need to create our clock signal by right-clicking in clk signal and selecting Force Clock. In our case 50MHz has a 20ns period. We set our updown to 0 first and then to 1 to see what happens. Here I also changed blink_freq to 1000000 to be able to show you the results (1 Hz is an eternity for our FPGA). Click in run and that's it!


   We can see that we're decreasing our led value when updown = 0 and increasing when updown = 1. The updown value changes in the blue cursor.

  Next post, I'll show how to configurate our FPGA and finally see our leds blink!

 Bye
 Marcelo
Read more ►