You'll probably have to use HDL coder to create a sub-block with all your detailed processing in, and use the Altera tools to create you a PLL to multiply up your clock. Then build a top-level VHDL or Verilog file with the pins on it. Inside that you can instantiate your PLL and processing logic and wire them together.
It's very rare you can use a tool like HDL coder to build an entire FPGA system, you usually have to use it to create a sub-block.
Yes, there are a few processors powerful enough to run (some) programs written in the MATLAB language directly, replacing a PC.
So far, I only know 4 ways to do that:
If you have a motherboard powerful enough to run Linux, such as as BeagleBone or the Raspberry Pi or the Cubieboard, you could:
- Install the open-source Octave tool, which can understand and execute many MATLAB-language programs directly. "Running Matlab Computer Vision on Raspberry Pi with Linux Octave. Part 1."(a)
- Install the open-source Scilab tool, which can understand and execute some MATLAB-language programs directly.
- Install the open-source FreeMat tool, which can understand and execute some MATLAB programs directly.
Often these approaches either don't bother producing any graphics at all on the embedded system,
or use the open-source matplotlib library that is designed to be easy to use from within MATLAB as well as possible to run on any machine that can run Python -- even machines that can't run MATLAB.
While the Raspberry Pi can run (some) programs written in the MATLAB language using the above approaches,
alas, the Raspberry Pi isn't quite PC-compatible enough to run MATLAB. "MATLAB for Linux on the Pi? No."(b)
If you have some "PC-compatible" (x86 processor) mini-PC,
such as many PC104 and (all?) PCI-104 embedded systems,
or the NUC,
or the huge number of microATX and smaller motherboards,
you could use any of the above options, or you could also:
- Install MATLAB for Windows or MATLAB for Linux. "MATLAB for Linux system requirements"(c) (d) "Install Matlab in Linux" (e)
alternatives that don't quite meet that criteria
You probably already know that "running MATLAB code directly on a stand-alone microcontroller" is not that popular; other approaches include
- Using MATLAB to develop Simulink models that run as stand-alone applications. "Raspberry Pi Support from Simulink" (f); "Run Simulink models on ... Arduino ... BeagleBoard ... Gumstix ... Raspberry Pi ... LEGO Mindstorms ..." (g) "Raspberry Pi Programming using Simulink"(h) (i) "MATLAB / Simulink on BeagleBone Black"(j) "Rapid BeagleBoard Prototyping with Matlab and Simulink"(k)
- running MATLAB code on a PC that communicates back and forth with a microcontroller, to do things that neither one could do alone. "the MATLAB Support Package for Raspberry Pi Hardware"(l); "ThingSpeak Support from MATLAB ... with Arduino"(m)
- Use MATLAB to try out a bunch of high-level algorithms and use that implementation to estimate how much RAM and processing power it needs, then later re-implement those algorithms from scratch to run stand-alone on practically any microcontroller with at least that much RAM and processing power. (Typically in Forth or C or C++, since practically every microcontroller has a compiler for those languages and hardly any other languages).
Best Answer
My experience of Matlab to HDL (using AccelDSP which Xilinx then bought) has not been that great. One of my problems has always been that Matlab didn't offer any pleasing way to instantiate a module (entity in VHDL terms, object in OO terms) more than once if it had state inside. You had to pass the old state in as a parameter and the new state would come out as a result. ugh. Now it may be that Matlab's newer OO syntax is supported by HDL coder, but I'm betting not, as all HDL tools seem to limit dramatically what parts of the language you can use.
Simulink is a slightly different matter - if you use the Xilinx System Generator environment, you can use all the power of Matlab in the verification side of things, and the FPGA end is limited to what XSG provides you with blocks for - most of which are very low-level and efficient. I found it was all a bit too low-level though and creating parameterisable IP blocks was a right pain, so I went back to VHDL. I do miss being able to just call
imread
on any old image file from my testbench though!Your area of concern regarding "fetching an image file" should ring alarm bells. FPGAs are almost always used for on-line image processing (ie taking an image from a camera in real-time). To do this you will need to understand how the pins of the imager chip (or whatever your real-time data source is) operate, and write code to interface to them.
As someone else said, if you have a big, fast FPGA, are only making a few systems, and are up for the learning curve (there's a lot more to FPGAs than just pressing the compile button... unlike with software), then go for it. Otherwise, you can use your Matlab as a specification to someone skilled-in-the-art.
In fact, I've used Matlab as both spec and source of test-data in the past... develop an algorithm in Matlab (with FPGAs in mind, but not coding in an FPGA-like way). Use this to create test data with golden results (exported as VHDL files). Then create a VHDL model which behaves bit-accurately the same as the Matlab (as checked against the golden reference data). I've found this much more productive (even with only one of me) than using "magic" HDL generators :)