I've got simple code for generating different frequencies from Digital port of FPGA.
But it does not change the frequency during the execution.
If I stop the execution of the program and change the enum variable, the frequency will change. But inside running cycle it does not.
That is because you read enum value first, and then loop starts executing. So when you change enum while loop is running - it does not make any effect.
So you need to track changes of enum state in the loop (use shift register for this), and then stop it once value is changed.
But also, additional outer loop is needed - so when inner loop is stopped, outer loop will iterate once more, and inner loop will start execution with new frequency.