The second limitation is that the FPU supports only one BCD data type: a 10-byte 18-digit packed decimal value. It will not support smaller values, nor will it support larger values. Since 18 digits are usually sufficient and memory is cheap, this isn't a big restriction. A third consideration is that the conversion between packed BCD and the floating-point format is not a cheap operation. The fbld and fbstp instructions can be quite slow (more than two orders of magnitude slower than fld and fstp, for example). Therefore, these instructions can be costly if you're doing simple additions or subtractions; the cost of conversion far outweighs the time spent adding the values a byte at a time using the daa and das instructions (multiplication and division, however, are going to be faster on the FPU). You may be wondering why the FPU's packed decimal format supports only 18 digits. After all, with 10 bytes it should be possible to represent 20 BCD digits. As it turns out, the FPU's packed decimal format uses the first 9 bytes to hold the packed BCD value in a standard packed decimal format (the first byte contains the two L.O. digits and the ninth byte holds the two H.O. digits). The H.O. bit of the tenth byte holds the sign bit, and the FPU ignores the remain- ing bits in the tenth byte. If you're wondering why Intel didn't squeeze in one more digit (that is, use the L.O. 4 bits of the tenth byte to allow for 19 digits of precision), just keep in mind that doing so would create some possible BCD values that the FPU could not exactly represent in the native floating- point format. Hence, you have the limitation of 18 digits. The FPU uses a one's complement notation for negative BCD values. That is, the sign bit contains a 1 if the number is negative or 0 and it contains a 0 if the number is positive or 0 (like the binary one's complement format, there are two distinct representations for 0). HLA's tbyte type is the standard data type you would use to define packed BCD variables. The fbld and fbstp instructions require a tbyte operand (which you can initialize with a hexadecimal/BCD value). Because the FPU converts packed decimal values to the internal floating- point format, you can mix packed decimal, floating point, and (binary) integer formats in the same calculation. The program in Listing 8-7 demonstrates how you might achieve this.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
ehance the code
The second limitation is that the FPU supports only one BCD data type: a
10-byte 18-digit packed decimal value. It will not support smaller values, nor
will it support larger values. Since 18 digits are usually sufficient and memory
is cheap, this isn't a big restriction.
A third consideration is that the conversion between packed BCD and the
floating-point format is not a cheap operation. The fbld and fbstp instructions
can be quite slow (more than two orders of magnitude slower than fld and
fstp, for example). Therefore, these instructions can be costly if you're doing
simple additions or subtractions; the cost of conversion far outweighs the
time spent adding the values a byte at a time using the daa and das instructions
(multiplication and division, however, are going to be faster on the FPU).
You may be wondering why the FPU's packed decimal format supports
only 18 digits. After all, with 10 bytes it should be possible to represent 20 BCD
digits. As it turns out, the FPU's packed decimal format uses the first 9 bytes to
hold the packed BCD value in a standard packed decimal format (the first byte
contains the two L.O. digits and the ninth byte holds the two H.O. digits). The
H.O. bit of the tenth byte holds the sign bit, and the FPU ignores the remain-
ing bits in the tenth byte. If you're wondering why Intel didn't squeeze in one
more digit (that is, use the L.O. 4 bits of the tenth byte to allow for 19 digits
of precision), just keep in mind that doing so would create some possible
BCD values that the FPU could not exactly represent in the native floating-
point format. Hence, you have the limitation of 18 digits.
The FPU uses a one's complement notation for negative BCD values.
That is, the sign bit contains al if the number is negative or 0 and it contains
a 0 if the number is positive or 0 (like the binary one's complement format,
there are two distinct representations for 0).
HLA's tbyte type is the standard data type you would use to define packed
BCD variables. The fbld and fbstp instructions require a tbyte operand (which
you can initialize with a hexadecimal/BCD value).
Because the FPU converts packed decimal values to the internal floating-
point format, you can mix packed decimal, floating point, and (binary) integer
formats in the same calculation. The program in Listing 8-7 demonstrates
how you might achieve this.
Transcribed Image Text:The second limitation is that the FPU supports only one BCD data type: a 10-byte 18-digit packed decimal value. It will not support smaller values, nor will it support larger values. Since 18 digits are usually sufficient and memory is cheap, this isn't a big restriction. A third consideration is that the conversion between packed BCD and the floating-point format is not a cheap operation. The fbld and fbstp instructions can be quite slow (more than two orders of magnitude slower than fld and fstp, for example). Therefore, these instructions can be costly if you're doing simple additions or subtractions; the cost of conversion far outweighs the time spent adding the values a byte at a time using the daa and das instructions (multiplication and division, however, are going to be faster on the FPU). You may be wondering why the FPU's packed decimal format supports only 18 digits. After all, with 10 bytes it should be possible to represent 20 BCD digits. As it turns out, the FPU's packed decimal format uses the first 9 bytes to hold the packed BCD value in a standard packed decimal format (the first byte contains the two L.O. digits and the ninth byte holds the two H.O. digits). The H.O. bit of the tenth byte holds the sign bit, and the FPU ignores the remain- ing bits in the tenth byte. If you're wondering why Intel didn't squeeze in one more digit (that is, use the L.O. 4 bits of the tenth byte to allow for 19 digits of precision), just keep in mind that doing so would create some possible BCD values that the FPU could not exactly represent in the native floating- point format. Hence, you have the limitation of 18 digits. The FPU uses a one's complement notation for negative BCD values. That is, the sign bit contains al if the number is negative or 0 and it contains a 0 if the number is positive or 0 (like the binary one's complement format, there are two distinct representations for 0). HLA's tbyte type is the standard data type you would use to define packed BCD variables. The fbld and fbstp instructions require a tbyte operand (which you can initialize with a hexadecimal/BCD value). Because the FPU converts packed decimal values to the internal floating- point format, you can mix packed decimal, floating point, and (binary) integer formats in the same calculation. The program in Listing 8-7 demonstrates how you might achieve this.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY