Lecture 1 Slides - USC Viterbi

36
© Mark Redekopp, All rights reserved Lecture 1 Slides Intro Number Systems Logic Functions

Transcript of Lecture 1 Slides - USC Viterbi

Page 1: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Lecture 1 Slides

Intro

Number Systems

Logic Functions

Page 2: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

EE 101 in Context

EE 101

EE 201L

EE 357

EE 457

EE 454L EE 477L

EE 459L

Logic Design

Fundamentals

Logic Design, CAD Tools,

Lab tools, Project

Computer

Architecture

Using the logic

design principles

to construct

computer

processors

Using the logic

design principles

to construct

systems centered

around a

computer

processor

Physically building

and fabricating

chips that

implement the

more abstract

logic designs

VLSI

Capstone

Project Course

Page 3: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Where Does Digital Design Fit In

• Electrical, biomedical, or computer

scientists/engineers develop

algorithms for

– Wireless and communication systems

– Music and imaging systems

– Biomedical devices

• Digital design engineers take these general algorithms

and architect/design a HW/SW system to implement

them dealing with constraints of size, speed, weight,

power, etc.

• Other electrical engineers may help with the final

fabrication of the chip

Page 4: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Digital System Abstraction Levels

C / C++ / Java

Logic Gates

Transistors

HW

SW

Voltage / Currents

Assembly /

Machine Code

Applications

LibrariesOS

Processor / Memory / I/O

Functional Units

(Registers, Adders, Muxes)

Controlling

Input

(Gate )

Output

(Drain )

Source

Fx

y

z

+B

A

S

if (x > 0)

x = x + y - z;

a = b*x;

Transistors

LogicAND

gate

Functional

Units

Chips

(Processors)

Software

Code

CMPR X,0

JLE SKIP

ADD X,X,Y

SUB X,X,Z

SKIP MUL A,B,X

--

--

--

-

1110010101…

Page 5: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

ANALOG TO DIGITAL

CONVERSION

Page 6: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Electric Signals

• Information is

represented

electronically as a

time-varying voltage

– Each voltage level

may represent a

unique value

– Frequencies may

represent unique

values (e.g. sound)

Sound converted to electronic signal

(voltage vs. time)

Page 8: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Signal Types• Analog signal

– Continuous time signal where each voltage level has a unique meaning

– Most information types are inherently analog

• Digital signal

– Continuous signal where voltage levels are mapped into 2 ranges

meaning 0 or 1

– Possible to convert a single analog signal to a set of digital signals

0

1

0

1

0

vo

lts

vo

lts

timetime

Analog Digital

Page 9: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Signals and Meaning

0.0 V

0.8 V

2.0 V

5.0 V

Each voltage value

has unique meaning

0.0 V

5.0 V

Lo

gic

1L

og

ic 0

Ille

gal

Each voltage maps to ‘0’ or

‘1’ (there is a small illegal

range where meaning is

undefined)

Analog Digital

Page 10: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Analog to Digital Conversion

• 1 Analog signal can be converted to a set of digital

signals (0’s and 1’s)

• 3 Step Process

– Sample

– Quantize (Measure)

– Digitize

Analog

time

Digital

Analog to

Digital

Converter

volts

time

0

1

0

1

0

1

0

1

0

1

11000

Page 11: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Sampling

• Measure (take samples) of the signals voltage

at a regular time interval

• Sampling converts the continuous time scale

into discrete time samples

∆tSampled SignalOriginal Analog Signal

Page 12: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Quantization

• Voltage scale is divided into a set of finite numbers (e.g. 256 values: 0 – 255)

• Each sample is rounded to the nearest number on the scale

• Quantization converts continuous voltage scale to a discrete (finite) set of numbers

000

255

177

∆tSampled Signal Each sample is quantized

Page 13: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Digitization

• The measured number from each sample is

converted to a set of 1’s and 0’s

000

255

177 177 = 10110001

Each sample is quantized Quantized value is converted

to bits

Measurement Scale

Sample

Page 14: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Error

• Error is introduced because the discrete time and quantized samples only approximate the original analog signal

Original Analog Signal Sampled Signal

Page 15: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Sampling Rates and Quantization

Levels• Higher sampling rates and quantization

levels produce more accurate digital

representations

∆t

Lower sampling rate and

quantization levels

Higher sampling rate and

more quantization levels

Page 16: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Digital Sound

• CD Quality Sound

– 44.1 Kilo-samples per

second

– 65,536 quantization levels

(16-bits per sample)

– 44.1KSamples * 16-

bits/sample = 705 Kbps

• MP3 files compress that

information to 128Kbps –

320 Kbps

Page 17: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

SAMPLE PROBLEMS

Page 18: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Staircase Light Switch Logic

Page 19: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

AND, OR, NOT Gates

NOT (Inverter) AND OR

X ZX

YZ Z

X

Y

X Y Z

0 0 0

0 1 0

1 0 0

1 1 1

X Y Z

0 0 0

0 1 1

1 0 1

1 1 1

X Z

0 1

1 0

YXZ YXZ ~XXXZ or or '

AND = ‘ALL’

(true when ALL

inputs are true)

OR = ‘ANY’

(true when ANY

input is true)

Page 20: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Water Pump Problem

Page 21: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

POSITIONAL NUMBER

SYSTEMS

Page 22: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Interpreting Binary Strings

• Given a string of 1’s and 0’s, you need to know

the representation system being used, before you

can understand the value of those 1’s and 0’s.

• Information (value) = Bits + Context (System)

01000001 = ?

6510 ‘A’ASCII

Unsigned

Binary system ASCII

system

Signed System

Page 23: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Binary Number System

• Humans use the decimal number system

– Based on number 10

– 10 digits: [0-9]

• Because computer hardware uses digital

signals with 2 states, computers use the

binary number system

– Based on number 2

– 2 binary digits (a.k.a bits): [0,1]

Page 24: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Number System Theory

• The written digits have implied place values

• Place values are powers of the base (decimal = 10)

• Place value of digit to left of decimal point is 100 and ascend from there, negative powers of 10 to the right of the decimal point

• The value of the number is the sum of each digit times its implied place value

digitsplace values

Most

Significant

Digit (MSD)

Least

Significant

Digit (LSD)base

= 8*102 + 5*101 + 2*100 + 7*10-1(852.7)10

Page 25: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Binary Number System

• Place values are powers of 2

• The value of the number is the sum of each bit times its implied place value (power of 2)

bitsplace values

Most

Significant

Bit (MSB)

Least

Significant Bit

(LSB)base

(110.1)2 = 1 * 22 + 1 * 21 + 0 * 20 + 1 * 2-1

(110.1)2 = 1*4 + 1*2 + 1*.5 = 4+2+.5 = 6.510

Page 26: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Number Systems

• Number Systems consist of a base or radix, r,

and r coefficients or digits (usually 0 – r-1).

• Decimal (Base 10): 0,1,2,3,4,5,6,7,8,9

• Binary (Base 2): 0,1

• Octal (Base 8): 0,1,2,3,4,5,6,7

• Hexadecimal (Base 16):

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F (A thru F = 10 thru 15)

Page 27: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Converting to Decimal

(6523)8 = 6*83 + 5*82 + 2*81 + 3*80

= 3072 + 320 + 16 + 3 = (3411)10

(AD2)16 = 10*162 + 13*161 + 2*160

= 2560 + 208 + 2 = (2770)10

• Decimal equivalent is…

… the sum of each coefficient multiplied by its

implicit place value (power of the base)

Page 28: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Decimal and Binary

9

4

0

100’s

9

3

5

9

7

5

10’s 1’s

1

1

1

1

1

4’s

1

0

1

0

1

1

1

1

0

1

2’s 1’s

0

1

0

0

1

8’s

1

0

0

1

1

16’s

Decimal Binary

99910 =

43710 =

2310 =

1310 =

710 =

2010 =

3110 =

5510 =

Page 29: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Powers of 2

20 = 1

21 = 2

22 = 4

23 = 8

24 = 16

25 = 32

26 = 64

27 = 128

28 = 256

29 = 512

210 = 1024

512 256 128 64 32 16 8 4 2 11024

Page 30: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Anatomy of a binary number

(1011)2 = 1*23 + 0*22 + 1*21 + 1*20

Least Significant

Bit (LSB)

Most Significant

Digit (MSB)

coefficientsplace values

radix

(base)

Page 31: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Unique Combinations

• Given n digits of base r, how many unique

numbers can be formed? rn

Main Point: Given n digits of base r, rn unique numbers can

be made with the range [0 - (rn-1)]

2-digit, decimal numbers

3-digit, decimal numbers

4-bit, binary numbers

6-bit, binary numbers

0-90-9

100 combinations:

00-99

0-10-10-10-1

1000 combinations:

000-999

16 combinations:

0000-1111

64 combinations:

000000-111111

Page 32: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Concepts & Skills

• Concepts

– Analog to Digital Conversion Process

– Bits have no inherent meaning…meaning is assigned based on

the system of representation or problem needs

– Positional Number systems

– Logic Function Visualization

• Skills

– Describe a specific logic function using a given representation

– Convert a number in base r to base 10

• Σ (Coefficients * Place Values)

– Determine how many digits are needed to represent a number in

base r

Page 33: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

PREVIOUS YEARS

Page 34: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Today’s Digital Systems

• Computer Fact: Any algorithm can be implemented either in

SW, HW, or a mixture of both

– HW-only approach: Build circuits to carry-out the specific calculations

(Advantages: Faster, less power)

– HW/SW approach: Build circuits to carry-out generic operations

specified by a SW program (Advantages: Cheaper, more flexible)

• Digital systems are often a mix of custom HW and general-

purpose processors all combined on a single chip called a

System-On-Chip (SoC)

– What once took several chips now require only 1 or 2 with all

functionality integrated on that chip

Page 35: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Processing Logic Approaches

• Custom Logic– Logic that directly implements a

specific task

– Example above may use separate adders and a multiplier unit

• General Purpose Processor– Logic designed to execute SW

instructions

– Provides basic processing resources that are reused by each instruction

• Design Decision: HW only or HW/SW– HW only = faster

– HW/SW = much more flexible

+ *

Data storageInstruc.

Store

ADD X,Y

ADD A,B

MUL X,A

GP Proc. Implementation

of (X+Y)*(A+B)

+

+

*

X

Y

A

B

Out

Custom Logic

Implementation

Page 36: Lecture 1 Slides - USC Viterbi

© Mark Redekopp, All rights reserved

Anatomy of a Digital System

• Start with the chip inputs and output (I/O)

– Inputs: Wheel sensor, audio-in, pressure/click sensor

– Outputs: LCD, audio-out

• Convert everything to digital for processing

• Processing Logic Approaches

– General Purpose Processor executing algorithms in SW

– Custom (Application-Specific) logic executing algorithm in HW only

• Convert back to analog for certain outputs

Analog to

Digital

Conversion

(ADC)

Analog

Outputs

Digital

Outputs

Sensors Digital

Processing

Inte

rco

nne

ct

Microprocessors

(Software

executing on

hardware )

Custom Logic

Inte

rco

nne

ct

Outputs

Digital to

Analog

Conversion

(DAC)

Analog

Inputs

Digital

Inputs

Clock

Reset