HDL Coder: Problems with saturation after a product block with divide

11 vues (au cours des 30 derniers jours)
Roland
Roland le 21 Mai 2013
Hi,
I'm trying to fix my model so that it works with the HDL coder, but there is one thing i just cannot get working. I have a product block (*/), which divides the first input by the second input and after this product block is a saturation block which saturates it between -1 and 1.
When I check whether the HDL code can be generated it gives the following error:
"Error: Product block with divide input (/) only supports Saturation 'On'".
Should I remove the saturation block and force it to saturate with a matlab function file? Or what would be the best way to get this working?
Thanks in advance!
Kind Regards,
Roland

Réponse acceptée

Tim McBrayer
Tim McBrayer le 21 Mai 2013
I don't think this has anything to do with your Saturation block. The issue lies with the Product block. As the message says, you need to enable saturation on the Product block. This is so the HDL implementation and the Simulink implementation have the same semantics. This saturation is to the data type of the Product block's output port and not to any particular numeric range.
If you need additional saturation to the range [-1, 1], then the following Saturation block is the way to go. Alternatively, if you update your Product block to have an output data type of fixdt(1, n, n-1) for a suitable value of n, you can avoid the separate Saturation block. Due to 2's complement numbers, his will limit the range to [-1, 1); the most positive value will never be able to reach 1.
  1 commentaire
Roland
Roland le 22 Mai 2013
Thanks alot! Enabling the saturation on the Product block worked.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur HDL 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