uint8 vs. double in Simulink

13 visualizzazioni (ultimi 30 giorni)
Owen
Owen il 30 Ago 2012
Hi,
Some blocks in Simulink supports several output formats. Is it better to set it as unit8 for byte based data rather than double? I remember such way is recommended for VHDL programming.
Thanks Senmeis

Risposta accettata

Mariano Lizarraga
Mariano Lizarraga il 30 Ago 2012
Hello Owen, Your question is somewhat generic. For instance, if you are using a source, say a constant, and you expect it to be a uint8 then that would be fine. But if you are doing an operation, say an addition, with two double signals then I would strongly advise you against having the add block output anything other than the input signal types. It can lead to hard to find bugs and also the MISRA Autocode Design Guidelines for Simulink and Stateflow http://www.misra.org.uk/Publications/tabid/57/Default.aspx#label-ac-slsf Rule ID 003 requires you not to do that, literally it reads:
"Only the DATA TYPE CONVERSION block must be used where signal data type conversion is required, i.e. data type conversion must not be performed by any other Simulink block, e.g. gain, product, divide, sum, inport, outport."
Hope this helps.

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by