Generate if-for statement
What you have written is:

"If signal X is true I don't need any hardware.
  If signal X is false I want to have some hardware which does..... "

Hardware either exists or it does not exist. It can't just disappear into nothing or appear out of nothing.

All you can do is have the hardware (always) present end then you
can use it or not.