Loading in 2 Seconds...

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

Loading in 2 Seconds...

- 131 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC' - colorado-lancaster

**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

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

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

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

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

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 ?

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

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

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

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?

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

- 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

- 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

- 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

- 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

- 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

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

(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)

- 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)

- 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

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

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)

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)

- 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

- 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

- 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

Range and regions of value for a 4-decimal-digit floating point format:

Fraction

2 decimal digits

Normalized

Signed

Exponent

2 decimal digits

Signed

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)

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

- 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

- 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

- we must know the position of the radix point

- to the left or right of the most significant bit

- we must know the position of the radix point

- to the left or right of the most significant bit (it's to the left)

- 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 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)

- 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

- 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

- - 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

Step 1: Convert 0.00110 to radix 2

0.00110 = 0.00040611156458

= 0.0000000001000001100010010011011101001012

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

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

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

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= 0.100000110001001001101110 1001012 * (2-9)10

fraction exponent

- 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

- 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

- - 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)

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

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

- 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

- 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

- - 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)

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 4 bits

- and stay to the left of the msb

= 0.0000000001000001100010010011011101001012

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 4 bits

- and stay to the left of the msb

= 0.0000000001000001100010010011011101001012

- on a computer using radix 16 the normalized form is:

= 0.010000011000100100110111 01001012 * (16-2)10

the 24 bits we need for the fraction

Note: the roundoff error is is the same for rounding or truncation

- the next bit is a 0

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= 0.010000011000100100110111 01001012 * (16-2)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: -2 + 64 = 6210

- in radix 2: 01111102

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= 0.010000011000100100110111 01001012 * (16-2)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: -2 + 64 = 6210

- in radix 2: 01111102

Step 4: Put the number together

sign exponent fraction

0 0111110 010000011000100100110111

or

? in hexadecimal

Conversion to/from floating point formats:

- decimal number to hexadecimal floating point format:

- convert decimal number to binary

- convert to normalized scientific form (varies)

- convert exponent to its excess-N form in binary

- add sign bit to exponent and fraction

- convert binary number to hexadecimal

To decode the hexadecimal number 3E400000 (same format):

The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000

0 6210 .012

To decode the hexadecimal number 3E400000 (same format):

The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000

0 6210 .012

Sign: positive

Exponent: -210

Fraction: .012

To decode the hexadecimal number 3E400000 (same format):

The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000

0 6210 .012

Sign: positive

Exponent: -210

Fraction: .012

The normalized form: .01 x (16-2)10

To decode the hexadecimal number 3E400000 (same format):

The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000

0 6210 .012

Sign: positive

Exponent: -210

Fraction: .012

The normalized form: .01 x (16-2) 10

The non-scientific binary form: .00000000012

To decode the hexadecimal number 3E400000 (same format):

The number in binary: 0 011 1110 0100 0000 0000 0000 0000 0000

0 6210 .012

Sign: positive

Exponent: -210

Fraction: .012

The normalized form: .01 x (16-2) 10

The non-scientific binary form: .00000000012

The number in decimal: = 1/1024 or .0009765...10

Conversion to/from floating point formats:

- decimal number to hexadecimal floating point format:

- convert decimal number to binary

- convert to normalized scientific form (varies)

- convert exponent to its excess-N form in binary

- add sign bit to exponent and fraction

- convert binary number to hexadecimal

- hexadecimal floating point format to decimal value

- convert hexadecimal number to binary

- determine sign, exponent and fraction

- convert exponent to its decimal form

- convert to normalized form

- convert to its non-scientific binary form

- convert to decimal

- - how -46.7410 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)

.48 * 2 = 0.96

.96 * 2 = 1.92

.92 * 2 = 1.84

.84 * 2 = 1.68

.68 * 2 = 1.36

.36 * 2 = 0.72

.72 * 2 = 1.44

.44 * 2 = 0.88

.88 * 2 = 1.76

.76 * 2 = 1.52

.52 * 2 = 1.04

.04 * 2 = 0.08

.08 * 2 = 0.16

.16 * 2 = 0.32

.32 * 2 = 0.64

.64 * 2 = 1.28

.28 * 2 = 0.56

.56 * 2 = 1.12

- The problem from Lab #9:
- - how -46.7410 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)

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.10111101011100001012

Step 2: Normalize the fraction

- move the radix point to the left of the most significant bit

- move the radix point to the left in sets of 4 bits

- and stay to the left of the msb

= -00101110.10111101011100001012

- on a computer using radix 16 the normalized form is:

= -.0010111010111101011100002 * (162)10

the 24 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -.0010111010111101011100012 * (162)10

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.1011110101110000101012

Step 2: Normalize the fraction

- move the radix point to the left of the most significant bit

- move the radix point to the left in sets of 4 bits

- and stay to the left of the msb

= -00101110.1011110101110000102

- on a computer using radix 16 the normalized form is:

= -.0010111010111101011100002 * (162)10

the 24 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -.0010111010111101011100012 * (162)10

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.101111010111000010102

Step 2: Normalize the fraction

- move the radix point to the left of the most significant bit

- move the radix point to the left in sets of 4 bits

- and stay to the left of the msb

= -00101110.1011110101110000102

- on a computer using radix 16 the normalized form is:

= -.0010111010111101011100002 * (162)10

the 24 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -.0010111010111101011100012 * (162)10

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -.0010111010111101011100012 * (162)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: 2 + 64 = 6610

- in radix 2: 10000102

Step 4: Put the number together

sign exponent fraction

1 1000010 .001011101011110101110001

or

C 2 2 E B D 7 1 in hexadecimal

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -.0010111010111101011100012 * (162)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: 2 + 64 = 6610

- in radix 2: 10000102

Step 4: Put the number together

sign exponent fraction

1 1000010 .001011101011110101110001

or

C 2 2 E B D 7 1 in hexadecimal

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -.0010111010111101011100012 * (162)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: 2 + 64 = 6610

- in radix 2: 10000102

Step 4: Put the number together

sign exponent fraction

1 1000010 .001011101011110101110001

or

C 2 2 E B D 7 1 in hexadecimal

IEEE Standard Floating Point Formats for the Intel 8087 microprocessor:

- the Short Real form: (uses excess-127 for the exponent)

IEEE Standard Floating Point Formats for the Intel 8087 microprocessor:

- the Short Real form: (uses excess-127 for the exponent)

- the Long Real form: (uses excess-1023 for the exponent)

The IEEE Short Real form: (and the Long Real form)

- divides the binary number into 3 parts:

- the sign (1 bit)

- 0 = positive, 1 = negative

The IEEE Short Real form: (and the Long Real form)

- divides the binary number into 3 parts:

- the sign (1 bit)

- 0 = positive, 1 = negative

- the exponent

-uses excess-N notation

- excess-127 for Short Real

- excess-1023 for Long Real

-the radix of exponentiation is 2

The IEEE Short Real form: (and the Long Real form)

- divides the binary number into 3 parts:

- the sign (1 bit)

- 0 = positive, 1 = negative

- the exponent

-uses excess-N notation

- excess-127 for Short Real

- excess-1023 for Long Real

-the radix of exponentiation is 2

- the fractional part

- normalized using the scientific notation method

- with the radix point to the right of the most significant bit (always a 1)

- then the msb is implied in the number and not stored

- it's considered "hidden" in the floating point format

More IEEE Standard Floating Point Formats for the Intel 8087 microprocessor

- the Temporary Real form: (uses excess-32767 for the exponent)

- - the temporary real form:
- - uses normalized notation
- - msb to the right of the binary point and NOT hidden
- - there are also 4 additional formats to handle overflow and underflow

- - how 0.00110 would be represented in a hypothetical machine
- - using a 32-bit floating point format (IEEE standard)
- - 1 bit for the sign bit
- - (0 = positive, 1 = negative)
- - 8 bits for the exponent
- - using excess-127 notation
- - 23 bits for the fraction
- - normalized
- - radix point to the right of the most significant bit
- - msb is "hidden"
- - the radix of exponentiation is 2

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 right of the most significant bit

- move the radix point to the right 10 bits

= 0.0000000001000001100010010011011101001012

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 right of the most significant bit

- move the radix point to the right 10 bits

= 0.0000000001000001100010010011011101001012

- on a computer using radix 2 the normalized form is:

= 1.00000110001001001101110 1001012 * (2-10)10

the 23 bits we need for the fraction

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= 1.00000110001001001101110 1001012 * (2-10)10

fraction exponent

Step 3: Convert the exponent to its excess-127 form in radix 2

- in radix 10: -10 + 127 = 11710

- in radix 2: 011101012

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= 1.00000110001001001101110 1001012 * (2-10)10

fraction exponent

Step 3: Convert the exponent to its excess-127 form in radix 2

- in radix 10: -10 + 127 = 11710

- in radix 2: 011101012

Step 4: Put the number together

sign exponent fraction

0 01110101 00000110001001001101110

or

3 A 8 3 1 2 6 E in hexadecimal

To decode the hexadecimal number 3D400000 (IEEE format):

The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000

0 12410 .12

To decode the hexadecimal number 3D400000 (IEEE format):

The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000

0 12410 .12

Sign: positive

Exponent: -3

Fraction: 1.1

To decode the hexadecimal number 3D400000 (IEEE format):

The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000

0 12410 .12

Sign: positive

Exponent: -3

Fraction: 1.1

The normalized form: 1.1 x (2-3)10

To decode the hexadecimal number 3D400000 (IEEE format):

The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000

0 12410 .12

Sign: positive

Exponent: -3

Fraction: 1.1

The normalized form: 1.1 x (2-3)10

The binary number: .00112

To decode the hexadecimal number 3D400000 (IEEE format):

The number in binary: 0 011 1110 0 100 0000 0000 0000 0000 0000

0 12410 .12

Sign: positive

Exponent: -3

Fraction: 1.1

The normalized form: 1.1 x (2-3)10

The binary number: .00112

The decimal number: 1/8 +1/16 or 3/16 or .187510

Conversion to/from floating point formats:

- decimal number to hexadecimal floating point format:

- convert decimal number to binary

- convert to normalized scientific form (varies)

- convert exponent to its excess-N form in binary

- add sign bit to exponent and fraction

- convert binary number to hexadecimal

- hexadecimal floating point format to decimal value

- convert hexadecimal number to binary

- determine sign, exponent and fraction

- convert exponent to its decimal form

- convert to normalized form

- convert to its non-scientific binary form

- convert to decimal

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

.48 * 2 = 0.96

.96 * 2 = 1.92

.92 * 2 = 1.84

.84 * 2 = 1.68

.68 * 2 = 1.36

.36 * 2 = 0.72

.72 * 2 = 1.44

.44 * 2 = 0.88

.88 * 2 = 1.76

.76 * 2 = 1.52

.52 * 2 = 1.04

.04 * 2 = 0.08

.08 * 2 = 0.16

.16 * 2 = 0.32

.32 * 2 = 0.64

.64 * 2 = 1.28

.28 * 2 = 0.56

.56 * 2 = 1.12

- The problem from Lab #9 (Part 2):
- - how -46.7410 would be represented in a hypothetical machine
- - using a 32-bit floating point format
- - 1 bit for the sign bit
- - (0 = positive, 1 = negative)
- - 8 bits for the exponent
- - using excess-127 notation
- - 24 bits for the fraction
- - normalized
- - radix point to the right of the most significant bit
- - and the most significant bit is "hidden"
- - the radix of exponentiation is 2
- - for radix 2 we move the radix point bit by single bit
- (This is the IEEE standard short-form floating point format)

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.10111101011100001012

Step 2: Normalize the fraction

- move the radix point to the right of the most significant bit

- move the radix point to the left bit by bit

= -00101110.10111101011100001012

- on a computer using radix 16 the normalized form is:

= -1.011101011110101110000102 * (25)10

the 23 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -1.011101011110101110000112 * (25)10

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.10111101011100001012

Step 2: Normalize the fraction

- move the radix point to the right of the most significant bit

- move the radix point to the left bit by bit

= -00101110.10111101011100001012

- on a computer using radix 16 the normalized form is:

= -1.011101011110101110000102 * (25)10

the 23 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -1.011101011110101110000112 * (25)10

Step 1: Convert -46.7410 to radix 2

-46.7410 = -101110.10111101011100001012

Step 2: Normalize the fraction

- move the radix point to the right of the most significant bit

- move the radix point to the left bit by bit

= -00101110.10111101011100001012

- on a computer using radix 16 the normalized form is:

= -1.011101011110101110000102 * (25)10

the 23 bits we need for the fraction

Step 3: - the roundoff error is is from rounding

- the next bit is a 1

- the normalized form becomes

= -1.011101011110101110000112 * (25)10

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -1.011101011110101110000112 * (25)10

fraction exponent

Step 3: Convert the exponent to its excess-127 form in radix 2

- in radix 10: 5 + 127 = 13210

- in radix 2: 100001002

Step 4: Put the number together

sign exponent fraction

1 10000100 .01110101111010111000011

or

C 2 3 A F 5 C 3 in hexadecimal

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -1.011101011110101110000112 * (25)10

fraction exponent

Step 3: Convert the exponent to its excess-127 form in radix 2

- in radix 10: 5 + 127 = 13210

- in radix 2: 100001002

Step 4: Put the number together

sign exponent fraction

1 10000100 .01110101111010111000011

or

C 2 3 A F 5 C 3 in hexadecimal

- normalizing the fraction gives us the fraction in radix 2 and the exponent in radix 10

= -1.010111010111101011100012 * (25)10

fraction exponent

Step 3: Convert the exponent to its excess-64 form in radix 2

- in radix 10: 5 + 127 = 13210

- in radix 2: 100001002

Step 4: Put the number together

sign exponent fraction

1 10000100.01110101111010111000011

or

C 2 3 A F 5 C 3 in hexadecimal

Download Presentation

Connecting to Server..