Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write it in assembly language using the instruction set in the first two pictures the above pictures are an explaination on how to add

please write it in assembly language using the instruction set in the first two pictures
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
the above pictures are an explaination on how to add the two floating points using assembly language
image text in transcribed
Instruction Format Memory-Reference Instructions (OP-code = 000 - 110) 0 15 14 12 11 TOpcode Address Register-Reference Instructions (OP-code = 111, 1 = 0) 15 12 11 L 1 1 1 Register operation (OP-code =111, 1 = 1) Input-Output Instructions 15 12 11 1 1 1 1 1 I/O operation Instruction set Hex Code Symbol | 1 = 0 1 = 1 AND Oxxx 8xxx ADD 1xxx 9xxx LDA 2xxx Axxx STA 3xxx Bxxx BUN 4xxx BSA 5xxx Dxxx ISZ 6xxx Exxx Description AND memory word to AC Add memory word to AC Load AC from memory Store content of AC into memory Branch unconditionally Branch and save return address Increment and skip if zero CLA CLE CIR CIL INC SPA SNA SZA SZE HLT 7800 7400 7200 7100 7080 7040 7020 7010 7008 7004 7002 7001 Clear AC Clear E Complement AC Complement E Circulate right AC and E Circulate left AC and E Increment AC Skip next instr. if AC is positive Skip next instr. if AC is negative Skip next instr. if AC is zero Skip next instr. if E is zero Halt computer INP OUT SKI SKO ION IOF F800 F400 F200 F100 F080 F040 Input character to AC Output character from AC Skip on input flag Skip on output flag Interrupt on Interrupt off Assume floating-point (non-standard) representation of numbers as follows: Each number is represented by two consecutive 16-bit words The first word represents the exponent (using 2's representation) The second word represents an unsigned mantissa The floating point numbers are represented using our special normalized form (O.1xxx...x), by which, o If the floating-point number is not zero, the most significant bit of the mantissa is 1 and the binary point is placed right before this leftmost bit. o If the floating-point number is zero, both the mantissa and the exponent fields should have a zero value. Examples: The decimal number (13.25)10=(1101.01)2 is represented as follows: (1101.01)2=0.110101 x 24 (normalized) Therefore, the 16 bit exponent is 0000000000000100 (which is +4 in 2's complement). The 16 bit mantissa is 1101010000000000 The decimal number (0.3125)10 (0.0101)2 is represented as follows: (0.0101)>=0.101 x 2 (normalized) Therefore, the 16 bit exponent is 111111111 1111 (which is -1 in 2's complement). The 16 bit mantissa is 1010000000000000 The number zero is represented as Exponent=0000000000000000 Mantissa 0000000000000000 Write assembly language programs to perform each of the following floating-point operations on two input floating point numbers A and B: 1. Compute C=A+B and produce a normalized floating point result C 2. Compute D=AXB and produce a normalized floating point result D (notice that in order to be able to perform this operation, you need to implement a subroutine that performs multiplication of two unsigned integers) You can make the following assumptions: I 1. The mantissa's are unsigned (i.e., no negative values) 2. A and B are non-zero values and A is greater than B 3. The mantissa of input values A and B require no more than 8-bits (i.e., they are smaller than 256. Therefore, their multiplication will not result in a value that requires more than 16 bits. 4. No overflow or underflow could occur. Therefore, you can ignore checking for these. Add Algorithm 1. Align the binary point of the two values by shifting the mantissa of the smaller value (.e. B) right by a number of positions equal to the difference between exponents. With this you can imagine that both values have the same exponents and therefore, the locations of their binary points are aligned. Make sure that for the first position shift, you should shift in a "I" value (the implicit most significant bit). 2. Compute the result a. The result mantissa of the result is the addition of both mantissa's b. The result exponent is the common exponent after aligning the binary point, which is the exponent of A. 3. Normalize the result by shifting the result right by one position (if needed) and adjusting (incrementing) the exponent. Notice that considering the above assumptions, you only need to do shift the result by a maximum of one position if there is a carly when you add the mantissa's. Instruction Format Memory-Reference Instructions (OP-code = 000 - 110) 0 15 14 12 11 TOpcode Address Register-Reference Instructions (OP-code = 111, 1 = 0) 15 12 11 L 1 1 1 Register operation (OP-code =111, 1 = 1) Input-Output Instructions 15 12 11 1 1 1 1 1 I/O operation Instruction set Hex Code Symbol | 1 = 0 1 = 1 AND Oxxx 8xxx ADD 1xxx 9xxx LDA 2xxx Axxx STA 3xxx Bxxx BUN 4xxx BSA 5xxx Dxxx ISZ 6xxx Exxx Description AND memory word to AC Add memory word to AC Load AC from memory Store content of AC into memory Branch unconditionally Branch and save return address Increment and skip if zero CLA CLE CIR CIL INC SPA SNA SZA SZE HLT 7800 7400 7200 7100 7080 7040 7020 7010 7008 7004 7002 7001 Clear AC Clear E Complement AC Complement E Circulate right AC and E Circulate left AC and E Increment AC Skip next instr. if AC is positive Skip next instr. if AC is negative Skip next instr. if AC is zero Skip next instr. if E is zero Halt computer INP OUT SKI SKO ION IOF F800 F400 F200 F100 F080 F040 Input character to AC Output character from AC Skip on input flag Skip on output flag Interrupt on Interrupt off Assume floating-point (non-standard) representation of numbers as follows: Each number is represented by two consecutive 16-bit words The first word represents the exponent (using 2's representation) The second word represents an unsigned mantissa The floating point numbers are represented using our special normalized form (O.1xxx...x), by which, o If the floating-point number is not zero, the most significant bit of the mantissa is 1 and the binary point is placed right before this leftmost bit. o If the floating-point number is zero, both the mantissa and the exponent fields should have a zero value. Examples: The decimal number (13.25)10=(1101.01)2 is represented as follows: (1101.01)2=0.110101 x 24 (normalized) Therefore, the 16 bit exponent is 0000000000000100 (which is +4 in 2's complement). The 16 bit mantissa is 1101010000000000 The decimal number (0.3125)10 (0.0101)2 is represented as follows: (0.0101)>=0.101 x 2 (normalized) Therefore, the 16 bit exponent is 111111111 1111 (which is -1 in 2's complement). The 16 bit mantissa is 1010000000000000 The number zero is represented as Exponent=0000000000000000 Mantissa 0000000000000000 Write assembly language programs to perform each of the following floating-point operations on two input floating point numbers A and B: 1. Compute C=A+B and produce a normalized floating point result C 2. Compute D=AXB and produce a normalized floating point result D (notice that in order to be able to perform this operation, you need to implement a subroutine that performs multiplication of two unsigned integers) You can make the following assumptions: I 1. The mantissa's are unsigned (i.e., no negative values) 2. A and B are non-zero values and A is greater than B 3. The mantissa of input values A and B require no more than 8-bits (i.e., they are smaller than 256. Therefore, their multiplication will not result in a value that requires more than 16 bits. 4. No overflow or underflow could occur. Therefore, you can ignore checking for these. Add Algorithm 1. Align the binary point of the two values by shifting the mantissa of the smaller value (.e. B) right by a number of positions equal to the difference between exponents. With this you can imagine that both values have the same exponents and therefore, the locations of their binary points are aligned. Make sure that for the first position shift, you should shift in a "I" value (the implicit most significant bit). 2. Compute the result a. The result mantissa of the result is the addition of both mantissa's b. The result exponent is the common exponent after aligning the binary point, which is the exponent of A. 3. Normalize the result by shifting the result right by one position (if needed) and adjusting (incrementing) the exponent. Notice that considering the above assumptions, you only need to do shift the result by a maximum of one position if there is a carly when you add the mantissa's

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

2. List the advantages of listening well

Answered: 1 week ago