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
96
Embed
Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC Assignment #6: DEBUG EXERCISES Quiz(zes) due:Quiz #5: Base Arithmetic Quiz #6.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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
CPU
(ALU,registers,controlunit)
RAM ROM Printer cd/dvd Monitor Keyboard Mouse
Address Bus
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
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
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
4
3
3
1
1
1
1
-1
0
0 0
0
-0
6
0
2
3.14159
100,000
.0001
-1234
( .314159 * 101)
( .1 * 106)
( .1 * 10-3)
( .1234 * 104)
4-Decimal-Digit Floating Point Format
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
4
3
3
1
1
1
1
-1
0
0 0
0
-0
6
0
2
3.14159
100,000
.0001
-1234
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:
Fraction3 decimal digitsNormalizedSigned
Exponent1 decimal digitSigned
- 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:
Fraction1 decimal digitNormalizedSigned
Exponent3 decimal digitsSigned
- the range is increased
- accuracy is greatly decreased
- if the 4-decimal digit format is changed:
Fraction1 decimal digitNormalizedSigned
Exponent3 decimal digitsSigned
- 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:
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
zero .10x100
.10x10-99 .99x1099-.10x10-99-.99x1099
-.10x100
Range of 4-decimal-digit floating point format: (using the number line)
(Absolutely not to scale)
overflow overflow
underflow
Roundoff Error
If we store 3.14159 as we truncate (round down) to 3.1
If we store 3.14159 as we round up to 3.2
03 1
23
1
10
If we store 1234 as we round down to 120041 2 0
Fraction2 decimal digitsNormalizedSigned
Exponent2 decimal digitsSigned
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
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
To calculate the fraction:
- we must know the position of the radix point - to the left or right of the most significant bit
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)
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
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 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
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
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
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 100000110001001001101110or
3 7 8 3 1 2 6 E in hexadecimal
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)