Electronic – Different ways of using DSP slices in Spartan 6 FPGA

dspfpgahdlxilinx

I am reading the Spartan 6 DSP slice user guide, and I need to use the DSP slice in a project of mine.

I stumbled upon this question, which basically suggests 3 ways of using the DSP slices

  1. Inferring the DSP slice
  2. Using Core generator
  3. Using the RAW DSP instantiating template

The second option is almost self explanatory, but I somehow don't feel like using it, since it feels somewhat superficial. I am interested in using the first and third options, since those options are the most customisable, but I am having a hard time understanding where to start.

These are the questions I have on my mind :

  • What are the different ways in which you can infer a DSP slice in your design ?
  • Where do I find the RAW DSP instantiating template? I have been googling for it, but I didn't find a definitive guide to it.
  • Building up on my second question, there are a lot of xilinx documents one can read to get information on a lot of things. Since I am a noob, I always get confused about what to read, and I always like to have a mindmap of what all is out there, and so what options I have. Is there a place where all the xilinx documents with their description are listed, or what all documents I can refer for a particular application ?

Best Answer

Inferring DSP slices is actually pretty straightforward. The Spartan 6 has DSP48A1 DSP slices, so take a look at Xilinx UG389. Page 15 has a block diagram of the DSP slice. XST is quite good about inferring DSP slices. Just make sure to get all of the pipeline registers in there for maximum performance, and make sure all of your bit widths are no wider than those shown on the block diagram. Here is a simple multiplier with AXI stream interfaces that infers a DSP slice on a Spartan 6: https://github.com/alexforencich/verilog-dsp/blob/master/rtl/dsp_mult.v .

Also take a look at the XST user guide, ug627, pages 98-121. One rather annoying thing to note: the pipelined multipliers in that section will not synthesize to completely pipelined DSP48 slices (they will probably infer slices, but you will get a performance penalty as the registers will not necessarily be in the correct locations). For example, the coding examples and block diagram on pages 104-108 all show a multiplier with one pipeline register before and three after. When I first looked at that, I assumed that XST would be smart enough to move the registers to match the actual DSP slice (it is possible to move registers "through" the multiplier without changing the operation). It isn't. You should add registers (with only synchronous resets!) exactly as shown in the DSP slice manual in order for XST to infer a DSP slice properly with the pipeline registers in the right places for maximum performance (note that this registers are implemented internally in the DSP slice; adding all of the pipeline registers shown in the DSP slice user guide will only result in a latency penalty - they will not consume fabric flip-flops). I would recommend printing out the DSP slice block diagram and tacking it up on the wall as a reference. And also don't forget to look at the synthesis logs to make sure the DSP slices are pulling in the pipeline registers correctly.

As far as a listing of documentation, there isn't one good place for everything (FPGAs, IP cores, software, etc.). For just the features of a single FPGA, take a look at the product page. For example, http://www.xilinx.com/products/silicon-devices/fpga/spartan-6.html#documentation . Make sure to select 'user guides', not 'datasheets'. That should give you a pretty comprehensive list of the Spartan 6 documentation.