+ All Categories
Home > Engineering > Logic Design

Logic Design

Date post: 22-Jan-2017
Category:
Upload: parthabappa
View: 63 times
Download: 0 times
Share this document with a friend
21
Department of Communication Engineering, NCTU 1 Unit 1 Introduction 1. Digital Systems 2. Number System and Conversion 3. Binary Arithmetic
Transcript
Page 1: Logic Design

Department of Communication Engineering, NCTU 1

Unit 1 Introduction

1. Digital Systems2. Number System and Conversion3. Binary Arithmetic

Page 2: Logic Design

Department of Communication Engineering, NCTU 2

1.1 Digital Systems

Page 3: Logic Design

Department of Electrical Engineering, NCTU 3

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Digital Systems: A system that can perform data computation, storage and data

input and output in digital formats

Why digital systems instead of analog systems? Easy and reliable control of data precision (number of bits) Easy and reliable circuit implementations (on/off switch)

Applications of Digital Systems: Computation, data processing, signal acquisition and processing,

automatic control, communications and measurements, etc

Input/OutputInterface

Arithmetic/Logic Unit

Data Storage

Control Unit

Page 4: Logic Design

Department of Electrical Engineering, NCTU 4

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Design of digital systems includes 3 phases: System design: design functions to meet specific applications Logic design : implement functions in logic gates Circuit design : design and implement logic gates

System design involves functional definitions and systempartitions. The aspect of system design varies a lot

Logic design means coming up with methods toimplement the defined functions, using basic logic units

Circuit design here refers to the implementations of basiclogic units such as AND, OR, Flip-Flops, etc. withresistors, diodes and transistors

We will not cover circuit design in this course

Page 5: Logic Design

Department of Electrical Engineering, NCTU 5

Logic Design Unit 1 Introduction Sau-Hsuan Wu

A simple digital system : Y = max { C, A+B} If C > A+B

Y=Celse

Y=A+B

A simple logic implementation of the above system

Yes, C1=1

Start

A+B > C

Save Y

No, C1=0

C2

A B C

Adder

Comp

Mux

Y

C1

C2

Page 6: Logic Design

Department of Electrical Engineering, NCTU 6

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Logic circuits can be categorized into two classes: Combinational logic Sequential Logic

Combinational logic’s outputs depend only on thepresent inputs: E.g. Adder, multiplier, comparator, multiplexer

Sequential logic’s output depend on both the presentand the past outputs. In general, a sequential circuit iscomposed of a combinational circuit with addedmemory elements. E.g. C = A+B

E = C+DF = CD

Page 7: Logic Design

Department of Communication Engineering, NCTU 7

1.2 Number Systems andConversion

Page 8: Logic Design

Department of Electrical Engineering, NCTU 8

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Base R representation of a rational number Any positive integer R > 1 can be chosen as the base of a

number

E.g. : converting an octal number to decimal

3 82 + 2 81 + 1 80 + 1 8-1

= 192 + 16 + 1 + 0.125= 208.125

4 3 2 1 0 1 2 3

4 3 2 1 04 3 2 1 0

1 2 31 2 3

( . )

0 1i

N a a a a a a a a

a R a R a R a R a R

a R a R a R

a R

其中where

Page 9: Logic Design

Department of Electrical Engineering, NCTU 9

Logic Design Unit 1 Introduction Sau-Hsuan Wu

For bases greater than 10, more than 10 symbols areneeded to represent the digits

Letters are usually used to represent digits greater than 9 E.g., for a hexadecimal number, we have digits

0,1,2,3,…9,A,B,C,D,E,F E.g. : converting a hexadecimal to decimal

A 162 + 2 161 + B 160 + F 16-1

= 10 256 + 2 16 + 11 + 15/16= 2603.9375

Page 10: Logic Design

Department of Electrical Engineering, NCTU 10

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Conversion of a decimal number to base R

10 2

For integer,53 110101

53 2 26 126 2 13 013 2 6 16 2 3 03 2 1 1

使用除法

10 2

For fraction,.625 .101

.625 2 1.25 1

.25 2 0.5 0

.5 2 1.0 1

使用乘法use division use multiplication

Page 11: Logic Design

Department of Electrical Engineering, NCTU 11

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Conversion between two bases R1 & R2 other thandecimal

Convert from base R1 to decimal first, then convert thedecimal number to base R2

4 10 7231.3 45.75 63.5151

45 7 6 3.75 7 5.25 5.25 7 1.75 1.75 7 5.25 5

Page 12: Logic Design

Department of Communication Engineering, NCTU 12

1.3 Binary Arithmetic

Page 13: Logic Design

Department of Electrical Engineering, NCTU 13

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Arithmetic operations in digital systems are usually donein binary because design of logic circuits to performbinary arithmetic is much simpler than decimal arithmetic

We only need switches: On 1, OFF 0 Binary addition

0 0 00 1 11 0 11 1 0 carry 1 to the next column

10

10

10

Ex.1111 carries

13 = 1101

11 = 101124 11000

Page 14: Logic Design

Department of Electrical Engineering, NCTU 14

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Binary subtraction

0 0 00 1 1 borrow 1 from the next column1 0 11 1 0

Ex.1 borrow

11101100111010

Page 15: Logic Design

Department of Electrical Engineering, NCTU 15

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Binary multiplication

0 0 00 1 01 0 01 1 1

Ex.110110111101

11010000

110110001111

Page 16: Logic Design

Department of Electrical Engineering, NCTU 16

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Binary division is similar to decimal division

Ex.1101

1011 10010001

101111101011

11011011

10

Page 17: Logic Design

Department of Communication Engineering, NCTU 17

1.4 Representation of NegativeNumbers

Page 18: Logic Design

Department of Electrical Engineering, NCTU 18

Logic Design Unit 1 Introduction Sau-Hsuan Wu

For signed integer (both positive and negative integers), the first bitin a word is used as a sign bit, with 0 for plus and 1 for minus

There are 3 types of representations of negative numbers:sign and magnitude, 2’s complement and 1’s complement

Page 19: Logic Design

Department of Electrical Engineering, NCTU 19

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Sign and magnitude:For an n-bit word, the first bit, the most significant bit (MSB), is thesign and the remaining n-1 bits represent the magnitude

Ex. 0011=+3, 1011=-3

2’s complement: A positive number is represented by a 0 followed by the magnitude A negative number is represented by its 2’s complement N*:

N* = 2n –N 1’s complement:

A negative number, -N, is represented by its 1’s complement of Ndefined as

Notice Therefore, if N* = 2n –N

(2 1)nN N 2 1 111 11 (n bits)n

00110001100111 NN

00110011* NN

Page 20: Logic Design

Department of Electrical Engineering, NCTU 20

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Addition of 2’s complement numbers: E.g. 4-bit word, n = 4

5 –6 = –1 5 + (2n –6) = 2n–1 2’s complement of 1

So the addition is carried out just as if the numbers were positive The addition of two 4-bit words becomes a 5-bit word in general

Do sign extension before addition

E.g. 5 + 6 = 11By sign extension 5 = 00101, 6 = 00110

5+6 = 01011

E.g. –5 –6 = –11By sign extension, –5 24 –5 = 11010+1 = 11011

–6 24 –6 = 11001+1 = 11010

–11 25 –6 –5 = 10101 2’s complement of 11

Page 21: Logic Design

Department of Electrical Engineering, NCTU 21

Logic Design Unit 1 Introduction Sau-Hsuan Wu

Addition of 1’s complement numbers: Similar to 2’s complement except that instead of discarding the

last carry, it is added to the n-bit sum in the position furthest tothe right, least significant bit (LSB).This is referred to as an end-around carry

–A+B (B > A) (2n 1 A) + B= B A + (2n 1) removing (2n 1)

–A –B (A+B < 2n-1) (2n 1 A) + (2n 1 B) = [2n 1 (A+B)] + (2n 1)

Similarly, do sign extension to protect from overflow

( 5) ( 6)10100110

100001

0001

End-around carry


Recommended