stateflow 코드 생성
41 次查看(过去 30 天)
显示 更早的评论
stateflow에서 chart properties를 보면 satuation on integer overflow 체크박스가 존재합니다.
해당 기능을 누르고 코드 생성을 할경우 아래와 같은 코드가 생성됩니다.

해당 코드는 오버플로우 방지로직으로 생성되는거 같은데... tmp_0은 int16으로 -32768~32767의 범위를 가집니다.
그런데 이미 오버 플로우를 넘은 값을 기준으로 비교를 하고 있어 사실상 무의미한 코드가 생성됩니다.
유의미한 코드가 생성될수 있게 반영 부탁 드립니다.


1 个评论
Angelo Yeo
2025-8-18,0:34
안녕하세요. 해당 이슈는 불필요하거나 무의미한 코드 생성에 관한 제안으로 이해됩니다. 혹시, 생성된 코드의 전후 맥락을 더 잘 이해할 수 있도록 재현 가능한 모델을 첨부해주실 수 있으실까요?
回答(1 个)
Arushi
2025-8-22,10:11
Hi Youngjin,
In Stateflow, the “Saturate on integer overflow” option controls how overflow is handled. In this scenario, you can try either saturation or wrapping. With saturation, values are clamped to the minimum or maximum limits of the data type, while with wrapping, they roll over within the range.
For more details, please refer to the documentation here: https://in.mathworks.com/help/releases/R2024b/fixedpoint/ug/saturation-and-wrapping.html
This may help you but for a more specific answer, could you please share your model or a simplified example, so I can help you better.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!