05-24-2010 01:46 PM
This question comes up often, so I thought I'd post the Q & A here:
Starting with an algorithm in MATLAB, you have a couple of options for implementation in a Xilinx FPGA.
1. Simulink HDL Coder: The MathWorks offers a tool called Simulink HDL Coder which creates synthesizable HDL from Simulink models and Embedded M-code. This is very useful for quickly evaluating new algorithms in hardware. However, higher performance is achieved by using the Xilinx DSP tools (option 2 below).
2. Xilinx System Generator for DSP: Xilinx offers a highly optimized library of blocks that can be simulated within Simulink and then compiled for FPGA implementation. This tool is called Xilinx System Generator for DSP. It would require you to transfer your design into the Simulink enviroment and replace the Simulink simulation-only blocks with System Generator blocks. This design flow offers higher performance than HDL Coder because each block is pre-optimized IP for Xilinx FPGAs.
3. Manually HDL Coding: The final option is the most manual. Based on your MATLAB algorithm, you would start from the beginning and code up your design in VHDL or Verilog (possibly instantiating Xilinx IP), create an HDL testbench and compair the input/output vectors of MATLAB with your HDL simulator. Engineers have done it this way for decades, but it is a slow and error-prone approach. Like The MathWorks HDL Coder it does have the advantage of yielding an HDL design that is not dependent upon a specific software tool.
4. Synphony HSL: Synopsys has a High Level Synthesis tool (HSL) called Synphony HLS that is advertised to take MATLAB code, quantize it and synthesize HDL code. I haven't yet used this tool so I can't comment on their design flow. It sounds similar to a tool that Xilinx recently discontinued called AccelDSP, which provided a great way to quickly prototype MATLAB algorithms and target FPGA hardware. However, it did not usually yield the highest performance design.
Options #2 and #3 will be your least expensive path in terms of software tool costs and the best way to achieve the highest possible performance.
06-27-2010 04:45 AM
I am currently working on a project which I have to interface with the Xilinx embedded device camera. I am new to Matlab and Xilinx and still learning.
I have written my codes in Matlab in .m file (M-code). But I have no idea how to use blocks in Simulink to interface with the camera to make it a reference design. There are 4 pre-loaded reference designs in the board.
Other than the 4 methods you mentioned above, is there any way which I can use Matlab commands instead to directly interface Matlab with the board and the camera?
Device: Xilinx Spartan 3A DSP FPGA VSK
06-29-2010 12:02 PM
At the moment, the 4 methods I outlined earlier are the only feasible tool flows for implementing m-code in an FPGA.
One possible alternative you could consider is the use of the "Embedded M-code" System Generator Block, which allows you to import embedded m-code and target an Xilinx FPGA. You can find more information about that and other blocks in the Xilinx System Generator for DSP User's Guide.
07-27-2010 03:55 PM
The MathWorks just posted this 3 part webinar series entitled "FPGA Design Using MATLAB and Simulink"
Part 1: From MATLAB and Simulink to FPGAs in Five Easy Steps
Part 2: Advanced HDL Code Generation for FPGAs Using MATLAB and Simulink
Part 3: Target-optimized FPGA Design using MATLAB and Simulink with Xilinx Targeted Design Platforms
01-29-2013 09:28 AM
sorry for resurecting this thread, but I had the exact same question and was just wondering if this methods are still the most current or maybe some new way is better?
I am currently starting to develop a project where I need to do some sound processing on matlab and need to implement on an FPGA, but I dont have a lot of money, so it must be an entry level one.
01-29-2013 02:13 PM
A few things have changes and the story is getting better and better.
AccelDSP from Xilinx has been discontinued. However Xilinx has acquired a High Level Synthesis (HLS) company and has been enhancing the technology to suppor their new Zynq devices. This tool flow allows you to synthesize HDL from C code, quickly making tradeoffs of clock cycles vs. resource utilization. You can read more about it here - Vivado HLS
You may want to consider ZedBoard for your project. It includes a Xilinx Zynq 7020 device along with an audio codec from Analog Devices. More info is at ZedBoard.org. The audio path enables:
09-22-2015 02:10 PM
Would it be possible to get an update of the various methods to convert Matlab code to FPGA, DSP, ARM. I have heard the Xilinx System Generator with the Matlab-Simulink approach is good. How does it compare to HDL Coder approach ?
09-22-2015 04:26 PM
I believe the following video from Mathworks best addresses your questions.
Using Xilinx System Generator with Simulink and HDL Coder:
09-23-2015 10:07 AM
I would also recommend looking through this tutorial on HW/SW co-design for Zynq: