Professional Documents
Culture Documents
N
1 i
Xi / N
Microprocessor Unit 10
Sikkim Manipal University Page No. 243
We assume that the samples have been input, converted to the long real
data format, and stored in an array beginning at ARRY_X, and that the
variable N contains the number of samples. Fig. 10.13 gives a program
sequence for computing the sample mean and the standard deviation, and
storing them in MEAN and STD_DEV, respectively.
The first instruction initializes the 8087 so that all registers are marked
empty, the error and interrupt flags are cleared, the error masks are set, ST
is set program sequence is part of a procedure, it would be necessary to
save the state for the calling program before the initialization is done.
The 8087 relies on the CPU to perform looping, conditional branching, and
indexing. With a proper program design, maximum parallelism between the
two processors can be achieved. For example, it is better to place XOR and
MOV after FLDZ because the execution time of FINIT is faster than that of
FLDZ.
It is important to note that a memory operand can only be loaded into the
8087 by a push operation. Therefore, after each iteration of the loop
beginning at LOOPSTD, the first three registers from the top of the stack
contain (Xi MEAN)
2
, the partial sum of (Xi- MEAN)
2
, and the contents of
MEAN. In order to load Xi+1 in the same top of the stack element at the
beginning of the next iteration, the pop form of the add instruction
(FADDP) should used. This removes (Xi MEAN)
2
after it has been added
into ST (1).
Microprocessor Unit 10
Sikkim Manipal University Page No. 244
Fig. 10.13: Calculation of sample and mean and standard deviation
10.5 Conclusion
If a system includes two or more components that can execute instructions
simultaneously, it is called a multiprocessing system. The maximum mode
of the 8086 is specifically designed to implement multiprocessor systems.
The 8086 has no instructions for performing floating point arithmetic, but by
using an Intel 8087 numeric data processor as a coprocessor, an application
that heavily involves floating point calculations can be satisfied. The 8087
numeric data processor (NDP) is specially designed to perform arithmetic
operations efficiently. It can operate on data of the integer, decimal, and real
types, with lengths ranging from 2 to 10 bytes.
10.6 Terminal Questions
i) The long real format has ------- exponent bits and ---------- fraction bits.
ii) For a program to be executed by emulation, the -------- instruction, which
is an alternate mnemonic for the WAIT instruction, must be used for
synchronization.
Microprocessor Unit 10
Sikkim Manipal University Page No. 245
iii) A primary reason for using the temporary real format for internal data
storage is to reduce the chances for -------------- during a series of
calculations which produce a final result that is within the required range.
10.7 Answers for Self Assessment Questions
10.2 (i) semaphores
(ii) LOCK
10.3 (i) TRUE
(ii) ESC
10.1.1 (i) seven
(ii) temporary real
10.1.2 (i) relative stack
(ii) condition codes
10.1.3 (i) two
(ii) TEST
10.8 Answers for Terminal Questions
(i) 11, 52
(ii) FWAIT
(iii) underflows and overflows
10.9 Exercises
1) Assuming that following hexadecimal numbers represent short real
numbers:
(a) CA5B2000 (b) 3C630000 (c) 4C341200
Determine their decimal equivalents.
2) Explain why the processor utilization rate can be improved in a
multiprocessor system by an instruction queue.
3) Write an instruction sequence in 8086/8087 assembler language that
would calculate sin and tan , where is greater than 0 and less than
/2. Assume that THETA contains the angle in the short real format and
that the results are to be stored in the long real format.
Microprocessor Unit 10
Sikkim Manipal University Page No. 246
References:
1) Barry B. Brey, Intel Microprocessors, Architecture, Programming,
Interfacing, Prentice Hall, India.
2) K. R. Venugopal & Rajkumar, Microprocessor x 86 Programming, BPB
Publications, First Ed.
3) Gaonkar Microprocessor Architecture, Programming & Applications with
8085, Penram International.