Вы находитесь на странице: 1из 21

EE353: : Introduction to Microprocessors

By Dr. Ridha Jemal Electrical Engineering Department College of Engineering King Saud University
Email: rdjemal@ksu.edu.sa http://faculty.ksu.edu.sa/djemal/default.aspx

Textbook:

The 80X86 IBM PC and Compatible Computers: Assembly Language, Design, and Interfacing Volumes I & II, Muhammad al-Mazidi, Prentice Hall. Intel Microprocessors 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium, Pentium Pro, and Pentium II Processors: Architecture, Programming, and Interfacing, Barry B. Brey, Prentice Hall

Course Grading Midterm#1 Midterm#2 Tutorial Attendance & Project Final Exam
Dr. Ridha Jemal

(20%) (20%) (10%) (10%) (40%)


Page : 1

EE353: Introduction to Microprocessors

EE353: : Introduction to Microprocessor


Course Outlines
Chapter 1: Introduction to Microprocessors and Computers Chapter 2: Microcomputer Architecture and Programming Model Chapter 3: Addressing Modes for the 8086 Microprocessors Chapter 4: Data Transfer Instructions Chapter 5: Arithmetic and Logical Instructions Chapter 6: Program Control Instructions: Jump and Call Instructions Chapter 7: Program Control Instructions: Software Interrupts Chapter 8: Assembly Language Programming Chapter 9: The 8086 Pins Chapter 10: Hardware, software and interrupt instructions Chapter 11: Memory interface, bus cycles, memory control signals, and memory addressing hardware. Chapter 11: The PIA (8259A) interrupt controller
Dr. Ridha Jemal EE351: Introduction to Microprocessors Page : 2

Chapter 1 : Introduction to Microprocessors and Computers


By Dr. Ridha Jemal
Electrical Engineering Department College of Engineering King Saud University 1431-1432 1.1. Introduction : Computer Element of a Computer 1.2. Hardware and Software in Computer 1.3. Abstraction Level in the Computer 1.4. Instructions, Translation Programs and Program distribution 1.5. Number Representation in the Computer 1.6. Performing Arithmetic 1.7. Storage and Data Structure
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 3

Element of Computers
A useful microprocessor-based computer system must have : Central Processing Unit (CPU) : To manipulates data and control I/O devices according to the program stored in memory. Memory: To store programs and data Input/Output Devices: Allow CPU to communicate with external hardware Bus System: Connect everything together Address, Data Control signals
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 4

Element of Computers

A Simple architecture of a Microprocessor-Based Computer :

Data Bus

I/O Interface

I/O Devices Keyboards Monitors Relays

Address Bus Control Bus

Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 5

Hardware and Software in Computer


Hardware: The parts of the computer you can touch : Electronic circuits (Processor, coprocessor, memories, wires) Keyboard, Display Software: Programs : Consists of instructions telling the computer what to do Ability to run different programs makes the computer a General Purpose Machine Abstract Hardware and Software are logically equivalent - Simulation Programs - Emulation of other Computers
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 6

Abstraction Levels in Computer


From Programmers Point-of-view: High-Level Programming Languages Assembly Language Machine code Logic Gates Transistor Level Working at Higher Levels:

Programming is easier Programs are more portable (hardware independent) Little or no knowledge if machine required Working at Lower Levels:
More control over the machine Possible to write very small, efficient programs
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 7

Abstraction Levels in Computer


From Users Point-of-view:
Applications Software Operating System Software (MsDos, Windows, Unix, Linux, VMS) Hardware (PC, Workstation, Mainframe)
Applications are written for a given operating systems OS Shields the application from the hardware Different combinations of Hardware Platform, OS and Applications are possible

Examples:
PC... MS-DOS... MS-Word PC... UNIX... EMACS Mac... System7... MS-Word HP 9000/715... UNIX... EMACS
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers

Page: 8

Instructions Translation Programs Program Distribution


Instructions:
Each type of CPU has an instruction set : Move, ADD, SUB, Load Store, Machine code programs use combinations of these instructions sorted as files of binary information: Executable File = Instruction + Data Machine Code is different for each CPU Executable files wont work on different CPUs Some CPU families maintain back-compatibility
o PC: 8086, 80286, 386, 486, Pentium (586) o Mac: 68000, 68020, 68030m 68040

Translation Programs :
Compiler: translate High-level language (HLL) file to file of Machine
code instruction (HLL is independent of CPU) Ex: C, Fortran, Java.

Assembler: Translates Assembly language file to Machine file


Assembly language is specific to CPU.
EE353: Chapter 1 : Introduction to Microprocessors and Computers
Page: 9 Dr. Ridha Jemal

Instructions Translation Programs Program Distribution


Translation Programs :
Interpreter: Translates HLL instructions to Lower Level instructions on-the-fly
Machine Code instructions (call sub-programs for each HLL instruction) Alternatively: "Virtual Machine". Generally much slower execution than machine code programs Examples: LISP, Prolog, BASIC

Program Distribution :
Executable Files
Can't (easily) change: not human-readable Users obtain Applications in this format

Source Code
HLL or Assembly Language: human-readable Can change and re-compile/assemble "portable" source code compiles/runs on different CPU's and OS's (GOOD)
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 10

Number Representation in the Computer


Decimal System:
A decimal number 7251 represents a quantity equal to : 7 thousands + 2 hundreds + 5 tens + 1 unit To be more exact this number should be written as: 7 x 103+ 2 x 102 + 5 x 101 + 1 x 100 In general a number with decimal point is represented by a series of coefficients as follows : a4 a3 a2 a1 a0 a-1 a-2 a-3 The aj coefficients are any of the 10 digits (0, 1, 2, , 9), and the subscript value j gives the place value and, hence, the power of 10 by which the coefficient must be multiplied. This can be expressed as: a4x104 + a3x103+ a2x102 + a1x101+ a0x100 + a-1x10-1 + a-2x10-2+ a-3x10-3 The General form can be expressed as: anx10n + an-1x10n-1 + + a0x100 + a-1x10-1 + + a-mx10-m n = (digit number before the point )-1 m = digit number after the point
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 11

Number Representation in the Computer


Binary Numbers:
Binary numbers written as groups of Binary Digits ("Bits") Value of bits: Right-hand bit = 1 (20) Next on left = 2 (21) Next on left = 4 (22) etc Bit on right-hand side: "Least Significant Bit (LSB) Bit on left-hand side: "Most Significant Bit" (MSB) Using n bits can represent 2n different combinations e.g. 2 bits ... 22 = 4 combinations 4 bits ... 24 = 16 combinations 8 bits ... 28 = 256 combinations Computers deal with Bits, usually in groups of 4: 8 bits = 1 byte 4 bits = 1 nybble
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 12

Number Representation in the Computer


Binary Numbers:
Large binary numbers are cumbersome, easier to use Short-hand notations OCTAL Groups of 3 bits 3 bits: 8 combinations... use digits 0-7 Octal is Base 8 eg. 9, base 10 = 001001, base 2 = 11, base 8 HEXADECIMAL Groups of 4 bits 4 bits: 16 combinations... ... use digits 0-9 and A, B, C, D, E, F Hexadecimal is Base 16 eg. 30 base 10 = 00011110 base 2 = 1E base 16 Also written "$1E" or "1Eh"

Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 13

Number Representation in the Computer


Everything in the Computer is represented as Binary Numbers
Data

Integers
Unsigned integers +ve nbrs:0,1,2 Signed integers +ve and ve nbrs: .. -3,-2,-1,0,1,2,3

Real number
Floating point numbers 5.61, -32, -2,6x10-6

Characters
a,b, .,z, A, Z, ?!

Unsigned Numbers:
Represent the number 23 using 8-bit unsigned form 00010111

MSB (Most Significant Bit)

LSB (least Significant Bit)

Find the decimal value of the 8-bit unsigned number: 0 1 1 0 1 0 1 0 (0 1 1 0 1 0 1 0)2 = (116)10
EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 14

Dr. Ridha Jemal

Character Sets
ASCII - American Standard Code for Information Interchange
a.k.a ISO 646-1973 (international) BS 4730: 1974 (British Standard) 7-bit code (128 different characters) Numerals, punctuation and letters American alphabet... ... no symbols for , , etc. Still VERY widely used EBCDIC - Extended Binary-Coded-Decimal Interchange Code Proprietary to IBM 8-bit code Not compatible with ASCII ISO Latin1 - 8-bit code Extension to ASCII (ASCII is compatible) Has characters for European languages Future - include ALL characters from ALL languages (!) Unicode (16 bits) ISO 10646 bits)1 : Introduction to Microprocessors and Computers Page: 15 Dr. Ridha Jemal EE353:(32 Chapter

Number with Different Representations


Decimal (Base 10) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
Dr. Ridha Jemal

Binary (Base 2) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Octal (Base 8) 00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17

Hexadecimal (Base 16) 0 1 2 3 4 5 6 7 8 9 A B C D E F

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 16

Standard Multiplication Factors and Prefixes Unit of Storage


Multiplier
1 000 000 000 000 1 000 000 000 1 000 000 1 000 0.001 0. 000 001 0.000 000 001 0.000 000 000 001 1 kilobyte (1k) 1 Megabyte (1Mb) 1 Gigabyte (1Gb) 1 Terabyte (1Tb)
Dr. Ridha Jemal

Prefix
= = = = = = = = = = = = 1012 109 106 103 10-3 10-6 10-9 10-12 tera giga mega kilo milli micro nano pico = = = =

Symbol
T G M k m n p 1024 bytes 1024 kbytes 1024 Mbytes 1024 Gbytes

210 bytes 220 bytes 230 bytes 240 bytes

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 17

Negative Numbers
Number line extends in both directions:

Ways to represent numbers less than zero: The sign is represented by a bit placed in the leftmost position of the number. The convention is to make the sign bit 0 for positive 1 for negative.

Signed Magnitude
Use MSB as a flag: 0=+ve, 1=-ve ("sign bit") All other bits hold the magnitude eg. using 4 bits 0110 = 6 1010 = -2

0 1010010 as unsigned number is equal to : 1 1010010 as unsigned number is equal to : 1 1010010 as signed number is equal to :
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 18

Negative Numbers
Ones Complement

Given a number N in base 2 having n digits, the 1s complement of N is defined as (2n 1) N


N=4 ; 24= 100002 and 24 1=1111. The 1s complement is obtained by subtracting each digit from 1. We have one of the following cases :1 -0 or 1-1. The 1s complement is obtained by changing 1s to 0s and 0s to 1s

Twos Complement
To negate number: Invert all bits and add 1 ; eg. -2 using 8 bits * 0000 0010 inverted is 1111 1101 * Add 1: 1111 1110 (-2) Another way: Start writing down the number from left. Write the number exactly as it appears until the first one. Write down the first one and invert all digits to its left eg. +8 = 00001000 1000 writ number to first one 1111 invert the remaining bits -8 = 11111000
Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 19

Negative Numbers Arithmetic


A-B = A+(-B) using the 2s complement Example : +35 -72 = ???
+ 35 - 72 00100011 11001000 00100011 10111000 2s complement 0f 01001000 --------------------------------------11011011 Its a negative number,

we take its 2s complement which is : 00100101 equal to - 37

Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 20

Fractional Representation
Fixed Point

Floating Point
Represent as: (s) a.m 2e m = mantissa e = exponent s = sign (+ or -) Store as: "Normalise" so a is always 0 (or always 1) Gives much wider range than fixed point Many CPUs support floating-point arithmetic

Dr. Ridha Jemal

EE353: Chapter 1 : Introduction to Microprocessors and Computers Page: 21

Вам также может понравиться