arithmetic operations and circuits lecture 5. binary arithmetic let’s look at the procedures for...

29
Arithmetic Operations and Circuits Lecture 5

Upload: cecilia-sherilyn-lyons

Post on 23-Dec-2015

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Arithmetic Operationsand Circuits

Lecture 5

Page 2: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Binary Arithmetic

let’s look at the procedures for performing the four basic arithmetic functions: addition,subtraction, multiplication, and division

Addition

The procedure for adding numbers in binary is similar to adding in decimal, except thatthe binary sum is made up of only 1’s and 0’s. When the binary sum exceeds 1, youmust carry a 1 to the next-more-significant column, as in regular decimal addition

Page 3: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Addition

Page 4: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Subtraction

Page 5: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Subtraction

Page 6: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Multiplication

The procedure for the multiplication is as follows:1. Multiply the bit of the multiplier times the

multiplicand.

2. Multiply the bit of the multiplier times the multiplicand. Shift the result one position to the left before writing it down.

3. Repeat step 2 for the bit of the multiplier. Because the bit is a 0, the resultis 0.4. Repeat step 2 for the bit of the multiplier.5. Repeating step 2 for the four leading 0’s in the multiplier will have no effecton the answer, so don’t bother.6. Take the sum of the four partial products to get the final product of 143 decimal.(Written as an 8-bit number, the product is 1000 11112.)

Page 7: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Multiplication

Page 8: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Division

Page 9: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Representation

To be able to represent both positive and negative numbers, the two’s-complement format uses the most significant bit (MSB) of the 8- or 16-bit number to signify whether the number is positive or negative

The MSB is therefore called the sign bit and is defined as 0 for positive numbers and 1 for negative numbers

The range of positive numbers in an 8-bit system is 0000 0000 to 0111 1111 (0to 127). The range of negative numbers is 1111 1111 to 1000 0000 ( -1 to -128)

Page 10: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
Page 11: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Representation

Page 12: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Representation

Page 13: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Arithmetic

All four of the basic arithmetic functions involving positive and negative numbers can be dealt with very simply using two’s-complement arithmetic

Subtraction is done by adding the two two’s-complement numbers

Page 14: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Arithmetic

Page 15: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Hexadecimal Arithmetic

A method of representing groups of 4 bits as a single digit. Hexadecimal notation has been widely adopted by manufacturers of computers and microprocessors because it simplifies the documentation and use of their equipment.

Page 16: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
Page 17: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Hexadecimal Arithmetic

Subtraction of hexadecimal numbers is similar to decimal subtraction, except thatwhen you borrow 1 from the left, the borrower increases in value by 16

Page 18: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

BCD Arithmetic

Digital electronics naturally works in binary, and we have to group four binary digits together to get enough combinations to represent the 10 different decimal digits. This 4-bit code is called binary-coded decimal (BCD).

Page 19: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
Page 20: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Arithmetic Circuits

All the arithmetic operations and procedures can be implemented using adders formed from the basic logic gates. For a large number of digits we can use medium-scale-integration (MSI) circuits, which actually have several adders within a single integrated package

Basic Adder Circuit

(a) Addition of two 2-bit binary numbers; (b) truth table for the LSB addition;(c) truth table for the more significant column

Page 21: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Half-Adder

Full-Adder

Page 22: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
Page 23: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Block Diagrams

We can simplify HA and FA representation by just drawing a box with the input and output lines

Block diagram of a 4-bit binary adder.

Page 24: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Four-Bit Full-Adder ICs

Page 25: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Two’s-Complement Adder/Subtractor Circuit

Page 26: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,
Page 27: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Arithmetic/Logic Units

Arithmetic/logic units (ALUs) are available in large-scale IC packages (LSI).

The LSI circuits are generally considered to be ICs containing from 100 to 10,000 gate equivalents.

Typically, an ALU is a multipurpose device capable of providing several differentarithmetic and logic operations.

The specific operation to be performed is chosen by theuser by placing a specific binary code on the mode select inputs.

Microprocessors mayalso have ALUs built in as one of their many operational units. In such cases, the specific operation to be performed is chosen by software instructions.

Once the mode control (M) is set, you have 16 choices within either the logic or arithmetic categories.

The specific function you want is selected by applying the appropriatebinary code to the function select inputs (S3 to S0)

Page 28: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,

Arithmetic/Logic Units

Page 29: Arithmetic Operations and Circuits Lecture 5. Binary Arithmetic let’s look at the procedures for performing the four basic arithmetic functions: addition,