0% found this document useful (0 votes)
13 views

Chapter 1 - New 11

Uploaded by

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

Chapter 1 - New 11

Uploaded by

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

Digital Logic Design

Faculty of Information Technology - Computer Science Department 2


Outline

• Recommended Textbook
Digital Design with an Introduction To The VERILOG HDL , by M.Morris Mano & Michael
D. Ciletti, 5th edition, Pearson, 2013.

• Course Description
This course focuses on the fundamental constructs and concepts underlying computer
hardware and software which includes number systems, binary arithmetic, codes,
Boolean algebra, gates, Boolean expressions

Faculty of Information Technology - Computer Science Department 2


Course Outline
Number Systems:
1. Binary Numbers.
2. Octal and Hexadecimal Numbers. Number-Base Conversions.
3. Complements.
4. Signed Binary Numbers. Arithmetic Operations.
5. Binary Codes.
Boolean algebra:
1. Basic Theorems and Properties of Boolean Algebra.
2. Boolean Functions.
3. Canonical and standard forms( Minterm, Maxterm).
4. Digital logic gates.

Faculty of Information Technology - Computer Science Department 3


Course Outline

Gate Minimization
◆ The Map Method.
◆ Two, three, and four variable maps.
◆ PoS, SoP simplification.
◆ Don’t care conditions. NAND/NOR implementation.
◆ Exclusive-OR Function.

Combinational Logic
◆ Analysis and design of combinational circuits.
◆ Full/half Adder
Chapter 1
Digital Systems and Binary
Numbers

Faculty of Information Technology - Computer Science Department 5


Outline of Chapter

1. Digital Systems
2. Binary Numbers
3. Number-base Conversions
4. Octal and Hexadecimal Numbers
Digital Systems

Digital systems (systems that can manipulate Discrete information)


◆ Digital Computers

◆ Telephone switching exchanges

◆ Digital camera

◆ Electronic calculators, PDA's Digital TV

Digital computers
◆ General purpose.
◆ Many scientific, industrial, and commercial applications.

Discrete elements
◆ Electric impulses
◆ Arithmetic operations
For example, {1, 2, 3, …} and {A,
B, C, …}…
Digital Systems

Why Digital systems are better?


◆ Digital Systems are programmable
◆ Dramatic cost reductions due to advances in digital ICs technology
◆ High speed operations hundreds of millions OPS
◆ Digital Systems work with extreme reliability
Analog and Digital Signal

Analog system
The physical quantities or signals may vary continuously over a specified range.

Digital system

The physical quantities or signals can assume only discrete values.


Binary Digital Signal

An information variable represented by physical quantity. For digital systems, the


variable takes on discrete values.
◆ Two level, or binary values are the most prevalent values.
Binary values are represented abstractly by:
◆ Digits 0 and 1
Words (symbols) False (F) and True (T) Words (symbols) Low (L) and High (H) And words On and
Off
Binary values are represented by values
or ranges of values of physical quantities.
Outline of Chapter 1

1. Digital Systems
2. Binary Numbers
3. Number-base Conversions
4. Octal and Hexadecimal Numbers
Decimal Number System

Base (also called radix) = 10


◆ 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
Coefficient Position
◆ Integer & fraction
Coefficient Weight
◆ Weight = (Base) Position
In general Magnitude:
◆ Sum of “Coefficient x Weight”
Binary Number System

Base = 2
◆ 2 digits { 0, 1 }, called binary digits or “bits”
Weights
◆ Weight = (Base) Position

Magnitude
◆ Sum of “Bit x Weight”
Formal Notation
Groups of bits
The Power of 2
Octal Number System

Base = 8
◆ 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
Weights
◆ Weight = (Base) Position
Magnitude
◆ Sum of “Digit x Weight”
Formal Notation
Hexadecimal Number System

Base = 16
◆ 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
Weights
◆ Weight = (Base) Position

Magnitude
◆ Sum of “Digit x Weight”
Formal Notation
Outline of Chapter 1

1. Digital Systems
2. Binary Numbers
3. Number-base Conversions
4. Octal and Hexadecimal Numbers
Number Base Conversions
Conversion form any base to Decimal (Evaluate magnitude)
Conversion form any base to Decimal (Evaluate magnitude)

Example: convert 1101.01 in binary to decimal:

The decimal value is:


Conversion form Decimal to any base system (Divide by base)

To convert a decimal integer into any base, keep dividing by r until the quotient is 0. Collect
the remainders in reverse order.
To convert a fraction, keep multiplying the fractional part by r until it becomes 0 or until we reach
the required accuracy. Collect the integer parts in forward order.
Decimal (Integer) to Binary Conversion

Divide the number by the ‘Base’ (=2)


Take the remainder (either 0 or 1) as a coefficient Take the quotient
repeat the division until the quotient reaches zero.
Example: (13)10
Decimal (Fraction) to Binary Conversion

Multiply the number by the ‘Base’ (=2)


• Take the integer (either 0 or 1) as a coefficient
• Take the resultant fraction
• repeat till you reach a zero or the required accuracy is
attained.
Decimal (Fraction) to Binary Conversion
Decimal to Octal Conversion
Decimal to Hexadecimal Conversion
Binary − Octal Conversion
Binary − Hexadecimal Conversion
Octal − Hexadecimal Conversion
Example:
Example:
Exercise
Exercise
Exercise
Exercise
Digital Logic Design

Unsigned arithmetic operations in any base system


(Addition & Subtraction)
Outline

1. Procedure to add two base-r numbers


2. Procedure to subtract two base-r numbers
3. Multiplication of two base-r numbers
Example 1
Procedure to add two base-r numbers

Line up the numbers from right to left. If one number is shorter extend
it by adding leading zeros to the number.
Work from right to left - doing the same addition and carry
operation in each column.
Add the two digits in the same column and also add the carry at the
top of the column (if any).
◆ The digits may be A,B,C…etc and if so, mentally convert
them to decimal before adding.
◆ Remember to record a carry digit as explained below - even if it is
zero.
◆ Keep the decimal sum in your head - or write it down on some
scratch paper.
Procedure to add two base-r numbers

Compare the sum (in your head) with the radix r.


A sum less than r is just recorded at the bottom of the same column.
• Be careful to write the sum as a single base-r digit.
• Write a 0 as the carry in the next column left.
A sum greater or equal to r requires several steps:
◆ Subtract (in decimal in your head) the radix r from the sum of
the digits you already computed.
◆ Record the difference as a base-r digit at the bottom of the
same column.
◆ Write a 1 as the carry in the next column left.
Any extra carry past to the leftmost column is called the carry out and is usually stored somewhere
else on the computer.
The answer must have the same number of digits as the two operands.
Single Bit Binary Addition
Single Bit Binary Addition

Q. What is 1 + 1 + 1 = ?
A. The answer is 1 carry 1.

Explanation: We perform the operation in 2 steps: 1 + 1 =


0 carry 1
We then add 1 to the above result, which yields
is 1 carry 1.

Faculty of Information Technology - Computer Science Department 4


2
Example
Multiple Bit Binary Addition

• Start with the least significant bit (rightmost bit)


• Add each pair of bits
• Include the carry in the addition, if present
• Example :

Faculty of Information Technology - Computer Science Department 4


4
Multiple Bit Binary Addition

Another Example:

Faculty of Information Technology - Computer Science Department 4


5
Solve :
Outline:
1. Procedure to add two base-r numbers
2. Procedure to subtract two base-r numbers
3. Multiplication of two base-r numbers
Single Bit Binary Subtraction

• In general, the result of subtracting two digits each


of weight w is two digits. One is the “Difference”
digit and the other is the “Borrow” digit.
• The difference digit has the same weight w as the
operand digits.
• The borrow digit is considered negative and has the
weight of the next higher digit .
If Difference is negative Difference = 2 + Difference &
Borrow = -1
Single Bit Binary Subtraction

Q. What is1–1–1=?
A. The answer is 1 borrow 1.
Explanation: We perform the operation in 2 steps: 1 – 1 = 0
We then subtract 1 from the above result, i.e. 0 – 1 which is
1 borrow 1.
Q. What is 0 – 1 – 1 = ?
A. The answer is 0 borrow 1. Explanation: We perform the
operation 0 - 1= 1 borrow 1
We then subtract 1 from the above result, which yields 0
borrow 1.

Faculty of Information Technology - Computer Science Department 49


Multiple Bit Binary Subtraction
Multiple Bit Binary Subtraction
Solve:
Outline
1. Procedure to add two base-r numbers
2. Procedure to subtract two base-r numbers
3. Multiplication of two base-r numbers
Binary Multiplication

Example :
Complements

• 1’s Complement (Diminished Radix Complement)

All ‘0’s become ‘1’s


All ‘1’s become ‘0’s
Example (10110000)2
(01001111)2

• If you add a number and its 1’s complement … 10110000


+ 01001111

11111111
Complements

2’s Complement (Radix Complement)


Take 1’s complement then add 1

OR Toggle all bits to the left of the first ‘1’ from the right( least significant 1)
Binary Subtraction Using 1’s Complements

The subtraction of two n bit unsigned binary numbers X –Y using the 1’s complement can be
done as follows:

• Take the 1’s complement of the subtrahend Y and add it to the minuend X.

 If X >= Y, the sum will produce and end carry at position 2n, which is added to LSB of the sum. This operation is
called end a round carry.
 If X < Y, the sum does not produce an end carry. To obtain the answer in a familiar form, take the 1’s complement of
the sum and place a negative sign in front.
Binary Subtraction Using 1’s Complement

Example:
Binary Subtraction Using 1’s Complement

Example :
Given the two binary numbers X = 1101 and Y = 10, perform the subtraction X – Y by using
1's complement.

1101 – 10 = 1011
Binary Subtraction Using 1’s Complement

perform the subtraction by using 1’s complements

There is no end carry. Therefore, the


answer is Y - X = -(1’s complement of
1101110) = -0010001.
Binary Subtraction Using 2’s Complement

The subtraction of two n bit unsigned binary numbers


X – Y using 2’s complement can be done as follows:

• Take the 2’s complement of the subtrahend Y and add it to the minuend X.
• If X >= Y, the sum will produce and end carry at position 2n, which can be
discarded; what is left is the result X – Y.
• If X < Y, the sum does not produce an end carry. To obtain the answer in a familiar
form, take the 2’s complement of the sum and place a negative sign in front.
Binary Subtraction Using 2’s Complement

Example
Given the two binary numbers X = 1010100 and Y = 1000011, perform the
subtraction (a) X – Y ; and (b) Y  X, by using 2's complement.
Examples:

Q 1. Given the two binary numbers X = 1001 and Y = 0101, perform the

subtraction X – Y by using 2's complement.

A. 1001 – 0101 = 0100

Q 2. Given the two binary numbers X = 1010010 and Y = 11100100, perform the

subtraction X – Y by using 2's complement.

A. 1010010 – 11100100 = - 10010010


Solve:

◆ Given the two binary numbers X = 1010100 and Y = 1000011,


perform the subtraction
(a) X – Y ; and
(b) Y-X, by using 2's complement.
Registers

Registers are fast storage devices used inside processors Used to store computation
results of a running program
A Register consists of a fixed number of storage bits

The register size n is typically a power of 2 (8, 16, 32, 64)


Numbers stored in registers are either unsigned or signed
The byte size is equal to 8 bits, but the word size can vary from one computer to
another.
Signed Binary Numbers
• Plus and minus signs are used for decimal numbers: 20 (or +20), −15, etc
• Computers Represent Information in ‘0’s and ‘1’s
‘+’ and ‘−’ signs have to be represented in ‘0’s and ‘1’s
• 3 different ways to represent negative number (e.g. -9)
Signed- Magnitude representation: 10001001
Signed-1’s Complement representation: 11110110

Signed-2’s Complement representation: 11110111 All three use the left most bit to represent the sign:
» ‘0’  positive
» ‘1’  negative

• Example the different representations of -9


using 8 bit number:
Signed Binary Numbers
• Table 1.3 lists all possible four-bit signed binary numbers in the three
representations.
Signed Magnitude Representation

Magnitude is magnitude, does not change with sign


Signed-1’s Complement Representation

Positive numbers are represented in “Binary”


Magnitude (Binary)
Negative numbers are represented in “1’s Complement”
Code (1’s Complement)
(+3)10  (0 011)2
(−3)10  (1 100)2

There are 2 representations for ‘0’


(+0)10  (0 000)2
(−0)10  (1 111)2
Signed-1’s Complement Range
Signed-2’s Complement Representation

Positive numbers are represented in “Binary”


Magnitude (Binary)
Negative numbers are represented in “2’s Complement”
Code (2’s Complement)
(+3)10  (0 011)2
(−3)10  (1 101)2
Signed-2’s Complement Range
Number Representations

You might also like