![Silego GreenPAK SLG46140 Manual Download Page 115](http://html.mh-extra.com/html/silego/greenpak-slg46140/greenpak-slg46140_manual_1270947115.webp)
000-0046140-111
Page 114 of 169
SLG46140
16.0 Digital Comparator (DCMP) / Pulse Width Modulator (PWM)
The SLG46140 has three 8-bit digital comparator / pulse width modulator logic cells. Each of these three logic cells can be either
a digital comparator (DCMP) or a pulse width modulator (PWM) independently of how the other two logic cells are defined.
Both the DCMP and PWM logic can operate at up to a frequency of 10MHz. The input power for the three logic cells is controlled
independently by reg<612> for DCMP0/PWM0, reg<601> for DCMP1/PWM1 and reg<590> for DCMP2/PWM2.
PWM power down control is configured by reg <653> which is also shared with the ADC and OSC.
16.1 DCMP Input Modes
The three DCMP logic cells have a positive (IN+) and a negative (IN-) input that are compared within the logic cell. The
inp
signal
(connected to the IN+ input) takes the value from a 4:1 mux selection between the following signals:
•
8-bit signal from the ADC Parallel Output
•
8-bit signal from the SPI logic cell output (SPI<15:8> for DCMP0 and DCMP2 or SPI<7:0> for DCMP1)
•
8-bit signal from the FSM0<7:0>
•
8-bit user defined signal value
The inn signal (connected to the IN- input) takes the value from a 4:1 mux selection between the following signals:
•
8-bit signal from the SPI logic cell output (SPI<7:0> for DCMP0 and DCMP2 or SPI<15:8> for DCMP1)
•
8-bit signal from the FSM0<7:0>
•
8-bit signal from the FSM1<7:0> (for DCMP0 and DCMP1) or CNT1'Q<7:0> (for DCMP2)
•
8-bit user defined signal value
16.2 DCMP Output Modes
The two 8-bit data inputs from IN+ and IN- are compared within the DCMP logic cells to produce the output and a
match
signal.
•
If
inp
>
inn
, both
OUT+
and
OUT
signals are equal to “1”, and
EQ
signal
is equal to “0”
•
If
inp
<
inn
, both
OUT+
and
OUT
signals are equal to “0”, and
EQ
signal
is equal to “0”
•
If
inp
=
inn
, both
OUT+
and
OUT
signals are equal to “0”, and
EQ
signal is equal to “1”
Both the
OUT+
and
EQ
signals are triggered by the rising or falling edge of the
CKOSC
signal (defined by bit reg <580:579>).
There are two cases for the OUT signal controlled by reg <614>, reg <603>, reg <592>.
If these registers = 0, then
•
if
inp > inn
, OUT = 1, EQ = 0
•
if
inp < inn
, OUT = 0, EQ = 0
•
if
inp = inn
, OUT = 0, EQ = 1
If these registers = 1, then
•
if
inp > inn
, OUT = 1, EQ = 0
•
if
inp < inn
, OUT = 0, EQ = 0
•
if
inp = inn
, OUT = 1, EQ = 1
16.3 PWM Input Modes
IN+ for the PWM is an 8-bit data string that can be selected from one of four sources:
•
8-bit signal from the ADC Parallel Output