This line in XCOUNTER.VHD: counter <= (others=>'0'); has to be written as: counter_r <= (others=>'0');
You are right about that I will update it.