1 / 9

ECE 291

ECE 291. Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463 CSRL. Spring 2000. Number Systems - Review ECE 290!!. Decimal numbers (or base 10 system) - Notation: 0,1,…9: Example: 378 = 3 * 10 2 + 7 * 10 1 + 8 * 10 0

arav
Download Presentation

ECE 291

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 291 Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463 CSRL Spring 2000 ECE 291 -- Spring 2000

  2. Number Systems - Review ECE 290!! • Decimal numbers (or base 10 system) - Notation: 0,1,…9: • Example: 378 = 3 * 102 + 7 * 101 + 8 * 100 • Binary numbers (or base 2 system) - Notation: 0 and 1: • Example: (001101)2 = 1 * 23 + 1 * 22 + 0 * 21 + 1 * 20 = 8+4+1=(13)10 • Hexadecimal numbers (or base 16 system) - Notation: 0..9,A,B,C,D,E,F: • Example: 52A4F = 5*164 + 2*163 + 10*162 + 4*161 + 15*160 • Many other representations • BCD (Binary Coded Decimal): decimal numbers represented in binary notation with each decimal digit represented by its 4-bit binary encoding: • Example: 728 in BCD is 0111 0010 1000 ECE 291 -- Spring 2000

  3. Base Conversion • Always easy to convert from any base b to decimal: just compute the sum of products - result is in decimal. • Converting from decimal to base b: Successive division or (remainder) decimal with the largest power of b - successive quotients form base b representation. • Example: Convert 77 to binary representation. • Divide 77 by 64 (26) - Q = 1 R=13 • Divide 13 by 8 (23) - Q = 1 R=5 • Divide 5 by 4 (22) - Q = 1 R=1 • Divide 1 by 1 (20) - Q = 1 R=0 --- DONE • Result: 77 = 1 0 0 1 1 0 1 • Put 1’s where Q=1 and 0’s in the remaining positions ECE 291 -- Spring 2000

  4. Converting Fractional Part • 1- Multiply fraction with base • 2- Save integer digit (if any) • 3- Repeat until remainder=0 or accuracy is obtained • 4- The successive digits form the converted fractional representation • Example: Converting .173 to octal representation • .173 X 8 = 1.384 Save 1 • .384 X 8 = 3.072 Save 3 • .072 X 8 = 0.576 Save 0 • .173 in base 10 = .130… octal ECE 291 -- Spring 2000

  5. Radix-1 & Radix Complement Representation • One’s complement representation: • Subtract n-bit binary representation from n-bit all 1’s (radix-1) • Two’s complement representation: • As in One’s complement + add 1 to the result (radix) • One of the problem with (radix-1) complement representation is inability to uniquely represent zero. • Two’s complement gives you the inverted (negated) number: if you add a number and its (radix) complement discarding any overflow, the result is ZERO! ECE 291 -- Spring 2000

  6. Signed & Unsigned Representations • First bit in binary rep. is sign bit: • s=0: positive (+) • s=1: negative (-) • Two quick schemes to represent a negative number N (any of them will work): • Invert all bits then add 1 (2’s complement) • Scan N from right to left: copy 0’s, copy first 1, invert the rest • Sign-extending a number: copy sign bit into extra leftmost positions ECE 291 -- Spring 2000

  7. Memory Objects & Data Types • Data Types • Numbers • bit (eg: 1) • nibble = 4 bits • DB:byte = octet = 8 bits • DW:Word = 2 bytes = 16 bits (80x86 terminology) • DD:DoubleWord = 4 bytes = 32 bits (80x86 terminology) • Intel uses little endian format (i.e., LSB at lower address) • Signed Integers (2's complement) ECE 291 -- Spring 2000

  8. Memory Objects (Cont.) • Text • Letters and characters (7-bit ASCII standard) • 'A'=65=0x41 • Extended ASCII (8-bit) allows for extra 128 graphics/symbols) • Collection of characters = Strings • Collection of Strings = Documents • Programs • Commands (MOV, JMP, AND, OR, NOT) • Collections of commands = procedures/functions/subroutines • Collection of subroutines = programs ECE 291 -- Spring 2000

  9. Memory Objects (Cont.) • Floating point numbers (covered later) • Images (GIF, TIF, JPG, BMP) • Video (MPEG, QuickTime, AVI) • Audio (voice, music) ECE 291 -- Spring 2000

More Related