English
Language : 

C517A_99 Datasheet, PDF (133/218 Pages) Siemens Semiconductor Group – 8-Bit CMOS Microcontroller
On-Chip Peripheral Components
C517A
6.4.4 Normalize and Shift
Register ARCON controls an up to 32-bit wide normalize and shift operation in registers MD0 to
MD3. lt also contains the overflow flag and the error flag which are described in the next two
sections.
Write Sequence
– A write-to-MD0 is also the first transfer to be done for normalize and shift. This write resets
the MDU and triggers the error flag mechanism (see below).
– To start a shift or normalize operation the last write must access register ARCON.
Read Sequence
– The order in which the first three registers MD0 to MD2 are read is not critical
– The last read from MD3 determines the end of a whole shift or normalize procedure and
releases the error flag mechanism.
Note :Any write access to ARCON triggers a shift or normalize operation and therefore changes the
contents of registers MD0 to MD3 !
Normalizing
Normalizing is done on an integer variable stored in MD0 (least significant byte) to MD3 (most
significant byte). This feature is mainly meant to support applications where floating point arithmetic
is used. "To normalize" means, that all reading zeroes of an integer variable in registers MD0 to
MD3 are removed by shift left operations. The whole operation is completed when the MSB (most
significant bit) contains a ’1’.
To select a normalize operation, the five bit field ARCON.0 to ARCON.4 must be cleared. That
means, a write-to-ARCON instruction with the value XXX0 0000B starts the operation.
After normalizing, bits ARCON.0 to ARCON.4 contain the number of shift left operations which were
done. This number may further on be used as an exponent. The maximum number of shifts in a
normalize operation is 31 ( = 25 – 1). The operation takes six machine cycles at most, that means
3 microseconds at 24 MHz.
Shifting
In the same way - by a write-to-ARCON instruction - a shift left/right operation can be started. In this
case register bit SLR (ARCON.5) has to contain the shift direction, and ARCON.0 to ARCON.4 the
shift count (which must not be 0, otherwise a normalize operation would be executed). During shift,
zeroes come into the left or right end of the registers MD0 or MD3, respectively.
The first machine cycle of a shift left/right operation executes four shifts, while all following cycles
perform 6 shifts. Hence, a 31-bit shift takes 3 microseconds at 24 MHz.
Completion of both operations, normalize and shift, can also be controlled by the error flag
mechanism. The error flag is set if one of the relevant registers (MD0 through MD3) is accessed
before the previously commenced operation has been completed.
For proper operation of the error flag mechanism, it is necessary to take care that the right write or
read sequence to or from registers MD0 to MD3 (see table 6-11) is maintained.
Semiconductor Group
6-67