Sometimes I receive emails or direct messages on LinkedIn from readers asking me about where they can find documentation about DSP, FPGA or both together. Unfortunately, I didn’t find webpages where talk about how to make DSP on an FPGA, but there are a several webpages. that I check for some of my posts, with very good content. Also I have in my browser some bookmarks to free books that had help me in many situations. In this post I will tell you where you can find information for your FPGA and DSP project.
When I started to work with FPGA, soon one of my tasks was design and implement filters and regulators. Actually, my final degree project was the design and implementation of a speed control for a DC motor. That project involved the design of filters, in order to acquire the voltage applied to the motor, and the current of the DC motor, which have a high level of noise due to the switching of the bridge. Also, the speed control was implemented using a PI regulator, that is also a kind of digital signal processing. I remember that find information about fixed-point, digital filters, implement filters in FPGA… was a very tedious task. Fortunately, with the help of my teachers I found some interesting documentation about what in that times I have the less knowledge, the fixed-point notation. In order to implement the filters and the regulators I used documentation from microcontroller manufacturers such as Microchip or Texas Instruments.
Then, a year later when I started to work in my current job with FPGA the things was turned interesting. The PI regulator I designed for my final degree project, although it works and follow the speed reference, it was quite unstable, and sometimes, when the error of the regulator was large, the motor produced an overcurrent and the current protection stopped the motor, so for my job, I had to search more information because at that point, even I had designed a PI regulators, I realize that I didn’t know how it worked internally, so I had to find more information about DSP, but this time I needed to know about DSP in FPGA. A quick search now in google about PI regulators in FPGA returns some results, but none of them share an example of HDL code to implement the regulator, or explain the equations of a PI controller. Maybe the most complete result is this application note from Microchip. Assuming that find an HDl example of code is hard task, what I did was to learn how we can transform a $$z$$ transfer function to a Verilog code. I did this in the post where I implement a biquad filter in Verilog. Once you control that, the amount of information you can find in internet is multiplied.
At this point, I said you that there are tons of information, but, where we can find it. A very interesting webpage about DSP is DSPRelated.com. In this page, there is a section of *blogs* with very interesting articles about digital signal processing. One of the authors of DSPRelated is Rick Lyons, who I like very much how explains DSP algorithms. Also, this author wrote a book titled Understanding Digital Signal Processing that I recommend 100% if you design and implement DSP algorithms. Also, there is another webpage from the same organization name FPGARelated, where you can find information about implementations on FPGA of several algorithms.
There are also free books that talks about DSP, for example one that some colleagues recommend me few years ago is DSP Guide. This book can be found in PDF in its webpage. there is one different pdf for each chapter, so you can download only the part you are interested, and it includes pseudo-code of the algorithms. This book i s a good recommendation if you want to implement the algorithms, since it show how to implement filters in a few steps, but it does not explain the algorithms from the scratch. When I check this book, I notice that some information is missing. In any case, is a good book to experiment with your first DSP algorithms.
As you sure know, if we want to design an IIR filter, we have to start (in many occasions), designing the $s$ transfer function. so books that talks about the $s$ transfer functions are also very useful when we have to implement filters in Verilog. The best example of this books is the Linear circuit design handbook, from Analog Devices. Specially, the chapter that talks about analog filter is very good to know the continuous transfer functions of the IIR filters, in order to know how they will respond to different inputs. This is not the only book that Analog Devices give us for free, they have a large collections of books about analog and also digital signal processing.
Until now, we are talk about the design of the algorithms, books and pages where you can find how to design the algorithm, but many times, we will need certain tools in order to apply what we have learnt in the books, obviously you can take a sheet of paper and calculate all with a pen, but honestly, it is not my style. The first tool, and “the tool” for excellence is MATLAB. MATLAB is mathematical software with many toolboxes and applications that allow to design filter and many other algorithms easily. On the other side is its price, which is not elevated if we think that is a tool that allow a company design its products, and receive benefits for each product sold, but they only pay MATLAB once. If you are a hobbyist or enthusiast you are also a lucky engineer!, some years ago MATLAB released MATLAB Home, which allow to acquire a MATLAB license for a reduced price. In my case, I have one of this licenses to write some posts, and with the toolbox that I used the price I paid was around 400 euros, which is a very affordable price. It is true that the amount of packages you can include in your license is limited, but you can acquire toolbox like Control, DSP, Audio for only 30 euros (at least in Spain), so it is a very good choice to start to design your algorithms. If you prefer an open source tool, I have used many times Python with the package Scipy. This package has all the needed tools to implement filters, fft… You can find all the information in the Scipy Cookbook. Finally, the last tool I have used is Octave. This tool have many of the commands that you can find in MATLAB, but some specific commands are not implemented yet. For me, octave would be the third option.
At this point, we already know how to design an algorithm, and how to verify it using some tools, the next is the hardest part, the implementation on an FPGA. I mentioned before that in the network there are no many documentation, but it is no mean that there is no documentation. For example, Xilinx has also some application notes about DSP algorithms, but it is not easy to find them. Fortunately exists ZipCPU, that is a blog where the author writes about many different topics around FPGA. You can find from very detailed AXI4 explanations, and also explanations and implementations of some DSP algorithms in Verilog.
Finally, other blog where you can find information about DSP and FPGA is controlpaths.com. One of the reasons because I started to write this blog, was to have data base of information for myself, and also to share it with anybody. A site where I can navigate to check what I did some time ago, and refresh my memory. I hope at the end of this year make some changes in the blog and include a learning section with basic tips where navigate to find the mathematical development of a single pole filter, or the basics of the fixed point notation,… but this will start in September!