uint8 vs. double in Simulink
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuesta aceptada
Mariano Lizarraga
el 30 de Ag. de 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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!