How to remain the bits of input signal port unchanged after using fixed-point tool?

2 views (last 30 days)
The upper level of my model is 12-bit output, so each input channel of the model must maintain a 12-bit input. However,after using fixed-point tool, they became 10bits,18 bits, or even 19 bits.What most confuses me is that, the accuracy and the processing procedure of x2 to x4(rear six signals) is the same, but the fixed-point tool makes each channel to be formatted differently.Inconsistent data structures are not conducive to further data processing. How to solve this problem?

Accepted Answer

Andy Bartlett
Andy Bartlett on 17 May 2023
Edited: Andy Bartlett on 17 May 2023
LockScale prevents changes by Fixed-Point Tool
Often some signals and parameters in a model are mandated early in the design process to have specific data types. Fixed-Point Tool has a mechanism to leave these data types alone and only change other data types. The mechanism goes by the nicknames "Lock scaling" or "LockScale".
Fixed-point capable blocks usually have a parametered named LockScale. If this parameter is set to on, then fixed-point tool will not change any of the data types set by that block's dialog.
get_param(gcb,'LockScale')
ans =
'on'
Prior to using Fixed-Point Tool, visit all the blocks with mandated data types and set LockScale to on.
Same data type requirements
Fixed-Point Tool has knowledge of the data type requirements of many Simulink blocks, especially those that are fixed-point capable. A common example is that a block may require two or more connected signals to have identical data types. The Vector Concatenate Block is an example where all the inputs and outputs must have the same data type. When Fixed-Point Tool proposes data types, it will group signals that the tool knows must have identical data types. Fixed-Point Tool will propose one data type that meets the needs of all the blocks in a "same data type signal group."
As the model designer, you may know of "same data type" requirements that the original model would not enforce. When you run Fixed-Point Tool on the original model, it would not know about the unmodelled "same data type" requirements and would quite likely propose different data types for one or more signals in the "SHOULD be same data type group." You can solve this issue by dropping in Data Type Duplicate Blocks. A Data Type Duplicate Block will model the requirement that one or more signals must have identical data types.
Prior to running the Fixed-Point Tool, change the original model by dropping in Data Type Duplicate Blocks to model the data type sharing requirements. On the changed model, the Fixed-Point Tool will be aware of the Data Type Duplicate Block's requirements and include all the connected signals into a "same data type group".

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!