EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer –...

35
EE3721 Computer System Principles • Academic Year 2012/2013 • HD • Subject Code – EE3721 • Lecturer – Raymond Cheung • Office • email: 1

Transcript of EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer –...

Page 1: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

EE3721 Computer System Principles

• Academic Year 2012/2013• HD• Subject Code – EE3721• Lecturer – Raymond Cheung• Office • email:

1

Page 2: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Lab. Schedule

• Commence in week 3 ()• A short briefing will be provided before the

session• Form your own group and with 2 students per

group

2

Page 3: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Computer System Engineering • Reference Textbook – • The Intel Microprocess …, Prentice-hall, Barry

Brey. ISBN 0-13-060714-2• Intel Microprocessors: Architecture, Programming

and Interfacing, Ray & Bhurchandi, McGrawHill, ISBN 0-07-120169-6

• Pentium Processor System Architecture-2nd Editions, Don Anderson/Tom Shanley-Mindshare, Inc.– Latest edition for the above titles

3

Page 4: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Reference books

• IBM PC Assembly Language and Programming - Fourth Edition (Peter Abel - Prentice-Hall International Inc.)

• The 8086 and 80286 Microprocessors Hardware, Software and Interfacing (A. Singh, W.A. Triebel, Prentice-Hall)

4

Page 5: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Teaching materials

• Available in WebCT web site (to be announced when available)

5

Page 6: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Related Topics

• Computer Architectures of microprocessors (2.5 weeks)

• Assembly Language programming (3 weeks)• Memory system overview (2 weeks)• Input/Output mechanism (2 weeks)• Other computing supporting facilities:

interrupt (1.5 weeks), communication (1.5 weeks)

6

Page 7: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Assessment methods

• Continuous assessment (40%)– Performance in Lab and online exercises (15%)– Lab report (10%)– Quiz (usually only 1 test or quiz) (usually around

week 8 or 9) (15%)

• Examine (60%)

7

Page 8: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Criteria Reference Assessment• Pass (D/D+)

– Some understanding of assembly language programming– Some understanding of other topics

• Grade C/C+– Able to write simple assembly language programs– Able to demonstrate in-depth understanding of certain topics

• Grade B/B+– Able to write assembly language program to achieve specific tasks– Able to demonstrate in-depth understanding for most topics

• Grade A/A+– Able to write assembly language program– Able to demonstrate in-depth understanding of all topics– Able to apply knowledge learnt to solve real-life problems

8

Page 9: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Objectives

• To understand the basic principles (hardware components) of a computer system

• To learn how to control a computer system using assembly language

• To learn how to design a simple computer system (eg for the development of an electronic mouse, robot, simple control system for your project)

9

Page 10: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Learning outcomes1. Given specifications of an application and the

instruction set of the microprocessor, design an assembly program to carry out the necessary operations

2. able to appreciate advanced features of the latest microprocessors

3. given a set of conditions, design a simple computer system

4. able to think logically and be able to present results

10

Page 11: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Thing that you can do after this

11

Page 12: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

More thing that you can do

12

Page 13: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

What is a computer ?????• Nowadays, computer comes

in different forms!!!!!!!!!!!!!!!!!!!

• In this subject, we try to learn the generic form of a computer!!!!!!!!!!!!!!!!

• If you are willing to spend your time, it is possible to build your own computing interface

13

Page 14: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

What is a computer?

14

Page 15: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Different forms of computer

• Can you think of a real-life example that involves the application of a microprocessor or a computer?

15

Page 16: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Computer is a digital system

• Computer is a combination of digital and analogue systems, but mainly digital

• So to learn this subject, you also need to understand basic digital system as well as binary number system

16

Page 17: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Number systems (revision)• The microprocessor (µP) is a binary device, everything

inside the microprocessor is represented by 0 and 1. • The most direct number system used inside the

microprocessor is the binary system (base 2) with only 0 and 1, for example 01010101. Each digit in the number represents a value in power of 2, starting from the RHS (Right hand side). The first digit is 20, then 21, 22 , etc. Usually, the most RHS bit is also called the LSB (least significant bit) while the most LHS bit is the MSB (most significant bit).

• So the value 01010101 = 0x27 + 1x26 + 0x25 + 1x24 + 0x23 + 1x22 + 0x21 + 1x20 = 64+16+4+1 = 85

17

Page 18: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Number system

• In base 10– 123 = 1x102 + 2x101 + 3x100

• In subtraction 0-1 = -1 but there is no (-) sign in binary system so the answer is 11. The first “1” is called the borrow bit

• In addition 1+1 = 10 the first “1” is called the carry bit

• How about 01+01 = 10 is there a carry?

18

Page 19: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Number system

• In addition, we use the term byte to represent an 8-bit data and the term word to represent 16-bit value, for a 32-bit value, it is called double word.

• If we want to represent a very large number then we need to use many bits and this is not very convenient. Therefore we usually use number systems derived from the binary system and the most commonly used number system are Octal (base 8) and hexademical (base 16) usually we just use the term Hex.

19

Page 20: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Hex number system• In octal, only digits from 0 to 7 will be used and in

hexadecimal, we use 0 to 9 and A, B, C, D, E, F to represent the values. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15

• To convert, from a binary number to a hex, it can be done very easily, starting from the RHS, every 4-bit from the binary number can be converted directly into a hex digit.

• For example: 0101 0101 is equal to 55H (H == hexadecimal), we have two 4-bit groups 0101 and 0101. The value 0101 = 5 so the binary pattern is 55H (in Hex).

• Example: 1100 0111 1010 1011 = C 7 A B H

• To convert back ABCDH = 1010 1011 1100 1101

20

Page 21: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Unsigned and signed numbers

• If a binary pattern represents both positive as well as negative values then it is regarded as signed, otherwise, it is unsigned (only positive).

• There are two types of signed notations, using a sign bit (usually the most LHS bit) and 2’s complement.

• For example using the LHS bit as a sign-bit, (0 is positive; 1 – negative )

• 10101010 = -42 while 00101010 = 42

21

Page 22: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

2’s complement

• Usually the 2’s complement system is used. To convert a value X to –X using 2’s complement, we first do a 1’s complement of X and then add 1 to the result. The 1’s complement of a binary value is to invert its 0’s and 1’s.

• Example: X = 00101010 = 42 first convert X using 1’s complement gives 11010101

• then add 1 to the result, i.e. 11010101 + 1 = 11010110 = -42 (comparing 10101010 )

22

Page 23: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Floating point representation

• As mentioned above, each digit in a binary pattern represents a value in the power of 2. In a floating point format, the digits after the decimal point represent value 2-1, 2-2, etc.

• Example, 0.1010 = 1x2-1+0x2-2+1x2-3+0x2-4 = 0.5+0.125 = 0.625

• How to represent signed floating point values will be discussed in later stage.

23

Page 24: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Floating-point format

Floating-point numbers are represented in the form X = ±F •10 ±E

F is called the fraction (or mantissa) and E is the exponent

example:

Floating-point number is usually represented in two standard (definedby IEEE )32-bit (single precision) and 64-bit (double precision). A 80-bit (extended precision) standard is also available.

24

Page 25: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

IEEE Floating-point standard

• For single precision – There are 23 bits for fraction and 8 bits

exponent and 1 sign bit

• For double precision– There are 52 bits fraction, 11 bits exponent

and 1 sign bit

• The bit formation is sign Exp. Fraction

25

Page 26: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Floating-point arithmetic

• Using the format ±F •2 ±E can implement floating point arithmetic very easily

• X = a x 2 b

• Y = c x 2 d

• X*Y = (a* c)* 2 (b+d)• X/Y = (a/c )* 2 (b-d)• How about X+Y and X-Y ??????

26

Page 27: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Example of floating point

• Given 11011101.1 express the value in binary format using single precision floating-point format– First convert the value into the format 1.XXX*2y

– 11011101.1 = 1.10111011 x 27

– So the exponent is 2 and the fraction is 1.10111011– As all floating-point values always come with the ‘1.’ so the

‘1.’ is not stored and only 10111011 is saved!!!!– 0 10000110 10111011000000000000…

Biased exponent = 7+127 = 134 27

Page 28: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Characters

• In addition to values, characters are also represented using binary codes usually in ASCII (American Standard Code for Information Interchange) code.

28

Page 29: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

ASCII table

A = 41H ; a = 61H so a>A

29

Page 30: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Chinese characters

• There are several ways of representing Chinese characters in computer – Unicode– Big5– GB2312-80 (Simplified Chinese)

• Your computer will need to have proper font installed in order to display the corresponding characters

30

Page 31: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Chinese characters (Big 5)

Big 5 is the character encoding standard most commonly used for traditional Chinese characters. Regions / countries such as Taiwan, Hong Kong are using this encoding standard.GB is for simplified Chinese charactersEvery Chinese Character is represented by a two byte code. The first byte ranges from 0x81 to 0xFE, while the second byte ranges from 0x40 to 0x7E, 0xA1 to 0xFE.

Thus, in a document that contain Chinese characters and regular ASCII characters, the ASCII characters are still represented with a single byte.

31

Page 32: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Big 5 Chinese characters

Address Character

A640H 共

AF66H 病

A741H 你

AA46H 東

http://www.khngai.com/chinese/charmap/tblbig.php

32

Page 33: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Exercises

• Convert the number -4.5 into a IEEE 32-bit floating-point pattern

• Convert 9 into a IEEE 32-bit floating point • Without using a calculator, determine

01010010 + 10101101• Without using a calculator, determine

01010010 – 10101101• What is (a-B)?

33

Page 34: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

Revision exercises• What is a Bit, a byte, a word, one K, one M • What is Hex, Oct, binary• Do you know how to convert a number into different

base systems without using a calculator?• Binary number notation (10101010 = ???)• How many different values can be represented by a

8-bit pattern?• Hexadecimal A = ??? How to convert binary

1101010101110101 to Hex?• CFH (Hex) = ???

34

Page 35: EE3721 Computer System Principles Academic Year 2012/2013 HD Subject Code – EE3721 Lecturer – Raymond Cheung Office email: 1.

More exercises

• How to present negative values in binary number system?

• How about using binary system to represent a floating number???

• What is ASCII? What is BCD? What is a string???• Do you know how to program in C/C++, Fortran,

Java, assembly language etc ???• Do you know what is a multiplexer, register,

latch? • Referring to the block diagram of a memory, do

you know what is an address; what is data?

35