Are there Simulink guidelines for choosing ufix1 vs. boolean?
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dara Parsavand
el 8 de Dic. de 2016
Editada: Dara Parsavand
el 16 de Feb. de 2018
In the past I've tried making all my 1 bit signals in my Simulink models ufix1 or all of them boolean and neither option seemed to work perfectly. I haven't yet found guidelines from MathWorks for choosing the best type in a particular case - are there any? Or perhaps you really can make them all one type or the other, but I did it wrong.
From my perspective, I don't see the need for a ufix1 data type - does anybody know the reason?
4 comentarios
Kiran Kintali
el 17 de Mzo. de 2017
I have entered an enhancement request to remove this restriction on enable port. We hope to remove this limitation soon.
Respuesta aceptada
Tim McBrayer
el 5 de En. de 2017
A ufix1 type is an arithmetic type--it represents a number. You can add, subtract, etc., with it. It can represent the numeric values 0 and 1. A boolean type a not an arithmetic type (it stores true and false) and doesn't support arithmetic operations. VHDL in particular is strongly typed, and upholds this distinction in its language implementation. HDL Coder in general follows the most restrictive commonalities between VHDL and Verilog, so it honors the VHDL distinction between types.
Simulink and HDL Coder go even further with ufix1, as they support binary point scaling. For example, ufix1_En2 can store either 0 or 0.25, in a single bit. ufix1_E4 can store 0 or 16, also in one bit. And so on. Arithmetic will be performed on these types in bit-true and cycle-accurate form. This is simply the nature of the full-featured fixed-point numeric system that MATLAB and friends support.
Más respuestas (0)
Ver también
Categorías
Más información sobre Math Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!