Unsigned operations on vectors

Status
Not open for further replies.

Opel_Corsa

Member level 1
Joined
Nov 13, 2005
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,614
I have 3 8-bit std_logic_vectors A, B, C. If I include the unsigned.all library, would the code correctly perform the following?:
Code:
C <= A + B;
C <= A - B;
C <= A and B; -- bitwise addition
Also for multiplication, lets say I have a 16-bit vector called D. Would the following do what I want?:
Code:
D <= A * B;
C <= D(7 downto 0); -- only interested in the lower 8-bits since C can't hold anything larger
Thanks for any help.
 

Yes It will work! Checkout yourself!
 

Hi,

For C <= A and B, it is always better you use the following syntax,

for i in 0 to 7 loop

C(i) <= A(i) and B(i);

end loop;


Rest all seems to be okay.

Regards
vs21
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…