What have you set for "Sample time" on the block dialog? This needs to be discrete sample time for HDL code generation.
If you have set -1 (inherited), it is likely that you have some continuous blocks in your model that are propagating a continuous sample time to the Unit Delay block. You should convert your entire model to discrete sample time. Use sample time colors to figure out what blocks have continuous sample time color (black).