J
Jan De Ceuster
I'm probably missing something, but I have a vector such as:
well, there are a few sollutions.
use the IEEE.std_logic_arith package and do
counter <= conv_std_logic_vector(1,counter'high-counter'low+1);
or use the IEEE.numeric package (but you'll have to look that one up)
with a similar conversion function.
or write the number in hex format:
counter <= X"01";
a 'clean' sollution to write certain bits:
counter <= (0 => '1', others => '0');
kind regards,
Jan
PS I'm not posting in newsgroups from this email address...
signal counter : unsigned(7 downto 0);
and want to set it to and integer (say 1). I have lots of cumbersome
ways to do it:
counter <= "00000001"; -- Lot's of writing and difficult to maintain.
or
counter <= (others => '0');
counter(0) <= '1'; -- Not very elegant
-- Does not work well other integers.
and of course:
counter <= unsigned(1);
What I would really like to do is overload assignment "<=" so I could
just write:
counter <= 1; -- My idea of elegant
but I don't think VHDL allows that since "<=" is also "less than or
equal to".
It would be nice if VHDL had a "just copy the damn bits" assignment
operator, maybe call it "<-", but as far as I know it does not. As near
as I can tell, the vast majority of so-called conversion functions are
really just copying bits anyway.
Ok, not the most interesting problem in the world, but VHDL type
conversion can be an awful pain at times.
well, there are a few sollutions.
use the IEEE.std_logic_arith package and do
counter <= conv_std_logic_vector(1,counter'high-counter'low+1);
or use the IEEE.numeric package (but you'll have to look that one up)
with a similar conversion function.
or write the number in hex format:
counter <= X"01";
a 'clean' sollution to write certain bits:
counter <= (0 => '1', others => '0');
kind regards,
Jan
PS I'm not posting in newsgroups from this email address...