TC1796
Peripheral Units (Vol. 2 of 2)
General Purpose Timer Array (GPTA)
User’s Manual 24-47 V2.0, 2007-07
GPTA, V2.0
Implementation
The hardware implementation of the scalable and Signed/Unsigned Greater/Equal
compare is illustrated in Figure 24-35. The function consists of subtracting the threshold
T from the GT timer value. The result is in 2s complement format. The result’s sign bit
and the 15 most significant bits are available for observation. One of those bits is
selected according to the mode of operation (Unsigned or Signed) and the period length
(bit field GTCTRk.SCO). This bit drives the TGE (Timer Greater Equal) flag.
Unsigned compare: Select Sign bit (SCO = 0F
H
)
Signed compare: Select one of the 15 most significant result bits (SCO = 00
H
to 0E
H
)
Note: On how to choose one of the 15 bits is explained later.
Figure 24-35 Comparator Implemented by a Subtraction Unit
The interpretation of the selected result bit is provided in the following simple example:
For a 4-bit timer, the subtraction of the threshold T from the timer value, leads to a 4-bit
signed result, as illustrated in Figure 24-36. This example is selected for simplicity
although 4-bit periods are not covered by the implementation.
When using Unsigned compare, the sign bit S is selected. If it equals 0, the result is
positive, indicating that the timer is greater or equal the threshold, and hence After. If it
equals 1, the result is negative, and the observation indicates Before.
MCA05944
Multiplexer
Subtract
Difference Sign Bit
Result
Result [23-9]
SCO
+
-
GT Value
Internal Bus
(new threshold)
TGE Flag