electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

How about signed adder?


Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> How about signed adder?
Author Message
davyzhu



Joined: 23 May 2004
Posts: 521
Helped: 3
Location: oriental


Post23 Jun 2005 15:52   

adder overflow


Hi all,

I want to add two 6 bits signed digit.
Something like 6'b10_0110, the MSB '1' is negative digit,other'00100' is absolute value.
Or Something like 6'b00_0110, the MSB '0' is positive digit,other'00100' is absolute value.

How to design a signed adder to add these too signed digit?
Now I convert it to 2's complement,add, and convert it back to signed digit.
But the overflow control seems not be a easy task.
BTW, I use Verilog.

Any suggestions will be appreciated!
Best regards,
Richard
Back to top
masai_mara



Joined: 13 Aug 2004
Posts: 118
Helped: 6


Post24 Jun 2005 9:27   

signed adder


what you are doing is in the right direction and yes overflow is sometimes tricky but you have to decide your num of valid bits by estimating the max(min) values of your results.
Back to top
shankar



Joined: 22 Jun 2005
Posts: 19
Helped: 2


Post27 Jun 2005 14:19   

signed adder


hi

first u check the msb is 1 or 0 then u add with the remaining 5 bits if u get 1 then take twos complement and append 1 in the msb
Back to top
claint



Joined: 21 May 2004
Posts: 96
Helped: 2


Post28 Jun 2005 8:24   

16 bit signed adder


1.Use 2's complement all through the design,there is no need to convert to 1's complement.
2. If two data are both in [-1 1), and the number of bit is n, then use n+1 bit adder, there is no overflow. sum is in [-2 2),
3. n bit to n+1 bit cinversion: sign extended.
4. if you force sum into the region [-1,1), still use n+1 bit adder ,then find if MSB and the bit right to MSB(i.e. 2nd MSB) are the same(i.e. check sum[n+1] xor sum[n]) ,if same(logic result is 1'b0) ,no overflow,else if sum[n+1],sum[n] is 10, positive sum overflow occur, if sum[n+1],sum[n] is 01, negtive sum overflow(became positive).

Added after 12 minutes:

sorry, I make a mistake,
sum[n+1],sum[n] is 10 ,it meens the sum is negtive , but if you discard MSB, it becomes positive, overflow occur.
sum[n+1],sum[n] is 01 ,it meens the sum is positive, but if you discard MSB, it becomes positive, overflow occur.
Back to top
Google
AdSense
Google Adsense




Post28 Jun 2005 8:24   

Ads




Back to top
adap



Joined: 16 Feb 2005
Posts: 93
Helped: 11


Post28 Jun 2005 15:19   

overflow adder


If you want to add two 6 bits signed digit, then the results will be 7 bits. You sign extend the MSBs of the two numbers to have a result of 7 bits.
For example if you add the 6'b10_0110 (which is -26 in 2's complement) and 6'b00_0110 (which is 6), sign extended (7'b1100110 + 7'b0000110) then the result will be 7 digits (1101100) which is negative (MSB is 1) and it's -20 (if you take the 2's complement it will be 20). In that case no overflow would exist if you didn't extend the sign bits.
But in the case of adding the two 6'b100110 numbers then an overflow will occur because the result is 1001100 which is 7 bits. If you take the 6 bits only then the MSB is 0 which means positive and you have the wrong result.
If you sign extend the two bits 7'b1100110 then the result will normally be 8'b11001100 but the 8th bit can be ignored since the 7th bit is the one that shows if the number is positive or negative.
The largest negative number of 6 digits is -32. If you add it to himself it will give -64 and the 7th bit will show that is negative
Back to top
shankar



Joined: 22 Jun 2005
Posts: 19
Helped: 2


Post29 Jun 2005 13:51   

how to make overflow on s4 bit adder


first check msb if its '1' then take two's complement and add the remaining bits with other number neglecting msb 's . if u get carry as '1' then take two's complement and append '1'with the msb
Back to top
AlexWan



Joined: 26 Dec 2003
Posts: 305
Helped: 6


Post29 Jun 2005 14:12   

full signed adder


Hi davyzhu,

For my opinion, the highest bit is the control bit, the remainder bits are valued bits.

Don't think it too complex.

Good Luck
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> How about signed adder?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
how does a 8 bit SIGNED adder work? (1)
how to call xinilix signed multiplier (3)
how to call xinilix signed multiplier in verilog? (2)
how to build a non-signed subtractor efficiently (3)
How to reduce signed multiplier gate count? (3)
How to multiply 2 signed Fixed-Point numbers ? (6)
Question about adder (1)
help about pipelined adder in verilog code. (2)
How-to Design full adder (1)
How to design a digital adder?? (6)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS