Forum Discussion
Altera_Forum
Honored Contributor
11 years agoLets assume for a moment that you want to solve the general calculation ax^2+bx+c. You need to break it down into what calculations you need to do. Looking at that formula you would need to do the following in order:
(1) Solve x^2 Multiply the result by a. (2) Multiply x by b. (3) Add (1) to (2) Add result to c Now the key thing here is that the bx and ax^2 do not rely on each other to be calculated, so you can do them in parallel - speed things up. The additions once those two are calculated can be done in any order. But if we look at (2) you will see one less step is required to calculate it than (1), so perhaps move the +c in there as it would reduce calculation time. You end up with something like this: https://www.alteraforum.com/forum/attachment.php?attachmentid=9454 In order for the above to work, both the multiply and add modules have to have the same level of pipelining - if you think about it, if half of the calculation is ready one clock cycle earlier than the other, the next stage will be wrong (if you are using pipelining properly!). So create a module containing a floating point addition, and a second containing a floating point multiplication. I believe the addition will be quicker, so you may need to add your own pipelining to the addition block to align it. You will also need to add pipelining to the b[] and c[] variables to delay them to appear at the same time that the first blocks complete. If constructed correctly, you can then keep pumping numbers for all the variables in every clock cycle, and you will receive the result after an amount of time which is 3x the pipelining delay of one of the modules.