0% found this document useful (0 votes)
31 views16 pages

Digital Logic Design Number Systems, Operations and Codes

Here are the 8-bit signed binary representations of +19 and -19 in sign magnitude, 1's complement, and 2's complement forms: Sign Magnitude: +19: 00010011 -19: 10010011 1's Complement: +19: 00010011 -19: 11101100 2's Complement: +19: 00010011 -19: 11101101

Uploaded by

shabana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views16 pages

Digital Logic Design Number Systems, Operations and Codes

Here are the 8-bit signed binary representations of +19 and -19 in sign magnitude, 1's complement, and 2's complement forms: Sign Magnitude: +19: 00010011 -19: 10010011 1's Complement: +19: 00010011 -19: 11101100 2's Complement: +19: 00010011 -19: 11101101

Uploaded by

shabana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

Digital Logic Design

Number Systems, Operations


and Codes
Part 1
Decimal Numbers

The position of each digit in a weighted number system is


assigned a weight based on the base or radix of the system.
The radix of decimal numbers is ten, because only ten
symbols (0 through 9) are used to represent any number.
The column weights of decimal numbers are powers
of ten that increase from right to left beginning with 100 =1:
…105 104 103 102 101 100.
For fractional decimal numbers, the column weights
are negative powers of ten that decrease from left to right:
102 101 100. 10-1 10-2 10-3 10-4 …
Decimal Numbers

Decimal numbers can be expressed as the sum of the


products of each digit times the column value for that digit.
Thus, the number 9240 can be expressed as
     (9 x 103) + (2 x 102) + (4 x 101) + (0 x 100)
or
9 x 1,000 + 2 x 100 + 4 x 10 + 0 x 1
Express the number 480.52 as the sum of values of each
digit.

480.52 = (4 x 102) + (8 x 101) + (0 x 100) + (5 x 10-1) +(2 x 10-2)


Binary Numbers

For digital systems, the binary number system is used.


Binary has a radix of two and uses the digits 0 and 1 to
represent quantities.
The column weights of binary numbers are powers of
two that increase from right to left beginning with 20 =1:
…25 24 23 22 21 20 weights
32 16 8 4 2 1 weights
For fractional binary numbers, the column weights
are negative powers of two that decrease from left to right:
22 21 20. 2-1 2-2 2-3 2-4 … weights
4 2 1 . ½ ¼ 1/8 1/16 weights
Decimal Binary
Number Number

Binary Numbers 0 000


0
A binary counting sequence for numbers 1 000
from zero to fifteen is shown. 1
2 001
Notice the pattern of zeros and ones 0
in each column. 3 001
Digital counters frequently have this 1
4 010
same pattern of digits: 0
Counter 0 1 0 1 0 1 0 1 0 1 Decoder
5 010
0 0 1 1 0 0 1 1 0 0
1
0 0 0 0 1 1 1 1 0 0
6 011
0
0 0 0 0 0 0 0 0 1 1
7 011
1
8 100
0
Binary Conversions

The decimal equivalent of a binary number can be determined by


adding the column values (weights) of all of the bits that are 1
and discarding all of the bits that are 0.
Convert the binary number 100101.01 to decimal.
Start by writing the column weights; then add the
weights that correspond to each 1 in the number.
25 24 23 22 21 20. 2-1 2-2
32 16 8 4 2 1 . ½ ¼
1 0 0 1 0 1. 0 1
32 +4 +1 +¼ = 37¼ = 37.25
Binary Conversions

To convert decimal to any other base, repeatedly divide by the


base. For conversion to binary, repeatedly divide by 2:
Convert the decimal number 49 to binary by
repeatedly dividing by 2.
You can do this by “reverse division” and the
answer will read from left to right. Put quotients to
the left and remainders on top.
MSB
Answer: 1 1 0 0 0 1 Remainder  LSB
0 1 3 6 12 24 49 2
Continue until the Decimal
Quotient base
last quotient is 0 number
Binary Addition

The rules for binary addition are


0+0=0 Sum = 0, carry = 0
0+1=1 Sum = 1, carry = 0
1+0=1 Sum = 1, carry = 0
1 + 1 = 10 Sum = 0, carry = 1
When an input carry = 1 due to a previous result, the rules
are
1 + 0 + 0 = 01 Sum = 1, carry = 0
1 + 0 + 1 = 10 Sum = 0, carry = 1
1 + 1 + 0 = 10 Sum = 0, carry = 1
1 + 1 + 1 = 11 Sum = 1, carry = 1
Binary Addition

Add the binary numbers 00111 and 10101 and show


the equivalent decimal addition.
0111
00111 7
10101 21
11100 = 28
1’s Complement

The 1’s complement of a binary number is just the inverse


of the digits. To form the 1’s complement, change all 0’s
to 1’s and all 1’s to 0’s.
For example, the 1’s complement of 11001010 is
00110101
In digital circuits, the 1’s complement is formed by using
inverters:
1 1 0 0 1 0 1 0

0 0 1 1 0 1 0 1
2’s Complement

The 2’s complement of a binary number is found by


adding 1 to the LSB of the 1’s complement.
Recall that the 1’s complement of 11001010 is
00110101 (1’s complement)
To form the 2’s complement, add 1: +1
1 1 0 0 1 0 1 0 00110110 (2’s complement)
1

0 0 1 1 0 1 0 1
Input bits
Carry
Adder
in (add 1)
Output bits (sum)

0 0 1 1 0 1 1 0
Signed Binary Numbers

There are several ways to represent signed binary numbers.


In all cases, the MSB in a signed number is the sign bit, that
tells you if the number is positive or negative.
For example, the positive number 25 is written using 8-bits
as 00011001 (true form).

Sign bit Magnitude bits


The negative number 25 is written as:
25 = 10011001
Sign bit Magnitude bits

In the sign magnitude form, a negative number has the same


magnitude bits as the corresponding positive number but the
sign bit is 1 rather than a zero. The sign bit has no weight
value.
1’s Complement form
Negative numbers can be the 1’s complements of the corresponding positive
numbers.
For example, the decimal number -25 is expressed as the 1’s complement of
00011001 (+25) which is: 11100110 (-25).
The 1’s complements of negative numbers are the corresponding positive
numbers.
For example the 1’s complement of 11100110 (-25 ) is 00011001 (+25).

2’s Complement
Negative numbers can be also the 2’s complements of the corresponding
positive numbers. For example, the decimal number -25 is expressed as the
2’s complement of 00011001 (+25) by inverting each bit and adding 1,
which is: 11100111 (-25).
The 2’s complements of negative numbers are the corresponding positive
numbers.
For example, the 2’s complement of 11100111 (-25 ) is 00011001 (+25).
Example
Express the decimal number -39 as an 8-bit binary number in
the sign magnitude, 1’s complement, and 2’s complement.

Solution:
8-bit binary number for + 39 by repeatedly dividing by 2:
MSB is the 8th bit 6th bit 00100111
Answer: 1 0 0 1 1 1 Remainder  LSB
0 1 2 4 9 19 39 2
Continue until the Decimal
Quotient base
last quotient is 0 number

The sign magnitude form, -39: 10100111


In the 1’s complement form, -39 is produced by taking 1’s
complement of +39: 11011000
In the 2’s complement form, -39 is produced by taking the 2’s
complement of +39: 11011001
-39 in 1’s complement: 11011000
+ 1
-39 in 2’s complement: 11011001
2’s complement of -39 is +39 because:
1’s complement of 11011001: 00100110
+ 1
+39 in 2’s complement: 00100111

Decimal Sign-Magnitude 1’s comp. 2’s comp.


+39 00100111 00100111 00100111
-39 10100111 11011000 11011001
Problem:
Express +19 and -19 as 8-bit signed binary numbers in
sign magnitude, 1’s complement, and 2’s complement.

You might also like