0% found this document useful (0 votes)
19 views107 pages

Chapternew1 1 1

Uploaded by

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

Chapternew1 1 1

Uploaded by

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

Digital Logic Design

Faculty of Information Technology - Computer Science Department 2


Outline

• Recommended Text Book


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

Chapter 1:Digital Systems and Binary Number systems


1. Binary Numbers.
2. Octal and Hexadecimal Numbers. Number-Base Conversions.
3. Arithmetic Operations.
4. Complements.
5. Signed Binary Numbers.
6. Binary Codes.

Faculty of Information Technology - Computer Science Department 3


Course Outline

Chapter 2: 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 4


Course Outline

Chapter 3:Gate Minimization


1. The Map Method.
2. Two, three, and four variable maps.
3. PoS, SoP simplification.
4. Don’t care conditions. NAND/NOR implementation.
5. Exclusive-OR Function.

Chapter 4: Combinational Logic


1. Analysis and design combinational circuits
2. Full/half adder
Chapter 1
Digital Systems and Binary
Numbers

Faculty of Information Technology - Computer Science Department 6


Outline of Chapter

1. Digital Systems
2. Binary Numbers
3. Octal and Hexadecimal Numbers
4. Number‐Base Conversions
5. Arithmetic Operations
6. Complements of Numbers
7. Signed Binary Numbers
8. Binary Codes
9. Binary Storage and Registers
10. Binary Logic
Digital Systems

Digital systems (systems that can manipulate Discrete information)


◆ Digital System are used in many scientific, industrial and
commercial application .
◆ We have :
1. Digital Computers
2. Telephone switching exchanges
3. Digital camera
4. Electronic calculators, PDA's Digital TV
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.


Number Systems

—A decimal number such as 7,392 represents a quantity equal to 7 thousands,


plus 3 hundreds, plus 9 tens, plus 2 units.
—The thousands, hundreds, etc., are powers of 10 implied by the
position of the coefficients (symbols) in the number.
—To be more exact, 7,392 is a shorthand notation for what should be written as
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 Numbers

• 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 Numbers

—The digits in a binary number are called bits.


—When a bit is equal to 0, it does not contribute to the sum during the conversion.

—Computer capacity is usually given in bytes.


— A byte is equal to eight bits and can accommodate one keyboard
character.
Binary Number System

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

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
Number Base Conversions

Decimal to other base system Steps

1. Divide the decimal number to be converted by the value of the new base.
2. Get the remainder from Step 1 as the rightmost digit (least significant digit) of
new base number.
3. Divide the quotient of the previous divide by the new base.
4. Record the remainder from Step 3 as the next digit (to the left) of the new base
number.
5. Repeat Steps 3 and 4, getting remainders from right to left, until the quotient
becomes zero in Step 3.
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 (Integer) to Binary Conversion

1- Convert (29)10 to binary

2- Convert (56)10 to binary ??


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 Octal Conversion
Decimal to Octal Conversion
Decimal to Hexadecimal Conversion
Decimal to Hexadecimal Conversion
Conversion form any base to Decimal (Evaluate magnitude)
Conversion form binary to Decimal (Evaluate magnitude)

Example: convert 1101.01 in binary to decimal:

The decimal value is:


Number Base Conversions
Example:
Example:
Exercise
Exercise
Exercise
Exercise
Arithmetic Operations

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
Single Bit Binary Addition

In general, the result of adding two digits each of weight w is two digits. One is the “Sum”
digit and the other is the “Carry” digit.

In binary system, if the weight of the sum bit is 2i, then the weight of
the carry bit is 2i+1. Thus, adding 1 + 1 in the binary system results in
a Sum bit of 0 and a carry bit of
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


5
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


7
Multiple Bit Binary Addition

Another Example:

Faculty of Information Technology - Computer Science Department 4


8
Solve :
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 52


Multiple Bit Binary Subtraction
Multiple Bit Binary Subtraction
Start with the least significant bit (rightmost bit)

Add each pair of bits


Include the carry in the addition, if present
Example:
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
Example:
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

(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
Binary Codes

• Digital systems represent and manipulate not only binary numbers, but also many other
discrete elements of information.
• Any discrete element of information that is distinct among a group of quantities can be
represented with a binary code (a pattern of 0’s and 1’s).
• The codes must be in binary because, in today’s technology, only circuits that represent and
manipulate patterns of 0’s and 1’s can be manufactured economically for use in computers
• Binary code will have some unassigned bit combinations if the number of
elements in the set is not a multiple power of 2.
Binary Codes

• How to represent characters, colors, etc? Define the set of all represented
elements.
• Assign a unique binary code to each element of the set. Given n bits, a binary code
is a mapping from the set of elements to a subset of the 2n binary numbers.

• Coding Numeric Data (example: coding decimal digits)


◆Coding must simplify common arithmetic operations.
◆Tight relation to binary numbers.

• Coding Non-Numeric Data (example: coding colors)


◆More flexible codes since arithmetic operations are not applied.
◆Not tied to binary numbers.
Example of Coding Non-Numeric Data

Suppose we want to code 7 colors of the rainbow.

As a minimum, we need 3 bits to define 7 unique values. 3 bits define 8 possible combinations.

Each combination represents a color. Only 7 combinations are needed.

Code 111 is not used.


Color 3-bit code
Other assignments are also possible Red 000

Orange 001

Yellow 010

Green 011

Blue 100

Indigo 101

Violet 110
Decimal Codes

• Binary number system is most natural for computers. But people are used to the
decimal system.
• Must convert decimal numbers to binary, do arithmetic on binary numbers, then
convert back to decimal.
• To simplify conversions, decimal codes can be used. Define a binary code for each
decimal digit.
• Since 10 decimal digits exit, a 4-bit code is used. But a 4-bit code gives 16 unique
combinations. 10 combinations are used and 6 will be unused.
Binary Coded Decimal

• Simplest binary code for decimal digits


• Each Decimal Digit is represented by 4 bits
• A number with N decimal digits will require 4 × N bits in BCD.

Example: Decimal 396 is represented in BCD with 12 bits as


0011 1001 0110
with each group of 4 bits representing one decimal digit.

• A decimal number in BCD is the same as its equivalent binary number only when the
number is between 0 and 9.

• The binary combinations 1010 through 1111 (10 – 15) are not used and have no meaning
in BCD (i.e. invalid combinations)
Warning: Conversion or Coding?
Do NOT mix up conversion of a decimal number to a binary number with coding a decimal
number with a binary code
Single Digit BCD Addition

We use binary arithmetic to add the BCD digits


If the result is 1 decimal digit ( ≤ 9 ), then it is a simple
binary addition
Example 1:
Single Digit BCD Addition

If the result is two decimal digits ( ≥ 10 ), then binary addition gives


invalid combinations

If the binary result is greater than 9,


correct the result by adding 6
Single Digit BCD Addition
Multiple Digit BCD Addition
Multiple Digit BCD Addition

Consider the addition of 184 + 576 = 760 in BCD:


Other Decimal Codes
Other Decimal Codes
Excess-3 , 2421 and 8,4,-2,-1 are self-complementing codes
(i.e. the 9’s complement of the decimal number is obtained by changing 1’s
to 0’s and 0’s to 1’s.)

For example: 395 is represented in 2, 4, 2, 1 code by 001111111011. its 9’s


complement 604 is represented by 110000000100.

Note that the codes for 0 and 9, 1 and 8, etc. can be obtained from each
other by replacing the 0’s with the 1’s and vice-versa in the code words.

Note that BCD is NOT self-complementing


Other Decimal Codes

Note that, Excess-3 code assignment is obtained from the corresponding


value of BCD after the addition 3.

Example: The number (945)10= (1001 0100 0101)BCD is

represented in excess-3 as(1100 0111 1000)ex-3


Gray Code (The Reflected Code)
Used to represent the digital data converted from the analog data.
Only 1 bit changes from one decimal digit to the next.

Different than Binary.


Can be used in low-power logic circuits that count up or down,
because only 1 bit changes per count
ASCII Character Code

American Standard Code for Information Interchange (Pronounced ass-key)


• A popular code used to represent information sent as character-based
data.
• Standard ASCII: 7-bit character codes - 27 codes (0 – 127).
• Extended ASCII: 8-bit character codes- 28 codes (0 – 255). The 8th
bit is used for a parity bit.
Two general types of codes:
95 are “Graphic” codes (Printing characters- displayable on a console)
33 are “Control” codes (Non-printing characters)
Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage
return).
Other non-printing characters are used for record marking and flow control (e.g. STX and
ETX start and end text areas).
ASCII Code
Control Characters
ASCII Properties

ASCII has some interesting properties:


◆Digits 0 to 9 span Hexadecimal values (30)16 to (39)16
◆Upper case A-Z span (41)16 to (5A)16
◆Lower case a-z span (61)16 to (7A)16
» Lower to upper case translation (and vice versa) occurs by flipping bit 6.
» Example: A =( 41)16 = (1000001)ASCII a = (61)16 = (1100001)ASCII
Unicode

Unicode: 16-bit character codes (0 – 65,535).


Unicode standard represents a universal character set
◆ Defines codes for characters used in all major languages.
◆ Used in Windows-XP: each character is encoded as 16 bits
Parity Bit & Error Detection Codes

Binary data are typically transmitted between computers.


Because of noise, a corrupted bit will change value.
To detect errors, extra bits are added to each data value.
Parity bit: is used to make the number of 1’s odd or even.
Even parity: number of 1’s in the transmitted data is even.
Odd parity: number of 1’s in the transmitted data is odd.
Example: Two characters and their even and odd parity
Detecting Errors

Suppose we are transmitting 7-bit ASCII characters


A parity bit is added to each character to make it 8 bits Parity can detect all single-bit
errors
• If even parity is used and a single bit changes, it will change the parity to odd, which
will be detected at the receiver end
• The receiver end can detect the error, but cannot correct it because it does not know
which bit is erroneous
Binary Storage and Registers
Registers:
◆A binary cell is a device that possesses two stable states and is capable of storing
one of the two states(i.e. Each cell stores one bit of information. Examples: flip-
flop, capacitor.
◆A register is a group of binary cells. Example: AX in x86 CPU.

A register with n cells can store any discrete quantity of information that contains

n bits.
Binary Logic
• Binary logic consists of binary variables and a set of logical operations.
• The variables are designated by letters of the alphabet, such as A , B, C, x, y, z,
etc, with each variable having two and only two distinct possible values: 1 & 0,
• Three basic logical operations: AND, OR, and NOT.
Binary Logic

❑ AND: This operation is represented by a dot or by the absence of an operator.


For example, x . y = z or xy = z is read “x AND y is equal to z.”
The logical operation AND is interpreted to mean that z = 1 if and only if x = 1 and y = 1;
otherwise z = 0.
❑ OR: This operation is represented by a plus sign.
For example, x + y = z is read “x OR y is equal to z,” meaning that
z = 1 if x = 1 or if y = 1 or if both x = 1 and y = 1.
If both x = 0 and y = 0, then z = 0.
❑ NOT: This operation is represented by a prime (sometimes by an overbar).
For example, (or ) is read “not x is equal to z,” meaning that z is what x is not.
In other words, if x = 1, then z = 0, but if x = 0, then z = 1.
The NOT operation is also referred to as the complement operation, since it
changes a 1 to 0 and a 0 to 1.
Binary Logic

Definitions of logical operations may be listed in a compact form called truth tables. A truth
table is a table of all possible combinations of the variables, showing the relation between
the values that the variables may take and the result of the operation
Logic gates
Logic gates are electronic circuits that operate on one or more input signals to produce an
output signal.
Logic gates

AND and OR gates may have more than two inputs.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy