Excessive use of resources by vhdl converted file from MATLAB (HDL CODER)

1 vue (au cours des 30 derniers jours)
Mohammad Rafi Lone
Mohammad Rafi Lone le 25 Août 2014
Commenté : Tim McBrayer le 26 Août 2014
The function that I input to the hdlcoder provided by matlab is of the form function y = add_images(a,b) a = reshape(a,256,256); b = reshape(b,256,256); y = a + b; y = reshape(y,1,65536); the resulting hdl code utilises 65536 adders!!! which is too high,, I want just one adder that adds up the input values repetitively... I mean it should consider just one value for a and b each at a time.... How is that possible??? Please help
  2 commentaires
Mohammad Rafi Lone
Mohammad Rafi Lone le 26 Août 2014
Do U mean like this >> function y = add_images(a,b) a = reshape(a,256,256); b = reshape(b,256,256); for i = 1:256 for j = 1:256 y(i,j) = a(i,j) + b(i,j); y = reshape(y,1,65536);<< It still yield same number of adders... and if we take a,b as one pixel and try to update, we need to initialize the matrices in the function in order to store previous values,,, but I am not able to do so as well....... Thank You for your suggestion sir
Tim McBrayer
Tim McBrayer le 26 Août 2014
I'm sorry that I wasn't clear. If loop streaming does not take effect on your matrix add as originally written, then you need to try loop streaming on the explicit loop version. The code you have written has 64K adders, in either form. HDL Coder needs to be instructed that you want some lesser number of adders, with a corresponding increase in the required clock speed. The way to do this is via the loop streaming feature.

Connectez-vous pour commenter.

Réponses (1)

Tim McBrayer
Tim McBrayer le 25 Août 2014
You can investigate Loop Streaming to see if it will address your issue. If it does not do so using the native matrix '+', you may need to write the nested for loops explicitly.

Catégories

En savoir plus sur Code Generation dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by