When you have MATLAB code in your Simulink model you can use coder.target
to identify the target. You can differentiate between "C" code generation and "HDL" code generation using this.
coder.target("HDL")
would be true when you are generating HDL.
Doc for this is at http://www.mathworks.com/help/coder/ref/coder.target.html