MATLAB: HDL simulinks coder support

HDL Codermatlab functionsimulink coder

Dear friends, I have a problem MATLAB Function. How do I generate HDL Code for my MATLAB Function in Simulink HDL Coder (R2011b).
My Matlab functions are:
1. y = 1+fix(u/(pi/3+1.e-30));
2. y = rem(u(1),1/1000);
What functions I Can use to replace these Functions?
Please help me!
Best regards!
[Merged information from duplicate question]
Dear friends,
When I try to convert to HDL code i meet some errors:
'floor' : Call to 'floor' is not supported for HDL code generation.
Function 'eml_scalar_fix' (#33554436.391.403), line 19, column 9 P
Function 'eml_scalar_fix' (#33554436.171.184), line 9, column 13 A
Function 'eml_scalar_fix' (#33554436.171.184), line 9, column 13 P
Function 'fix' (#33554435.325.345), line 12, column 12 A
Function 'fix' (#33554435.325.345), line 12, column 12 P
Function 'Subsystem2/MATLAB Function2' (#305.37.57), line 4, column 7 A
Function 'Subsystem2/MATLAB Function2' (#305.37.57), line 4, column 7 P
Please help me!
Best regards!

Best Answer

You would need the fixed point toolbox.
Warning: eps(pi/3) is much greater than 1e-30, so unless you are overwriting "pi" with some other value, in IEEE double precision binary floating point arithmetic, the addition is not going to make any difference to the result. If your intention is that it will make a difference, then you will need to use somewhere around 90 bits in your fixed point arithmetic.