2's complement
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
2's complement

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> FPGA
Author Message
superman321



Joined: 20 Dec 2005
Posts: 4

Posted: Sat Jan 21, 2006 7:04 pm    Post subject: 2's complement Reply with quote

Hi all,

i have a doubt regd. the 2's complement..i have to write a VHDl code for the addition and subtraction of the 2's complement; where A and B are 32 bit each and the output is also 32 bits..if i am not wrong..i think the addition of the 2's compliment is usual addition and i can write:

c <= signed(a) + signed (b);

and the subtraction is where i have to use the 2's compliment...and can i write it as

c <= signed(a) - signed (b);

are these right???.......i have to represent the output in HEX and i have a component that converts the outputs (32 bits) to display in LED (7 segemnt)...i am confused abt the range of the value that will be displayed (in both the addition and subtraction) and abt the overflow...

IS THERE A BETTER WAY OF WRITING THE 2'S COMPLIMENT....???????

PLZ THROW SOME LIGHT....

CHEERS
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> FPGA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB