The Simulink model is fixed-point based on floating-point numbers

1 回表示 (過去 30 日間)
wang
wang 2023 年 2 月 14 日
コメント済み: wang 2023 年 2 月 20 日
I build a model that I want to fixed-point to produce VerilogHDL, but part of the output keeps being double.I changed it to unit8 before, but the output data is completely wrong

回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2023 年 2 月 15 日
編集済み: Fangjun Jiang 2023 年 2 月 15 日
No way to tell what exactly caused the problem from the snapshot of the model. In the MATLAB Function block editor, you can click "Edit Data" and specify the data types of the inputs and outputs, so you don't have to use the "Data Type Conversion" block.
In the function code, use uint8() to typecast if needed. Try a simple example to make sure the values and data types are all correct. If the output value changes when only the data type of the input changes, then somewhere in the data processing there is an error. Show the code so people can point out the problem.
  1 件のコメント
wang
wang 2023 年 2 月 20 日
I changed the data type of X to unit8. When running the error, Simulink was displayed and the output was judged to be double. Maybe there is something wrong with my explanation. Could you please have a look at my latest question?

サインインしてコメントする。


Bharath Venkataraman
Bharath Venkataraman 2023 年 2 月 15 日
You can put a breakpoint in the MATLAB Function block to see whee the code is generating the double output. See this link on how to debug the MATLAB Function block.
  1 件のコメント
wang
wang 2023 年 2 月 20 日
Would you mind taking a look at my latest question?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by