Good afternoon,
Do you think you could explain to me what a value on the right side of the if statement means? In the example which I don't quite understand there are two declared unsigned vectors.
CONSTANT ZERO : UNSIGNED(3 DOWNTO 0) := (OTHERS=>'0);
SIGNAL count : UNSIGNED(3 DOWNTO 0) := ZERO;
Then follows:
IF clk'EVENT AND clk='1' THEN
if count<(2-1) THEN
output<='1';
etc...
What I have problems with is part
if count<(2-1)
What could this 2-1 mean? I have several ideas. From googling I found out that vector_name(n-1 downto 0) is a common way of declaring vectors, where n = number of bits OR width of the bus. However, this doesn't seem to have anything in common with the example. Another guess: the value on the left is an unsigned binary signal, so maybe 2-n means that n before comparison should be turned into a binary?
P.S. This example is from a frequency divider.
if count < 1. Unless it's a way of semi-documenting a kludgy fix for an unexpected off-by-one problem with the intendedif count < 2, e.g. if the comparison was moved a cycle earlier to help the pipeline... - user_1818839