47
Lecture 1 – Digital Systems and Information Md. Saiful Islam Lecturer, Institute of Information Technology University of Dhaka 2009 IIT, DU 1

Digital System Design

Embed Size (px)

DESCRIPTION

Digital System Design. Lecture 1 – Digital Systems and Information. Md. Saiful Islam Lecturer, Institute of Information Technology University of Dhaka.  2009 IIT, DU. Overview. Digital Systems and Computers Organization of a Digital Computer Information Representation Number Systems - PowerPoint PPT Presentation

Citation preview

Page 1: Digital System Design

Lecture 1 – Digital Systems and Information

Md. Saiful IslamLecturer, Institute of Information TechnologyUniversity of Dhaka

2009 IIT, DU1

Page 2: Digital System Design

Overview Digital Systems and Computers Organization of a Digital Computer Information Representation Number Systems Arithmetic Operations Binary Numbers and Binary Coding

2009 IIT, DU 2

Page 3: Digital System Design

Digital Systems – Analog vs. Digital

2009 IIT, DU

Only assumes Discrete values Values vary over a broad range continuously

3

Page 4: Digital System Design

Digital Systems (2)

2009 IIT, DU

Close Switch

If A is 1 or asserted and turn on light bulb (Z)

Open Switch

If A is 0 or unasserted and turn off light bulb (Z)

4

Page 5: Digital System Design

Digital Systems (3)

2009 IIT, DU

Takes a set of discrete information inputs and discrete internal information (system state) and generates a set of discrete information outputs.

System State

DiscreteInformationProcessingSystem

DiscreteInputs Discrete

Outputs

5

Page 6: Digital System Design

Digital Systems (4)

Digital computers replaced analog computers:More flexible (easy to program), faster, more

precise.Storage devices are easier to implement.Built-in error detection and correction.Easier to minimize.

2009 IIT, DU 6

Page 7: Digital System Design

Types of Digital Systems

2009 IIT, DU

No state presentCombinational Logic SystemOutput = Function(Input)

State presentState updated at discrete times => Synchronous Sequential SystemState updated at any time =>Asynchronous Sequential SystemState = Function (State, Input)Output = Function (State)

or Function (State, Input)

7

Page 8: Digital System Design

Digital Systems - Design Hierarchy (1)

2009 IIT, DU

System level - Register level - Gate level - Transistor and physical design level

System level: Black box specification. Register level: Collection of registers.

Compute the sum ofa sequence ofinput numbers

Total

Input

Register A

Adder

Input

Total

Clear

Store

(a) System Level (b) Register Level

Models of a digital system that adds lists of numbers.

8

Page 9: Digital System Design

Digital Systems - Design Hierarchy (2)

2009 IIT, DU

G 1

G 4

G 2

G 3

G 5

G 6

x1

x2

x1

x4

x3

x2

x3

f(x1, x2, x3, x4, x5)

A combinational logic circuit with six gates.

Combinationallogic

network

Memory

OutputsInputs

Sequential logic circuit.

9

Page 10: Digital System Design

Digital Systems - Design Hierarchy (3)

2009 IIT, DU 10

Transistor and physical design level: Each logic gate is implemented by a lower-level transistor circuit.

Electronic Technologies:

Technology(Device Type)

PowerConsumption

Speed Packaging

RTL (Bipolar junction) High Low Discrete

DTL (Bipolar junction) High Low Discrete, SSITTL (Bipolar junction) Medium Medium SSI, MSI

ECL (Bipolar junction) High High SSI, MSI, LSIpMOS (MOSFET) Medium Low MSI, LSInMOS (MOSFET) Medium Medium MSI, LSI, VLSICMOS (MOSFET) Low Medium SSI, MSI, LSI, VLSIGaAs (MOSFET) High High SSI, MSI, LSI

Page 11: Digital System Design

Organization of a Digital Computer (1)

2009 IIT, DU

Control unit: Follows the stored list of instructions and supervises the flow of information among other components. Arithmetic/logic unit (ALU): Performs various operations. Memory unit: Stores programs, input, output, and intermediate data. I/O devices: Printers, monitors, keyboard, etc.

11

Arithmetic/logic unit

(ALU)

Controlunit

I/Odevices

Memory

Central processing unit (CPU)

High-level organization of a digital computer.

Page 12: Digital System Design

Organization of a Digital Computer (2)- Instruction Cycle

2009 IIT, DU

Fetch the next instruction into the control unit. Decode the instruction. Fetch the operands from memory or input devices. Perform the operation.Store the results in the memory (or send the results to an output device).

12

Fetchinstruction

Decodeinstruction

Fetchoperands

Performoperation

Storeresults

Instruction cycle of a stored program computer.

Page 13: Digital System Design

Organization of a Digital Computer (3)- Comp Instructions

2009 IIT, DU

Arithmetic instructions. Test and compare instructions. Branch or skip instructions. Input and output commands. Logical and shift operations.

13

Page 14: Digital System Design

Organization of a Digital Computer (4)- Information Presentation

2009 IIT, DU

Numeric data: Binary number system. Numeric (Input /Output) codes: ASCII. Instruction codes: Operation code and memory addresses of operands and result.

14

Page 15: Digital System Design

Organization of a Digital Computer (5)- Software

2009 IIT, DU 15

Programming: The process of designing a list of instructions. Application programs: Word processor, spreadsheet,

drawing programs, inventory management programs, accounting programs, etc.

System programs: Operating systems, language translation programs, utility programs, performance monitoring programs, etc.

High-levellanguageprogram

Assemblylanguageprogram

Machinelanguageprogram

Compiler

Assembler

Translation of computer programs into machine language

Page 16: Digital System Design

Organization of a Digital Computer (5)- Software

2009 IIT, DU 16

Programming: The process of designing a list of instructions. Application programs: Word processor, spreadsheet,

drawing programs, inventory management programs, accounting programs, etc.

System programs: Operating systems, language translation programs, utility programs, performance monitoring programs, etc.

High-levellanguageprogram

Assemblylanguageprogram

Machinelanguageprogram

Compiler

Assembler

Translation of computer programs into machine language

Page 17: Digital System Design

Information Representation - Signals

2009 IIT, DU 17

Information variables represented by physical quantities. 

For digital systems, the variables take on discrete values.

Two level, or binary values are the most prevalent values in digital systems. 

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

Page 18: Digital System Design

Signal Examples Over Time

2009 IIT, DU 18

Analog

Asynchronous

Synchronous

Time

Continuous in value &

time

Discrete in value & continuous

in time

Discrete in value &

time

Digital

Page 19: Digital System Design

Signal Example – Physical Quantity: Voltage

2009 IIT, DU 19

Page 20: Digital System Design

Binary Values: Other Physical Quantities

2009 IIT, DU 20

What are other physical quantities represent 0 and 1?CPU VoltageDiskCDDynamic RAM

Magnetic Field DirectionSurface Pits/LightElectrical

Charge

Page 21: Digital System Design

Number Systems – Representation

2009 IIT, DU 21

Positive radix, positional number systemsA number with radix r is represented by a

string of digits: An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m 1 A- m

in which 0 Ai < r and . is the radix point.The string of digits represents the power

series:

(Number)r = j = - m

jj

i

i = 0i rArA

(Integer Portion) + (Fraction Portion)

i = n - 1

j = - 1

Page 22: Digital System Design

Number Systems – Examples

2009 IIT, DU 22

General Decimal Binary

Radix (Base) r 10 2

Digits 0 => r - 1 0 => 9 0 => 1

0

1

2

3

Powers of 4

Radix 5

-1

-2

-3

-4

-5

r0

r1

r2

r3

r4

r5

r -1

r -2

r -3

r -4

r -5

1

10

100

1000

10,000

100,000

0.1

0.01

0.001

0.0001

0.00001

1

2

4

8

16

32

0.5

0.25

0.125

0.0625

0.03125

Page 23: Digital System Design

Special Powers of 2

2009 IIT, DU 23

210 (1024) is Kilo, denoted "K"

220 (1,048,576) is Mega, denoted "M"

230 (1,073, 741,824)is Giga, denoted "G"

240 (1,099,511,627,776 ) is Tera, denoted “T"

Page 24: Digital System Design

Arithmetic Operations- Binary Arithmetic

2009 IIT, DU 24

Single Bit Addition with CarryMultiple Bit AdditionSingle Bit Subtraction with BorrowMultiple Bit SubtractionMultiplicationBCD Addition

Page 25: Digital System Design

Single Bit Binary Addition with Carry

2009 IIT, DU 25

Given two binary digits (X,Y), a carry in (Z) we get the following sum (S) and carry (C):

Carry in (Z) of 0:

Carry in (Z) of 1:

Z 0 0 0 0

X 0 0 1 1

+ Y + 0 + 1 + 0 + 1

C S 0 0 0 1 0 1 1 0

Z 1 1 1 1

X 0 0 1 1

+ Y + 0 + 1 + 0 + 1

C S 0 1 1 0 1 0 1 1

Page 26: Digital System Design

Multiple Bit Binary Addition

2009 IIT, DU 26

Extending this to two multiple bit examples:

Carries 0 0Augend 01100 10110 Addend +10001 +10111SumNote: The 0 is the default Carry-In to the least

significant bit.

Page 27: Digital System Design

Single Bit Binary Subtraction with Borrow

2009 IIT, DU 27

Given two binary digits (X,Y), a borrow in (Z) we get the following difference (S) and borrow (B):

Borrow in (Z) of 0:

Borrow in (Z) of 1: Z   1   1   1   1

X   0   0   1   1

- Y   -0   -1   -0   -1

BS   11   1 0   0 0   1 1

Z   0   0   0   0

X   0   0   1   1

- Y   -0   -1   -0   -1

BS   0 0   1 1   0 1   0 0

Page 28: Digital System Design

Multiple Bit Binary Subtraction

2009 IIT, DU 28

Extending this to two multiple bit examples:

Borrows 0 0Minuend 10110 10110 Subtrahend - 10010 - 10011DifferenceNotes: The 0 is a Borrow-In to the least

significant bit. If the Subtrahend > the Minuend, interchange and append a – to the result.

Page 29: Digital System Design

Binary Multiplication

2009 IIT, DU 29

The binary multiplication table is simple:

0 0 = 0 | 1 0 = 0 | 0 1 = 0 | 1 1 = 1

Extending multiplication to multiple digits:

Multiplicand 1011 Multiplier x 101 Partial Products 1011 0000 - 1011 - - Product 110111

Page 30: Digital System Design

Signed NumbersSign-Magnitude

Find the binary equivalent of the magnitude Complement each bit (change 0’s to 1’s and 1’s to

0’s) Add 1

Example

30 2009 IIT, DU

Note that there is no negative zero in two’s complement format.

Page 31: Digital System Design

Binary Addition and Subtractiona-b = a+ (-b) using 2’s complementIn 2’s complement addition, the carry out of

the most significant bit is ignored.Overflow occurs when the sum is out of

range. For 4-bit numbers, that range is -8 ≤sum ≤+7.

31 2009 IIT, DU

Page 32: Digital System Design

Binary Numbers and Binary Coding

2009 IIT, DU 32

Flexibility of representationWithin constraints below, can assign

any binary combination (called a code word) to any data as long as data is uniquely encoded.

Information TypesNumeric

Must represent range of data needed Very desirable to represent data such that

simple, straightforward computation for common arithmetic operations permitted

Tight relation to binary numbersNon-numeric

Greater flexibility since arithmetic operations not applied.

Not tied to binary numbers

Page 33: Digital System Design

Non-numeric Binary Codes

2009 IIT, DU 33

Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2n binary numbers.

Example: Abinary codefor the sevencolors of therainbow

Code 100 is not used

Binary Number 000001010011101110111

ColorRedOrangeYellowGreenBlueIndigoViolet

Page 34: Digital System Design

Number of Bits Required

2009 IIT, DU 34

Given M elements to be represented by a binary code, the minimum number of bits, n, needed, satisfies the following relationships:

2n M > 2(n – 1)

n = log2 M where x , called the ceilingfunction, is the integer greater than or equal to x.

Example: How many bits are required to represent decimal digits with a binary code?

Page 35: Digital System Design

Number of Elements Represented

2009 IIT, DU 35

Given n digits in radix r, there are rn distinct elements that can be represented.

But, you can represent m elements, m < rn

Examples:You can represent 4 elements in radix r

= 2 with n = 2 digits: (00, 01, 10, 11). You can represent 4 elements in radix r

= 2 with n = 4 digits: (0001, 0010, 0100, 1000).

This second code is called a "one hot" code.

Page 36: Digital System Design

Decimal Codes- Binary Codes for Decimal Digits

2009 IIT, DU 36

Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray 0 0000 0011 0000 0000 1 0001 0100 0111 0100 2 0010 0101 0110 0101 3 0011 0110 0101 0111 4 0100 0111 0100 0110 5 0101 1000 1011 0010 6 0110 1001 1010 0011 7 0111 1010 1001 0001 8 1000 1011 1000 1001 9 1001 1100 1111 1000

There are over 8,000 ways that you can chose 10 elements from the 16 binary numbers of 4 bits. A few are useful:

Page 37: Digital System Design

Binary Coded Decimal (BCD)

2009 IIT, DU 37

The BCD code is the 8,4,2,1 code.8, 4, 2, and 1 are weightsBCD is a weighted codeThis code is the simplest, most intuitive

binary code for decimal digits and uses the same powers of 2 as a binary number, but only encodes the first ten values from 0 to 9.

Example: 1001 (9) = 1000 (8) + 0001 (1)How many “invalid” code words are there?What are the “invalid” code words?

Page 38: Digital System Design

Excess 3 Code and 8, 4, –2, –1 Code

2009 IIT, DU 38

What interesting property is common to these two codes?

Decimal Excess 3 8, 4, –2, –1

0 0011 0000

1 0100 0111

2 0101 0110

3 0110 0101

4 0111 0100

5 1000 1011

6 1001 1010

7 1010 1001

8 1011 1000

9 1100 1111

Page 39: Digital System Design

Warning: Conversion or Coding?

2009 IIT, DU 39

Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE. 

1310 = 11012 (This is conversion) 

13 0001|0011 (This is coding)

Page 40: Digital System Design

BCD Arithmetic

2009 IIT, DU 40

Given a BCD code, we use binary arithmetic to add the digits:

8 1000 Eight +5 +0101 Plus 5 13 1101 is 13 (> 9)

Note that the result is MORE THAN 9, so must be represented by two digits!

To correct the digit, subtract 10 by adding 6 modulo 16.8 1000 Eight

+5 +0101 Plus 5 13 1101 is 13 (> 9)

+0110 so add 6 carry = 1 0011 leaving 3 + cy

0001 | 0011 Final answer (two digits) If the digit sum is > 9, add one to the next significant digit

Page 41: Digital System Design

BCD Addition Example

2009 IIT, DU 41Chapter 1 41

Add 2905BCD to 1897BCD

showing carries and digit corrections.

0001 1000 1001 0111+ 0010 1001

0000 0101

0

Page 42: Digital System Design

Alphanumeric Codes- ASCII Character Codes

2009 IIT, DU 42

American Standard Code for Information Interchange

This code is a popular code used to represent information sent as character-based data. It uses 7-bits to represent:94 Graphic printing characters.34 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).

Page 43: Digital System Design

Parity Bit Error-Detection Codes

2009 IIT, DU 43

Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors.

A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors.

A code word has even parity if the number of 1’s in the code word is even.

A code word has odd parity if the number of 1’s in the code word is odd.

Page 44: Digital System Design

4-Bit Parity Code Example

2009 IIT, DU 44

Fill in the even and odd parity bits:

The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data.

Even Parity Odd Parity Message - Parity Message - Parity

000 - 000 - 001 - 001 - 010 - 010 - 011 - 011 - 100 - 100 - 101 - 101 - 110 - 110 - 111 - 111 -

Page 45: Digital System Design

Gray Code- Decimal

2009 IIT, DU 45

What special property does the Gray code have in relation to adjacent decimal digits?

Decimal 8,4,2,1 Gray 0 0000 0000 1 0001 0100 2 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1001 1000

Page 46: Digital System Design

Unicode

2009 IIT, DU 46

UNICODE extends ASCII to 65,536 universal characters codes

For encoding characters in world languages

Available in many modern applications

2 byte (16-bit) code words

Page 47: Digital System Design

2009 IIT, DU 47

References V. P. Nelson, H. T. Nagle, B. D. Carroll

and J. D. Irwin, Digital Logic Circuit Analysis and Design, Prentice-Hall, 1995.

M. M. Mano and C. R. Kime, Logic and Computer Design Fundamentals, 4th Ed. (International Ed.), Prentice-Hall, 2007.