chapter 7 arithmetic operations and circuits 1. 7-4 hexadecimal arithmetic 4 binary bits represent a...

30
Chapter 7 Arithmetic Operations and Circuits 1

Upload: hope-harris

Post on 23-Dec-2015

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Chapter 7

Arithmetic Operations and Circuits

1

Page 2: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-4 Hexadecimal Arithmetic

• 4 binary bits represent a single hexadecimal digit

• Addition– Add the digits in decimal– If sum is less than 16, convert to hexadecimal– Is sum is more than 16, subtract 16, convert to

hexadecimal and carry 1 to the next-more-significant column

23

Page 3: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Example 7-12

Page 4: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Hexadecimal Arithmetic

• Subtraction– When you borrow, the borrower increases by 16– See example 7-15

24

Page 5: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

25

Example 7-15

Page 6: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-5 BCD Arithmetic

• Group 4 binary digits to get combinations for 10 decimal digits

• Range of valid numbers 0000 to 1001• Addition

– Add as regular binary numbers– If sum is greater than 9 or if carry out

generated:• Add 6 (0110) saving any carry out

26

Page 7: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-6 Arithmetic Circuits• Only two inputs are of concern in the LSB

column.• More significant columns must include the

carry-in from the previous column as a third input.

27

Page 8: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits• The addition of the third input (Cin) is shown in

the truth table below.

27

Page 9: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits• Half-Adder

– No carry in (LSB column)

– The 0 output is HIGH when A or B, but not both, is high.

• Exclusive-OR function

– Cout is high when A and B are high.• AND function

28

Page 10: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits• The half-adder can also be implemented

using NOR gates and one AND gate.– The NOR output is Ex-OR.– The AND output is the carry.

28

Page 11: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Full-Adder– Provides for a carry input

– The 1 output is high when the 3-bit input is odd.

• Even parity generator

– Cout is high when any two inputs are high.• 3 AND gates and an OR

29

Page 12: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Full-adder sum from an even-parity generator

32

Page 13: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Full-adder carry out function

33

Page 14: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Logic diagram of a complete full-adder

34

Page 15: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Block diagrams of a half-adder (HA) and a full adder (FA).

35

Page 16: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic Circuits

• Block diagram of a 4-bit binary adder

36

Page 17: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-7 Four-Bit Full-Adder ICs

• Four full-adders in a single package• Will add two 4-bit binary words plus one

carry input bit.

37

Page 18: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Four-Bit Full-Adder ICs

• Functional diagram of the 7483

• Note that some manufacturers label inputs A0B0 to A1B3

• The carry-out is internally connected to the carry-in of the next full-adder.

38

Page 19: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Four-Bit Full-Adder ICs

• Logic diagram for the 7483.

39

Page 20: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Four-Bit Full-Adder ICs

• Logic symbol for the 7483

39

Page 21: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Four-Bit Full-Adder ICs

• Fast-look-ahead carry– Evaluates 4 low-order inputs– High-order bits added at same time– Eliminates waiting for propagation ripple

40

Page 22: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-9 System Design Application

• Two’s-Complement Adder/Subtractor Circuit

41

Page 23: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

System Design Application

• BCD Adder Circuit

42

Page 24: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

7-10 Arithmetic/Logic Units• The ALU is a multipurpose device• Available in LSI

package• 74181 (TTL)• 74HC181 (CMOS)• Mode Control input

– Arithmetic (M = L)– Logic (M = H)

44

Page 25: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Arithmetic/Logic Units

• Function Select - selects specific function to be performed

45

Page 26: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Summary

• The binary arithmetic functions of addition, subtraction, multiplication, and division can be performed bit-by-bit using several of the same rules of regular base 10 arithmetic.

• The two’s-complement representation of binary numbers is commonly used by computer systems for representing positive and negative numbers.

48

Page 27: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Summary

• Two’s-complement arithmetic simplifies the process of subtraction of binary numbers.

• Hexadecimal addition and subtraction is often required for determining computer memory space and locations.

• When performing BCD addition a correction must be made for sums greater than 9 or when a carry to the next more significant digit occurs.

49

Page 28: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Summary

• Binary adders can be built using simple combinational logic circuits.

• A half-adder is required for addition of the least significant bits

• A full-adder is required for addition of the more significant bits.

50

Page 29: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Summary

• Multibit full-adder ICs are commonly used for binary addition and two’s-complement arithmetic.

• Arithmetic/logic units are multipurpose ICs capable of providing several different arithmetic and logic functions.

• The logic circuits for adders can be described in VHDL using integer arithmetic.

51

Page 30: Chapter 7 Arithmetic Operations and Circuits 1. 7-4 Hexadecimal Arithmetic 4 binary bits represent a single hexadecimal digit Addition –Add the digits

Summary

• The Quartus II software provides 7400-series macrofunctions and a Library of Parameterized Modules (LPMs) to ease in the design of complex digital systems.

• Conditional assignments can be made using the IF-THEN-ELSE VHDL statements.

51