Introduction - If you have any usage issues, please Google them yourself
Consider a counter that counts from m to n and then wraps around. Derive HDL code for the counter. Use generics, M and N, for m and n of the counter.(Note: there should be one control as UP/DOWN such that when UP/DOWN=1 then counts UP and for 0 it counts DOWN)