Why does my simulink chart generate an error with data type fixdt(0,8,0) or fixdt(0,16,0) but not other sizes 7,9,10 etc.

6 views (last 30 days)
I have a project that I am writing for HDL coder and I am useing a Mealy Chart within simulink.
I have set the following into the Matlab workspace to configure the chart:
Word_Size = 8; % bits : The size of the word ( eg 8-bits, 9-bits)
MY_Type = fixdt(0,Word_Size,0);
Then in the model explorer I have set the DataType to MY_Type for my variable RegIn. I get the following errors when Word_Size = 8 but not if Word_Size = 9.
"This assignment writes a 'uint8' value into a 'embedded.fi {ufix1}' type. Code generation does not support changing types through assignment. Check preceding assignments or input type specifications for type mismatches. Transition in Chart 'Bla?Bla?Bla?': {S_Out=bitget(RegIn,8);}"
I have set the chart properties "treat these inherited Simulink signal types as fi objects" to "Fixed-point & Integer"
In Model Explore is shows that the variable RegIn has a DataType of "MY_Type" but a CompiledType of uint8 when Word_Size is 8 and a CompliedType of ufix9.
Any Idea what I am missing?

Answers (1)

Ryan Baird
Ryan Baird on 18 Nov 2022
As a workaround, you may be able to define the type directly inside of the symbols pane, or if it is an input set the type to inherited and define the type on the simulink side.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!