Hallo,
I have a simulink-model containing normal math operations and s-functions as input and outputs to hardware.
Lets say two s-funtions give in1 and in2, a multiplication calculates mult1 = in1 * in2, a s-function writes the value of mult1.
I would expect the following c-code from my model:
/* S-Function (nios_mm_read) Block: <Root>/in1 */ MEM_FAST_READ(simulink_model.in1, short, IN1_BASE); /* S-Function (nios_mm_read) Block: <Root>/in2 */ MEM_FAST_READ(simulink_model.in2, short, IN2_BASE); /* product */ simulink_model.Product = simulink_model.in1 * simulink_model.in2 ; /* S-Function (nios_mm_write) Block: <Root>/Product */ MEM_FAST_WRITE(simulink_model.Product, short, OUT_BASE);
Unfortunately the order functions is mixed up after generating the c-code from the model, so that, in my minimal example, the multiplication is caclulated, before the actual values are read via the s-functions.
Is there any possibility to influence the order appearance of the blocks in the generated code?
Thanks and regards
Best Answer