LBSC 690 Session 6 Data Transformation and Representation.

Post on 18-Jan-2016

228 views 0 download

Tags:

Transcript of LBSC 690 Session 6 Data Transformation and Representation.

LBSC 690

Session 6

Data Transformation and Representation

Forms of Data

1. Numerical info.

2. Character or “symbol” info.

3. Visual info.

4. Audio info.

5. Streams of specially encoded digits,e.g., “ones” and “zeros.”

6. Command or instructional information.

Data Conversion

• External data may have to be transformed before computer can process it.– What form of representation is required?

• Two options:– Digital.– Analog.

Two Major Types of Computer

• Digital:– Data is expressed in discrete, specific, separate

and distinct, values:• E.g., light/light switch.

– Two states.

• Analog:– Data varies, or is expressed, as a continuous

range of values.• E.g., temperature.

Advantages of Digital

• Simplicity and reliability.– Particularly using 2 discrete states.

• Claude Shannon’s work.– Application of Boolean Logic to switching

circuits.• Use of logical operators: and, or & not.

• Truth of logical statements.

Truth Tables: A or B

A B A or B

0 0 0

1

0 1

0 1 1

1

1 1

Truth Tables: A and B

A

B A and B

0 0 0

1 0 0

0 1 0

1 1 1

Truth Tables: Not A

A not A

1 0

0 1

Boolean Algebra of Sets

• Venn Diagrams

A

B

A=Universe of all published books

B=All scientific and technical books

Boolean Algebra of Sets II

A

B CD

A=Universe of all published books.

B= All scientific and technical books

C=All books published in English.

D=“Intersection” of B & C. What does it represent?

Number Systems

• What is:– 679?– 111?

• We are accustomed to think in the decimal system.– But there are many number systems.– See transparency.

Digits

• Decimal: 0,1,2,3,4,5,6,7,8 & 9.

• Binary system: 0 & 1.

• Ternary: 0, 1, & 2.

• Octal: 0, 1, 2, 3, 4, 5, 6 & 7.

• Hexadecimal: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E & F.

Binary Arithmetic

• Addition:

0+0=0

0+1=1

1+0=1

1+1=10

• Multiplication:

0x0=0

0x1=0

1x0=0

1x1=1

Definitions

• Binary digits:– Called “bits” for short.

• 8 bits, treated as a unit, are called a “byte.”

• 4 bits are called a “nibble.”

Measures

• A word is a generic term to describe a specific group of binary digits treated as a unit.– Words are measured by their length.

• The number of bits they contain.

• Registers are measured by their lengths:– The number of bits they contain.– May be organized on a word or byte basis.

Coding

• Use of binary numbers to represent symbols or characters.

• Two most widely used coding schemes:– ASCII – American Standard Code for

Information Interchange. (7 bits).• Extended ASCII.

– EBCDIC – Extended Binary Coded Decimal Interchange Code. (8 bits).

ASCII

• Handout.

• Representation Scheme: X 7 6 5 4 3 2 1

A : 1 0 0 0 0 0 1

a: 1 1 0 0 0 0 1

(Extended ASCII is used in every PC.)

Addressing

• Each memory location:– Has a unique number assigned to it – its

address.

• Example: In Intel 8086 memory is 1MB,– 1 million bytes.

• To be precise, it is 1,048,576 bytes.

• 1KB is 1024 bytes.

• Each memory location is like a mailbox.

Memory

• Contents are distinct from address.• Concept of “random” access:

– RAM, SRAM, DRAM, SDRAM, VRAM.

• Each memory byte can contain:1. Binary number,2. Binary coded decimal,3. ASCII character,4. Binary string.5. Instruction.(NOTE: Each of these is represented in memory by 1’s and

0’s).

Instruction

• Determines what operation is to be performed by computer.– Operation part.

• Provides information about location of data to be used or results to be stored.– Operand part (Address part).

Instruction Types

• Many different types; generally fall into 4 major categories:

1. Arithmetic.2. Logical.3. Editing.4. Input/Output (I/O).

– Total ensemble of instructions is called the instruction set.

Typical Instructions

• LOAD L 58 01011000(M) (R1) {Memory is unchanged,

R1 is changed.}

• ADD A 5A 01011010 (M) + (R1) (R1) {Memory unchanged,

Sum in R1.}

• STORE ST 50 01010000 (R1) (M) {Memory changed,

R1 unchanged.}

Sample Problem(Deliberately Simplistic)

• Problem Statement:– Maintain daily count of the number of radios in the

warehouse.• Method of Solution:

– Compute an arithmetic sum, defined as the NEW TOTAL, by adding two numbers, defined as TODAY’S RECEIPTS and YESTERDAY’S TOTAL. That is:

NEW TOTAL = YESTERDAY’S TOTAL + TODAY’S RECEIPTS.

NOTE: To simplify example, we have ignored SALES (shipments).

Procedure (Flow Chart)

Bring quantity representing YESTERDAY’S TOTAL from memory into the ALU.

Add to it the quantity from memory representing TODAY’S RECEIPTS.

Store resulting sum, the NEW TOTALin memory

Program

• Reference handout.• Note:

– Instructions and data are both stored in memory.• Both are represented by 0’s and 1’s.• They are in separate locations in memory.

• Program operates in cyclical fashion:– One instruction at a time.– Each instruction has two parts:

• A “fetch cycle” followed by an “execute cycle.”• Reference the handout.

Instruction Cycle: Fetch Cycle

MEMORY

CONTROL UNITInstruction CounterInstruction Register

ALURegister 1Register 2

………Register N

Instruction Cycle: Execute

MEMORY

CONTROL UNITInstruction CounterInstruction Register

ALURegister 1

Register 3

Programming

• Very much detail.

• Complexity and growth of instructions sets:– Intel 8086: 121 instructions.

– 80286: 144 “.

– 80386: 195 “.

– 80486: 201 “.

– Pentium: 289 “.

– Pentium Pro MMX: 346 “.

– Pentium III: 416 “.

Memory

• Areas of memory reserved for special functions.

• Primary high-speed memory in PCs is random access (RAM).– It is volatile.

• Certain memory segments are permanent:– Read only memory (ROM).

Interrupts

• Times when computer needs to be alerted to some situation or condition that needs to be handled expeditiously.– Interrupts are used to do this.– PIC’s.– Operating system provides services to handle

interrupts.

Classification of Computer Systems

1. SISD:• Single instruction, single data streams.

2. SIMD:• Single instruction, multiple data streams.

3. MISD:• Multiple instruction, single data streams.

4. MIMD:– Multiple instruction, multiple data streams.

Definitions

• Multiprocessors:– Two or more processing systems tightly connected

under integrated control.

• Pipelining: – Overlap or assembly-line organization.

• Computer “looks ahead” to next instructions.

• Distributed systems:– Network of computer systems.

• Loosely connected:– Client/Server.