Forum Discussion

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

Matrix Multiplication optimization

Hello, I am using FPGA EP3C40Q240C8. I have written a code for Kalman filter in which I have to do matrix multiplication and matrix inverse. The problem is that there is no error in my code but Fitter is creating problems for me. the total combinational function of my program is exceeding the maximum combinational function that this device allows. As a result, fitter is unable to place the design. So, I need suggestions how to optimize my matrix code or how to overcome this problem.

13 Replies

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

    For a start, as a beginner, you should never use variables. Like the above code, they just give poor results (because unless you know what you're doing, you just end up with one cominatorial logic chain). Much better to stick with signals.

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

    --- Quote Start ---

    I highly suggest you get a VHDL textbook and read up on how to write VHDL for digital designs. The current code just looks like you're trying to write some software inside a single process. This will not give a very efficient design, as there is no pipelining, so you will only be able to run the design at a very low clock speed (low FMax - max frequency).

    --- Quote End ---

    Thanks for your suggestion. I will look for VHDL book. Can you please explain in a sentence or two about pipelining...what is it??? and why use of signal is much appreciated than use of variables????
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Pipelining is the chain of registers that are inserted into your algorithm to reduce the logic between registers. It increases the latency, but massively increases the FMax. Latency is usually not important, it's the throughput that counts (and throughput increases with clock speed).

    As for signals vs variables: signals are only updated when a process suspends - so in a clocked proecss every signal assignment will become a register. Variables are updated immediately, so the logic that is produces depends on the order of the assignments in the code.

    There is nothing you can do with variables that you cannot do with signals. And as variables can be more unpredictable, usings signals is far safer for a beginner.

    But, I highly recommend you take a step back. Do you have a drawing of how this algorithm will look on hardware? one that you drew before you wrote any code? HDL is a hardware description language - if you dont know what hardware you want, how do you expect to describe it?