Hi, Sorry, everyone who participate in this discussion.
After finishing my code, I wrote log2() function and finally found that I didn't use it at all and actually use the following format before having read Rick suggestions.
signal Count : integer range 0 to N;
instead of
signal Count : unsigned(log2(N)-1 downto 0);
KJ: he says that "M := M mod 2;" is not equal to: "M := M/2;" I don't know why? Can you list a digital example to show your point?
Thank you.
Weng