MATLAB And Simulink For Zynq

Although we see a lot of MATLAB use in industry and in academia, it isn’t as popular in the hacker community. That’s probably due to the cost. If you’ve ever wondered why companies will pay over $2000 for the base product, you might enjoy the video of a webinar covering using MATLAB and Simulink (a companion product) to program the CPU and FPGA on a Zynq Zedboard. Not interested because of the price? If you aren’t using it for commercial purposes, it isn’t as bad as you think.

MathWorks is one of those companies that likes to market by virtually giving away products to students with the hope that they’ll adopt the same tools when they land jobs in industry. Their flagship product, MATLAB, is well-entrenched in the labs and offices of big corporations. We’ve often thought that MATLAB is sort of what FORTRAN would look like if it had been developed in the last 20 years instead of 60 years ago. It is true that a base license for MATLAB is over $2000. However, if you aren’t using it for commercial purposes, and you can’t score a student license, you can get a personal license of MATLAB for about $150. The extra modules are also similarly reduced in price. If you are a student, the price drops to about $100, although many schools have licenses students can use at no cost to them.

If you watch the video from [Noam Levine], you’ll see you get your money’s worth. If you are wanting to configure the FPGA directly, this isn’t for you. But if you just want to accelerate a program by pushing DSP or other algorithms that can benefit from hardware assistance, MATLAB makes it very easy.

The workflow is aimed at a big corporate team, of course. There are requirements and tools for collaborating in a team. Not that those are bad things, even for a hacker project. The philosophy is you build a model using Simulink that looks at the system from a very high level.

A GUI lets you indicate what parts of the model are actually in the FPGA and a wizard takes you through building the HDL that will configure the FPGA. The example project is the prototypical blinking LED, but it is still illustrative of how the tool can help you push functions to the FPGA.

Of course, MATLAB is good for lots of things. We’ve seen it decode radio signals from an RTL dongle. We’ve also seen it crunch data to help patients with spinal cord injuries. Is it worth $2000? Depends. If your time has value and your project is going to make any money, the productivity gains (once you know what you are doing) probably swamp the cost quickly. A few hundred bucks for the personal edition is an even smaller bite, but then again, there’s no return on it since you can’t use it for any money-making endeavor.

If you just need number crunching and you don’t want to blow a few hundred bucks, there are quite a few good open source alternatives including GNU Octave, Scilab (and Scicos), SageMath, and FreeMat. These are all very similar to MATLAB with respect to syntax and base features. Many even can run in the cloud so you don’t have to install anything. But they are probably going to lack the advanced toolkits and features you will find available for MATLAB. Some of them do, however, have some path for FPGA-based development. In particular, Scicos and Scilab can use Scicos-HDL.

13 thoughts on “MATLAB And Simulink For Zynq

  1. No, it ain’t the price. It’s because it’s non-free.

    Yeah, I pay for my things (I even pay for my local newspaper although they put it free on the Web: the fact that they *dare* to not have a paywall was a factor in my decision, actually).

    YMMV, of course.

    1. I believe the cost of the license is actually what led to the development of matplotlib. They were using matlab to plot ECG scans but only had a single dongle (i.e., license). Each researcher had to wait his turn with the dongle in order to plot the data. One guy just got fed up and started developing matplotlib. This is the reason why matplotlib is so heavily influenced by matlab.

  2. I pluperfect LOVE MATLAB/Simulink. In another lifetime, I used to build general-purpose numerical integrators, otherwise known as ODE solvers. I was pretty good at it, and had solvers that could handle multiple discontinuous events (e.g., firing a reaction-control thruster) with no problem.

    I stopped building them when I realized that the most I could hope for was to equal — but never exceed — the performance of the Simulink engine.

    In my column in Embedded Systems Design magazine, I used to maintain a list of Good Guys and Bad Guys –companies that treated me good or ill.

    Mathworks always topped the Good Guys list for two reasons: First, their products WORKED, and worked flawlessly. Second, their tech support people were top of the heap, and whatever question I had, I knew the answer was never more than a phone call away.

    These days, I only have the personal version, but I can still call their tech support folks, and still get the superb service. Definitely Good Guys.

  3. Having had to recently use Scilab and Scicos in stead of Matlab/simulink because my company is too cheap to buy enough Matlab licences I am very much reminded of why I like Matlab so much more. A lot of simple things that should be easy (reading in .CSV or Labview LVM files) are just so much harder in Scilab than they should be. My biggest gripe with Scilab is the lack of documentation. Matlabs Help files are a goldmine on how to do things and how functions work. Scilabs help files basically describe what a function is called. But not what it does or what parameters to use. (Documentation is probably the greatest pitfall of all open source projects. Nobody likes writing the manual so nobody does)

    1. I like Matlab. ( I don’t love anything, but its pretty awesome). Pricey for home use, but was able to pick up a copy in grad school at a student rate and was able to pick up some add on modules at a decent price as well. Even though the student add-ons are not the full blown version, it was money well spent.

      As Engineers, we are sometimes hypocrites. We want our customers to pay fair value for our goods and services (time, intellectual property, etc), but we don’t want to pay others for the same. If you like a persons good or service, try to get it at the best price possible, but also be willing to pay a fair value for that good or service. If you don’t think its a fair value, move on.

      Can I do some of the same things as Matlab with Spyder, Numpy, SciPY? Yep! But there is the time value of money factor. When time is a factor, I want the biggest, baddest hammer I can get. And Matlab is it!

    2. Try Octave instead, maybe. The documentation is better and it’s much more compatible with matlab than scilab. You also have two levels of documentation: help command and doc command. It also got itself a little IDE like scilab, recently.
      Most of the time, you can also use the matlab documentation with octave, too.

  4. MATLAB is good. And the automatic code gen (once set up) can be very good for productivity.

    But you’ve been mislead on prices. To do code gen from block diagrams you’ll need the following licenses:
    – MATLAB
    – Simulink
    – Real Time Workshop (a.k.a. Real Expensive Workshop)
    – probably whatever they call their state machine package
    – possibly the Fixed Point Toolkit
    (as of 3 years ago) this would set you back somewhere around $20,000

    Additionally, when they say ‘compile MATLAB code to C,’ they actually mean ‘compile a subset of MATLAB code that you’ve carefully hard written, taking care to override data types so it doesn’t use float64 everywhere (yes, really, even in switch statements) or perform devastating dynamic memory operations.’

Leave a Reply to Jack CrenshawCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.