This question is closed. Reopen it to edit or answer.
How do I group signal definitions per their data types in generated code?
1 view (last 30 days)
I am generting C code from a model which contains signals with different data types like integers, characters, words etc.
When generating code, I would like to group signal definitions all signals of same type together.
unit8 var1; uint8 var4;
uint16 var2; uint16 var3;
How can I achieve this?
Jonathan on 18 Dec 2012
The class() function can reveal what type of data is being input. To sort it you could check the class of the input and store it in a vector. This code is assuming your "input" is from an outside source so this is treated like a separate function call. If the input is internal then you could also use a for-loop around the switch-case
global array8 array16 array32
input = uint8(12);
array8(end+1) = input;
array16(end+1) = input;
that's just a demo, you'd have to include
array8 = 
and stuff for that to be functional. If you're more specific we could help you out a bit better, but that should get you started :)