1.81k likes | 1.96k Views
EE3121 Computer System Engineering. Academic Year 2011/2012 BENG Subject Code – EE3121 Lecturer – Y.F. Fung Office (Y.F. Fung) : CF605 email: eeyffung@polyu.edu.hk Consultation: Friday afternoon. Lab. Schedule. Commence in week 5 A briefing will be provided before the session
E N D
EE3121 Computer System Engineering • Academic Year 2011/2012 • BENG • Subject Code – EE3121 • Lecturer – Y.F. Fung • Office (Y.F. Fung) : CF605 • email: eeyffung@polyu.edu.hk • Consultation: Friday afternoon
Lab. Schedule • Commence in week 5 • A briefing will be provided before the session • Form your own group and with 2 students per group
Reference Textbook • The Intel Microprocess …, Prentice-hall, Barry Brey. ISBN 0-13-060714-2 • Computer Organization and Embedded Systems, C. Hamacher, Z. Vranesic et al, McGraw Hill, 2012 • 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
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)
Teaching materials • Available in WebCT web site • Also some useful information can be found in ftp.ee.polyu.edu.hk/yffung/ee3231
Related Topics • Computer Architectures of microprocessors (2.5~3 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)
Assessment methods • Continuous assessment (40%) • Performance in Lab and online exercises (10%) • Lab report (10%) • Quiz (usually only 1 test or quiz) (usually around week 8 or 9 after the first 3 topics) (20%) • Examine (60%)
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
Objectives • To understand the basic principles (hardware components) of a computer system • To learn how to control a computer system using assembly language programming • To learn how to design a simple computer system (eg for the development of an electronic mouse, robot, simple control system for your project)
Learning outcomes 1. 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
Attention!!!!!!!!!!!!! • This is not a traditional “Engineering” subject!!!!!!!! • Equations – almost none!!!!!! • Try to think, understand and learn • Do not try to memorize
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 game console or a cell phone
What is a computer? Is the structure of a tablet very different from a traditional PC?
The PC is dead • “It was fun while it lasted, but as of 2011 the era of the desktop computer is officially over.”Read more: http://www.foxnews.com/scitech/2011/01/11/pc-is-dead-ces-tablets-smartphone/#ixzz1X1jBuY8N
Different forms of computer • Can you think of a real-life example that involves the application of a microprocessor or a computer?
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
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
Number system • In base 10 • 123 = 1x102 + 2x101 + 3x100 • In subtraction 0-1 = 11 because there is no (-) sign in binary system. The first “1” is called the borrow bit • In addition 1+1 = 10 the first “1” is called the carry bit
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.
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: 01010101 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
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
2’s complement • Usually the 2’s complement system is used. To convert a value from 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 with pattern using sign-bit 10101010 )
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?
Floating-point format Floating-point numbers are represented in the form X = ±F •2 ±E Fis called the fraction (or mantissa) and E is the exponent Floating-point number is usually represented in two standard (defined by IEEE ) 32-bit (single precision) and 64-bit (double precision). A 80-bit (extended precision) standard is also available.
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
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 = (axc)* 2 (b+d) • X/Y = (a/c )* 2 (b-d) • How about X+Y and X-Y ??????
Floating-point format For single precision format • If E=255, F0; NaN (not a number) • If E=255, F=0, S=1; then –infinity • If E=255, F=0, S=0; then +infinity • If 0<E<255 , X = (-1)S*2* (E-127) *(1.F) • If E=0, F 0, X = (-1)S*2* (-126) *(0.F) • If E=0, F=0, S=1 then X = -0 • If E=0, F=0, S=0 then X = +0
Example of floating point • Given 6.125 express the value in binary format using single precision floating-point format • First convert the value into the format 1.XXX*2y • 6.125 = 1.53125 x 22 • So the exponent is 2 and the fraction is 1.53125 • As all floating-point values always come with the ‘1.’ so the ‘1.’ is not stored and only 53125 is saved!!!! • 0.53125 = .10001 • 0 10000001 10001000000000000… E-127 = 2 => E=129
Exercise • 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
Characters • In addition to values, characters are also represented using binary codes usually in ASCII (American Standard Code for Information Interchange) code.
ASCII table A = 41H ; a = 61H so a>A
Chinese characters • Chinese characters and other non-ASCII characters are represented by two bytes • There are different coding systems to represent Chinese characters such as Unicode, Big5 etc. • A font file must be installed in order to display the corresponding characters
Big 5 code • Every Chinese Character is represented by a two byte code. The first byte ranges from 0xA1 to 0xF9, while the second byte ranges from 0x40 to 0x7E, 0xA1 to 0xFE • Since the MSB of the two byte code is always set. Thus, in a document that contain Chinese characters and regular ASCII characters, the ASCII characters are still represented with a single byte.
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) = ???
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?
Microprocessor/Microcomputer What is a Microcomputer • A complete computer based on a particular microprocessor chip. • So the microprocessor is the most important component in a microcomputer • So to study a microcomputer system, we must first understand the microprocessor What is a Microprocessor • Processor-on-a-chip can be described as a microprocessor. • 8051 series, 8086, Pentium series, etc
Block diagram of a generic microcomputer system Hard Disk CD ROM RAM Data and address bus Keyboard, mouse Monitor, printer
Microprocessor based system such as an electronic mouse uP with Control program motor sensor Output Input
Features of microprocessor • Operating frequency • Size of register and how many? • Size of data bus • Size of address bus • Size of cahce • Number of core
Different types of microprocessor • Microprocessors can also be classified based on the instructions. There are two fundamentally different approaches in the design of instruction set. One popular approach is called Reduced Instruction Set Computers (RISC). In a RISC, each instruction occupies exactly one word. Examples include ARM, PIC. • Devices using ARM processor – Blackberry • Cortex processor is also from ARM
CISC • An alternative to RISC is to make use of more complex instructions which may span more than one word of memory, and which may specify more complicated operations. Processors based on this idea is called Complex Instruction Set Computer (CISC). The Intel x86 CPUs and AMD processors are examples of CISC
The Intel 8086 Microprocessor • The 8086 is a popular device used in the early 70’s and 80’s and its architecture is simple and suitable for teaching computer architecture • Once we gain the basic concept of the 8086, we can then discuss the more advanced microprocessors • Many features found in 8086 are still being embedded in modern microprocessors but enhanced!
8086 Microprocessor • This is a 16-bit microprocessor chip manufactured by high-performance metal-oxide semiconductor (HMOS) technology • Circuitry on chip is approximately 29,000 transistors • Comes in a 40-pin package
Self test • Do you know what does it mean by 16-bit, 32-bit, or 64-bit processor? • How would you describe an Intel Core2 Duo CPU ?
Basic 8086 features • True 16-bit microprocessor with 16-bit internal and external data bus • The address bus and data bus are multiplexed??? • Multiplex – address and data share the same pin!! • A 20-bit address bus which allows access to 1 MB of memory. • Can address up to 64K byte-wide I/O ports • Or 32K word-wide ports (word = 16 bits) • Details regarding I/O ports will be discussed in the I/O System
Pins layout for 8086 A/D – address/data (address and data share the pins - multiplexed) Also pay attention to “active high” and “active low” signals
8086 Features • The 8086 has two modes – min. and max. • Min. mode – used as a typical microprocessor • Max. mode – use with multiple processors, usually for floating-point arithmetic) • The mode selection is via the MN/MX input