Forum Discussion

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

matlab to nios ide

Hello,

i am facing a problem in converting matlab code into nios ide. is there anyway to convert these code into C/C++ used in nios ide? My matlab code is regarding image processing. is there any reference for this part?thank you.

regards,

Liau

4 Replies

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

    You need to rewrite into C code your m-script code.

    Did you use MATLAB functions like imfilter? In that case the work is harder, and it would be necessary to write this code in C.

    try using mcc -m 'your_file.m' in MATLAB
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Am fairly sure that the MATLAB compiler won't produce any code useable with NIOS. I'm a little out of date, I'll admit, but it used to just generate lots of calls to MATLAB library functions. Almost certainly not what you want. You would also need to have a MATLAB compiler license.

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

    I'm afraid you have to re-write the code. :(

    But don't worry, it's not so complicated...

    Cheers

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

    --- Quote Start ---

    Hello,

    i am facing a problem in converting matlab code into nios ide. is there anyway to convert these code into C/C++ used in nios ide? My matlab code is regarding image processing. is there any reference for this part?thank you.

    regards,

    Liau

    --- Quote End ---

    There is no direct conversion. But there are ways which can lessen your burden:

    1. Write a C code that can be used both in MATLAB and NIOS with some changes: For MATLAB, write a mex file and for NIOS, modify the C-code with NIOS specific constructs. A simple code may not reuire much change for NIOS but a complicated one would need complete restructuring.

    2. Codes that need RTOS will have to be completely rewritten for NIOS and MATLAB.

    3. Or you can write a code in MATLAB, use its Link to ModelSim feature to convert it to HDL and then use it as an HDL component in SOPC Builder.