Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Beginner lost

Hi, my name is Onofre Garrido and I'm currently working for a company called MECWINS. We have developed some prototype devices to test biological parameters. So far since we are on prototype stage we have built our devices around daq cards from N.I,, labview software and dedicated PC to manage all the components. Our last device uses a matlab software running on several pc cores in order to process images.

My current work focus is on exploring the possibility for using fpga's instead of dedicated pc's for instance in our last device. My knowledge about fpga’s is quite limited so now I think I need some support in order to go in the proper direction.

I have seen for example that there are several softwares to convert matlab code to vhdl that could be potentially implemented on a fpga, but many doubts come up to my mid. How would be the interface for the fpga to be connected to the external world, for example to open a file in any kind of data format? What kind of fpga do I need for processing images? how to interface with the daq world, for example to receive signals from a PSD ...?

May be we need a development card that surround a fpga with kind of peripheral hardware such memory, A/D converters, etc..

I've got a DEO-nano board that I am currently testing in order to get into the fpga world, but I need some support for sure.

I know that perhaps this mail is a crazy mix of probably not well digested ideas. Sorry for that.

Thank you in advance for your support.i

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    your answer is really helpful, as well as the previous one.

    what do you think would be a good test bed set up for a starting point? Let's say that the starting point would be just receive a image file as an input and producing as an output any kind of basic calculation based on the image data. No real time. Just one single static image processing.

    I assume that using the DE0 nano ( no Soc) would entail the design of the comms with the pc and the file reading from scratch, so Deo-nano-Soc would be a better choice, isn't it? Would be OPenCl aplicable as well to simplify this ?

    kind regards and thank you again
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    With hardware you already have, you have a couple different ways you can go.

    1) NIOS + C software in board + your custom IP component doing your math. See: https://www.altera.com/support/support-resources/design-examples/intellectual-property/embedded/nios-ii/exm-hardware-tutorial.html

    Your NIOS C software can include the "Host Based Filesystem" so your C code can use <stdio.h> to open your file, read some binary data, write it to your custom IP component math block, read the result back, write the result to binary file.

    If you are OK with C on an embedded processor, this path works fine and the FPGA on your board has enough resources to go down this road at least for beginnings.

    2) TCL script + Altera System Console + your custom IP component doing your math. See this user contributed tutorial: http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial

    If you aren't OK with C on an embedded processor, you can use TCL on the PC to read your binary file, write the inputs, read the results, write the results to binary file.

    You have almost all the FPGA resources available for your processing and you don't have to familiarize yourself with NIOS IDE for software development.

    I do not believe OpenCL is supported targetting the board you already have. See this document for supported development boards: https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/products/software/opencl/opencl-dev-kit-guide.pdf

    Creating your own IP component, there are several tutorials. Here is one video: https://www.youtube.com/watch?v=v6rhbvablo8

    Another thing you can do, if you go the NIOS route, is work with Custom Instructions instead of Avalon-MM Slave based peripheral components. Either way is fine for getting started, but Custom Instructions aren't really applicable going forward to a ARM SoC future.

    Custom Instructions are a good fit sometimes if you have a body of C/C++ code which compiles and runs fine on the NIOS - depending on what you're doing you can then get huge gains in performance by pushing kernels of your image processing down to hardware.

    Coming from Matlab though and not having a background in FPGA development, you will probably get better trade off [more automation/tool support] investing in the OpenCL route.

    Finally: Altera has some good online [free] training videos that if nothing else will walk you through the basics of many things.

    https://www.altera.com/support/training/overview.html

    https://www.altera.com/support/training/course.html?coursecode=odswbecome

    https://www.altera.com/support/training/course.html?coursecode=oqsys3000
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Really appreciate your answers. I'm learning actually more in several answers than struggling looking into the documentation I have.

    I'll study your answer in detail. Now is too late in Spain to be at work.I'll be back tomorrow.

    Thank you again
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    HI again,,focusing on the OpenCl and trying to figure out your statement:

    And your development might go like: cleanup Matlab and translate to OpenCL entirely on PC, figure out what OpenCL functions you want pushed into the FPGA vs. kept in software on the ARM side of your SoC.

    I'm trying to understand how would be the way to start with just a very basic example ( as I said , open a file , read its content in a sort of array, proceed with simple calculations and return a value) :

    If I understood properly the approach would be something like this.

    Getting an OpenCl compatible fpga develompent Board with SoC.

    Install this OpenCL software on the Pc

    An then....

    would be the section of the code for handling the file written in the OpenCl too?

    Would OpenCl handle as well the control of what will be executed on the ARM and what in the FPGA?

    a bit confused on the way to proceed for going on thath direction.

    Thank you in advance again
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    https://www.altera.com/products/design-software/embedded-software-developers/opencl/developer-zone.html

    In the left margin, click on "Design Examples" and pick one that looks relevant (Vector Add ?) and skim through it.

    OpenCL applications have two parts: the host (ARM SoC Linux application) and the device (FPGA logic).

    The general idea is your host side Linux application would load and prepare buffers from files, ship them to the FPGA kernel for execution, receive the result, and store the buffer back in files.