slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC PowerPoint Presentation
Download Presentation
Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC

Loading in 2 Seconds...

play fullscreen
1 / 96

Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC - PowerPoint PPT Presentation


  • 136 Views
  • Uploaded on

Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC Assignment #6: DEBUG EXERCISES Quiz(zes) due: Quiz #5: Base Arithmetic Quiz #6 (Complement Arithmetic) Note: Quiz #7 (Debug) will be due next Monday Emulator Progress Worksheet 1 will be due next Monday

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC Assignment #6: DEBUG EXERCISES Quiz(zes) due: Quiz #5: Base Arithmetic Quiz #6 (Complement Arithmetic) Note: Quiz #7 (Debug) will be due next Monday Emulator Progress Worksheet 1 will be due next Monday Today is the cutoff date for all Simple Computer labs and assignments And next Monday is the cutoff date for all arithmetic assignments and quizzes (Assignment #5, Quiz #5, Quiz #6, Optional Quizzes #5, #7 and #8) Please note: The date of the midterm is Monday, October 18 - an 8.5 in. * 11 in. cheat sheet will be allowed We will review for the midterm next week I recommend going over the midterm practice exercises before I discuss them on Monday Don't forget the optional quiz: Debug

    2. Given the following information in DEBUG: -e 120 34 12 00 01 -u 100, 10A 21F0:0100 BB2001 MOV BX, 120 21F0:0103 BE0200 MOV SI, 2 21F0:0106 0307 MOV AX, [BX] 21F0:0108 0300 ADD AX, [BX + SI] Trace through the partial program above, showing the contents of the AX, BX and SI registers AXBX SI

    3. But first: Given the following information in DEBUG: -e 120 34 12 00 01 -u 100, 10A 21F0:0100 BB2001 MOV BX, 120 21F0:0103 BE0200 MOV SI, 2 21F0:0106 0307 MOV AX, [BX] 21F0:0108 0300 ADD AX, [BX + SI] Trace through the partial program above, showing the contents of the AX, BX and SI registers AXBX SI What does this mean? 120121122123

    4. But first: Given the following information in DEBUG: -e 120 34 12 00 01 -u 100, 10A 21F0:0100 BB2001 MOV BX, 120 21F0:0103 BE0200 MOV SI, 2 21F0:0106 0307 MOV AX, [BX] 21F0:0108 0300 ADD AX, [BX + SI] Trace through the partial program above, showing the contents of the AX, BX and SI registers AXBX SI What does this mean? 120121122123 34 12 00 01

    5. Given the following information in DEBUG: -e 120 34 12 00 01 -u 100, 10A 21F0:0100 BB2001 MOV BX, 120 21F0:0103 BE0200 MOV SI, 2 21F0:0106 0307 MOV AX, [BX] 21F0:0108 0300 ADD AX, [BX + SI] Trace through the partial program above, showing the contents of the AX, BX and SI registers AXBX SI ? 0120 ?

    6. Given the following information in DEBUG: -e 120 34 12 00 01 -u 100, 10A 21F0:0100 BB2001 MOV BX, 120 21F0:0103 BE0200 MOV SI, 2 21F0:0106 0307 MOV AX, [BX] 21F0:0108 0300 ADD AX, [BX + SI] Trace through the partial program above, showing the contents of the AX, BX and SI registers AXBX SI ? 0120 ? ? 0120 0002

    7. Given the following information in DEBUG: • -e 120 34 12 00 01 • -u 100, 10A • 21F0:0100 BB2001 MOV BX, 120 • 21F0:0103 BE0200 MOV SI, 2 • 21F0:0106 0307 MOV AX, [BX] • 21F0:0108 0300 ADD AX, [BX + SI] • Trace through the partial program above, showing the contents of the AX, BX and SI registers • AXBX SI • ? 0120 ? • ? 0120 0002 • 1234 0120 0002

    8. Given the following information in DEBUG: • -e 120 34 12 00 01 • -u 100, 10A • 21F0:0100 BB2001 MOV BX, 120 • 21F0:0103 BE0200 MOV SI, 2 • 21F0:0106 0307 MOV AX, [BX] • 21F0:0108 0300 ADD AX, [BX + SI] • Trace through the partial program above, showing the contents of the AX, BX and SI registers • AXBX SI • ? 0120 ? • ? 0120 0002 • 1234 0120 0002 • 1334 0120 0002

    9. Review: Using the LOOP instruction (works with CX): MOV CX ,0003 MOV AX, 0000 ADD AX, CX LOOP 106 INT 20 How does the loop instruction work?

    10. Review: Using the LOOP instruction (works with CX): MOV CX ,0003 MOV AX, 0000 ADD AX, CX LOOP 106 INT 20 How does the loop instruction work? 1. It decrements CX 2. It checks CX (is CX > 0?) 3. If CX > 0 - it loops to the address specified If CX = 0 - it goes to the next instruction in sequence

    11. - each location in the computer is assigned a unique address - memory locations - input/output devices - the address allows them to be recognized by the CPU - the CPU puts the address on the address bus - identified by the decoding circuits - the data bus is used to get data to or from the address - the control bus sends read/write signals - to indicate if the CPU is asking for or sending information - every process in the computer (at every level of the computer) - uses this fetch/decode/execute cycle

    12. - each location in the computer is assigned a unique address - memory locations - input/output devices - the address allows them to be recognized by the CPU - the CPU puts the address on the address bus - identified by the decoding circuits - the data bus is used to get data to or from the address - the control bus sends read/write signals - to indicate if the CPU is asking for or sending information Address Bus CPU (ALU, registers, control unit) RAM ROM Printer cd/dvd Monitor Keyboard Mouse Data Bus Control Bus

    13. - the function (or purpose) of the CPU: - to fetch and execute instructions - more efficient if the process is divided - at the same time: - one instruction is being executed, and - the next instruction is being fetched - implemented by theoretically dividing the CPU into: - the execution unit - decodes and executes instructions and - the bus interface unit - fetches the instructions

    14. - the execution unit contains - the ALU - performs operations - arithmetic - logical - registers - high speed memory - temporarily store data or addresses - general purpose registers - available to programmers - special purpose registers - e.g. the instruction pointer, the instruction register - not available to programmers - to indicate if the CPU is asking for or sending information - the flags register - is set (or reset) as the result of operations done in the ALU - can be checked by a program - the decoder - determines the type of instruction - interprets it into a form that can be used in the ALU and registers

    15. - the bus interface unit - where instructions and data come in from main memory - the bus interface unit delivers them to the execution unit - contains: - the instruction queue - allows the bus interface unit to stay ahead of the execution unit - when the queue is full - the buses are idle - if the program performs a jump - the queue will be changed - the instruction pointer - holds the address of the next instruction to be executed - the address will be placed on the address bus - the segment registers - hold the addresses of the various parts of memory used by the program - where the instructions are stored - where the data is stored - where the program’s stack is located - the execution unit and the bus interface unit work in parallel - but the bus interface unit is always at least one step ahead

    16. Registers: General - EAX (accumulator) EAX - 32 bits 8 hexadecimal digits AX - 16 Bits 4 hexadecimal digits AH and AL - 8 bits each 2 hexadecimal digits each - EBX, ECX, EDX - and BX, BH, BL, CX, CH, CL, DX, DH, DL

    17. Data Registers (general purpose) EAX Accumulator register EBX Base register ECX Count register EDX Data register Index Registers (used in string operations) ESI Source Index register EDI Destination Index register Pointer Registers (used in stack operations) ESP Stack Pointer register EBP Base Pointer register Intel Registers (grouped by function)

    18. Flags register detail: - bit 0 CF - bit 2 PF - bit 6 ZF - bit 7 SF - bit 10 DF - bit 11 OF Control Registers EIP Instruction pointer register EFLAGS Flags register Segment Registers (16-bit) (hold segment addresses) CS Code Segment register DS Data Segment register SS Stack Segment register ES Extra Segment register Intel Registers (grouped by function)

    19. 32-bit Addressing Modes - immediate addressing - the operand comes immediately after the instruction e.g. MOV EAX, 12345678 or MOV AX, ABCD or MOV AH, 2A - direct addressing - specifies the address of the operand e.g. MOV EAX, [0100] or MOV EAX, NUMBER - register addressing - specifies the register in which the operand is stored e.g. MOV EAX, EBX

    20. Scientific Notation Format Normalized Standard Form Scientific Notation Scientific Notation 3.14159 3.14159 x 100 .314159 x 101 100,000 1.0 x 105 .1 x 106 .0001 1.0 x 10-4 .1 x 10-3 -1234 -1.234 x 103 -.1234 x 104 -1.234 3 -.1234 4 mantissa characteristic fraction exponent (or significand) • Scientific notation makes it relatively easy to work with very large or very small numbers • - normalized scientific notation used in the computer is called floating point notation

    21. 4-Decimal-Digit Floating Point Format Fraction 2 decimal digits Normalized Signed Exponent 2 decimal digits Signed 3.14159 3 1 0 1 ( .314159 * 101) 1 0 0 6 ( .1 * 106) 100,000 .0001 1 0 -0 3 ( .1 * 10-3) -1234 -1 2 0 4 ( .1234 * 104)

    22. 4-Decimal-Digit Floating Point Format Fraction 2 decimal digits Normalized Signed Exponent 2 decimal digits Signed 3.14159 3 1 0 1 1 0 0 6 100,000 .0001 1 0 -0 3 -1234 -1 2 0 4 Range: - defined by the number of digits in the exponent (-.99 x 10+99 .. +.99 x 10+99) Precision: - defined by the number of digits in the fraction (2 digits of precision)

    23. - if the 4-decimal digit format is changed: Fraction 3 decimal digits Normalized Signed Exponent 1 decimal digit Signed - the range is smaller (-.999*109 .. 999*109) - there is a smaller distance between adjacent numbers - there is greater accuracy

    24. - if the 4-decimal digit format is changed: Fraction 1 decimal digit Normalized Signed Exponent 3 decimal digits Signed • - the range is increased • - accuracy is greatly decreased

    25. - if the 4-decimal digit format is changed: Fraction 1 decimal digit Normalized Signed Exponent 3 decimal digits Signed • - the range is increased • - accuracy is greatly decreased - no matter what format is used - these numbers will generate 7 different regions of storage: - a positive value region, - a negative value region and a - zero region - 2 overflow regions - 2 underflow regions

    26. Range and regions of value for a 4-decimal-digit floating point format: Fraction 2 decimal digits Normalized Signed Exponent 2 decimal digits Signed

    27. Range of 4-decimal-digit floating point format: (using the number line) overflow overflow -.99x1099 -.10x10-99 .10x10-99 .99x1099 zero -.10x100 .10x100 underflow (Absolutely not to scale)

    28. Fraction 2 decimal digits Normalized Signed Exponent 2 decimal digits Signed Roundoff Error 3 1 0 1 If we store 3.14159 as we truncate (round down) to 3.1 3 2 0 1 If we store 3.14159 as we round up to 3.2 1 2 0 4 If we store 1234 as we round down to 1200

    29. Floating point formats: - often stored in normalized scientific notation form (.xxxxxx * base exponent) - precision (accuracy) - affected by the number of digits in the fraction - affected by the limits of binary representation - range - determined by the number of digits in the exponent - often generate a round-off error

    30. Binary Floating Point Formats • most are based on dividing the binary number into 3 parts: • - the sign (1 bit) • - 0 = positive, 1 = negative • - the exponent • - uses excess-N notation • - the fractional part • - will be normalized • - the radix point • - will be to the left or right of the most significant bit • - depending on the format used • A 32-bit floating point number: or

    31. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit

    32. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit (it's to the left)

    33. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit (it's to the left) - and the base that will be used to calculate the exponent - called the radix of exponentiation - usually base 2, 8 or 16

    34. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit (it's to the left) - and the base that will be used to calculate the exponent - called the radix of exponentiation - usually base 2, 8 or 16 (we'll look at all three)

    35. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit (it's to the left) - and the base that will be used to calculate the exponent - called the radix of exponentiation - usually base 2, 8 or 16 (we'll look at all three) To calculate the exponent: - we must first normalize the fraction to find the exponent - using the radix of exponentiation

    36. To calculate the fraction: - we must know the position of the radix point - to the left or right of the most significant bit (it's to the left) - and the base that will be used to calculate the exponent - called the radix of exponentiation - usually base 2, 8 or 16 (we'll look at all three) To calculate the exponent: - we must first normalize the fraction to find the exponent - using the radix of exponentiation - if the exponent is stored in 7 bits (it's stored in 7 bits) - it uses excess-64 notation - if the exponent is stored in 8 bits - it uses excess-127 notation

    37. The problem: • - how 0.00110 would be represented in a hypothetical machine • - using a 32-bit floating point format • - 1 bit for the sign bit • - (0 = positive, 1 = negative) • - 7 bits for the exponent • - using excess-64 notation • - 24 bits for the fraction • - normalized • - radix point to the left of the most significant bit • - the radix of exponentiation is 2

    38. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.00040611156458 = 0.0000000001000001100010010011011101001012

    39. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.00040611156458 = 0.0000000001000001100010010011011101001012 Step 2: Normalize the fraction - move the radix point to the left of the most significant bit - i.e. move the radix point to the right 9 bits = 0.0000000001000001100010010011011101001012

    40. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.00040611156458 = 0.0000000001000001100010010011011101001012 Step 2: Normalize the fraction - move the radix point to the left of the most significant bit - move the radix point to the right 9 bits = 0.0000000001000001100010010011011101001012 - on a computer using radix 2 the normalized form is: = 0.100000110001001001101110 1001012 * (2-9)10

    41. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.00040611156458 = 0.0000000001000001100010010011011101001012 Step 2: Normalize the fraction - move the radix point to the left of the most significant bit - move the radix point to the right 9 bits = 0.0000000001000001100010010011011101001012 - on a computer using radix 2 the normalized form is: = 0.100000110001001001101110 1001012 * (2-9)10 the 24 bits we need for the fraction

    42. - normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10 = 0.100000110001001001101110 1001012 * (2-9)10 fraction exponent

    43. - normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10 = 0.100000110001001001101110 1001012 * (2-9)10 fraction exponent Step 3: Convert the exponent to its excess-64 form in radix 2 - in radix 10: -9 + 64 = 5510 - in radix 2: 01101112

    44. - normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10 = 0.100000110001001001101110 1001012 * (2-9)10 fraction exponent Step 3: Convert the exponent to its excess-64 form in radix 2 - in radix 10: -9 + 64 = 5510 - in radix 2: 01101112 Step 4: Put the number together sign exponent fraction 0 0110111 100000110001001001101110 or 3 7 8 3 1 2 6 E in hexadecimal

    45. The problem: • - how 0.00110 would be represented in a hypothetical machine • - using a 32-bit floating point format • - 1 bit for the sign bit • - (0 = positive, 1 = negative) • - 7 bits for the exponent • - using excess-64 notation • - 24 bits for the fraction • - normalized • - radix point to the left of the most significant bit • - the radix of exponentiation is 8 • - for radix 8 we move the radix point in sets of 3 bits (1 octal digit = 3 binary digits)

    46. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.0000000001000001100010010011011101001012 Step 2: Normalize the fraction - move the radix point to the left of the most significant bit - move the radix point to the right in sets of 3 bits - and stay to the left of the msb = 0.0000000001000001100010010011011101001012

    47. Step 1: Convert 0.00110 to radix 2 0.00110 = 0.0000000001000001100010010011011101001012 Step 2: Normalize the fraction - move the radix point to the left of the most significant bit - move the radix point to the right in sets of 3 bits - and stay to the left of the msb = 0.0000000001000001100010010011011101001012 - on a computer using radix 8 the normalized form is: = 0.100000110001001001101110 1001012 * (8-3)10 the 24 bits we need for the fraction Note: the roundoff error is truncation error - if the roundoff error was from rounding bit #31 would be a 1

    48. - normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10 = 0.100000110001001001101110 1001012 * (8-3)10 fraction exponent Step 3: Convert the exponent to its excess-64 form in radix 2 - in radix 10: -3 + 64 = 6110 - in radix 2: 01111012

    49. - normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10 = 0.100000110001001001101110 1001012 * (8-3)10 fraction exponent Step 3: Convert the exponent to its excess-64 form in radix 2 - in radix 10: -3 + 64 = 6110 - in radix 2: 01111012 Step 4: Put the number together sign exponent fraction 0 0111101 100000110001001001101110 or 3 D 8 3 1 2 6 E in hexadecimal

    50. The problem: • - how 0.00110 would be represented in a hypothetical machine • - using a 32-bit floating point format • - 1 bit for the sign bit • - (0 = positive, 1 = negative) • - 7 bits for the exponent • - using excess-64 notation • - 24 bits for the fraction • - normalized • - radix point to the left of the most significant bit • - the radix of exponentiation is 16 • - for radix 16 we move the radix point in sets of 4 bits (1 hexadecimal digit = 4 binary digits) • (This was the short-form floating point format used on the IBM 370 computer)