Custom Search
Chip Designing for ASIC/ FPGA Design engineers and Students
FULLCHIPDESIGN
Digital-logic Design...  Dream for many students… start learning front-end…
@TYH :- 4G LTE Long Term Evolution Tutorial, CloudComputing
Get Noticed:- Submit your own content to be published on fullchipdesign.com

Send it to fullchip@gmail.com

Add two signed numbers examples below.

EX1:  +7,  +6 : Two negative numbers.

+7  +6

Step 1: Convert to 2's complement for negative numbers.

+7 (in Binary 4’b0111)

+6 (in Binary 4’b0110).

Step 2

Add and store the result in sum register of 5 bits wide.

0 111

0 110

-----------

0  1 101

-----------

Step 3

Carry into signed bit but no carry out of signed bit. In this scenario keep MSB as sign and lower 4 bits represent sum.

Result: 5’b0 1101 = 0x0D = 13

Summary Table

 Values Observations 2 bit Binary representation for [1] carry in, [0] carry out Use Bit[4] as sign for overflow Bit[3] as sign, value, 2’s complement. Bit[2:0] as value or 2’s complement. +7 +6 Carry into signed bit but no carry out of signed bit. 10 Yes value value +7 -6 Carry into signed bit and carry out of signed bit. 11 no Sign value -7 +6 No carry into signed bit and no carry out of signed bit. 00 no Sign Bit[3] = 1 so take 2’s complement. -7 -6 No carry into signed bit but carry out of signed bit. 01 Yes Bit[4] =1 so take 2’s complement. Bit[4] = 1 so take 2’s complement.

Examples to add four possible combinations of two signed numbers.

EX1:  -7,  -6 : Two negative numbers.

EX2: +7,  -6 : Positive greater than negative.

EX3:  -7, +6 : Negative greater than positive.

EX4: +7, +6 : Two positive numbers