crackle24 said:
i have just started learning vhdl.
dere r a few things dat dont work and i dont know why,and i was hoping
to find some help here.
firstly i tried writing a code using 'when ...else' but i get a syntax
error i dont know why.
Post your code and the error message.
and secondly i tried to increment a bit vector value with de statement
Don't use bit or bit_vector. Bit can only be '0' or '1' and there is no
'X'. Use std_ulogic(_vector) (for single-source signals) or
std_logic(_vector) (for multi-source signals, as for tri-state busses).
cout:=count + "001";
is dis right.
This strongly depends on the library you use. It is recommended to
use IEEE.numeric_std.all;
Then you have several option how to do arithmetics:
* if count is of type unsigned, write
count:=count + 1; -- addition of unsigned and integer
* if count is of type signed, write
count:=count + 1; -- addition of signed and integer
* if count is of type std_ulogic_vector, write
eighter
count:= std_ulogic_vector(unsigned(count) + 1);
or
count:= std_ulogic_vector(signed(count) + 1);
The decision between signed and unsigned is important if negative
numbers may occur and therefore this strong definition how to threat
count is necessary - even if it looks bad.
Look into IEEE.numeric_std.all to see what additions are supported.
Convert your signals to types, that can be used with these additions.
de same works when i declared count as std_logic.
-> You use probably IEEE.std_logic_arith.all; with is NOT recommended,
because this is not a standard library.
Note, that something like count:=count+1; should be only used in
synchronous processes (inside a "if rising_edge(clock)").
Ralf