concatenate two bit_vector
Author Message
concatenate two bit_vector

i have a two variables (a and b) with their type are bit_vector(4
downto 0)
how can i concatentate these two variables and store the result into a
variable c with its type is bit_vector(9 downto 0)

thank you.

regards
yccheok

Wed, 07 Sep 2005 11:30:27 GMT
concatenate two bit_vector
Very easy;

c <= a & b;  -- a is assigned into upper 5 bits, b into lower 5 bits.

Niv.

Quote:
> i have a two variables (a and b) with their type are bit_vector(4
> downto 0)
> how can i concatentate these two variables and store the result into a
> variable c with its type is bit_vector(9 downto 0)

> thank you.

> regards
> yccheok

Wed, 07 Sep 2005 16:46:54 GMT
concatenate two bit_vector
Part 2: Ah, a variable, didn't read properly.

So;      c := a & b;

Niv.

Quote:
> i have a two variables (a and b) with their type are bit_vector(4
> downto 0)
> how can i concatentate these two variables and store the result into a
> variable c with its type is bit_vector(9 downto 0)

> thank you.

> regards
> yccheok

Wed, 07 Sep 2005 16:48:05 GMT
concatenate two bit_vector

Quote:
> i have a two variables (a and b) with their type are bit_vector(4
> downto 0)
> how can i concatentate these two variables and store the result into a
> variable c with its type is bit_vector(9 downto 0)

> thank you.

> regards
> yccheok

Just use the concatenation operator & as in

c:= a & b; or
c:= b & a; depending on whether you want a or b to be in the most
significant position.
Cheers
Yves

Wed, 07 Sep 2005 21:22:16 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages