small bug corrected, now generates frequency based on clk freq