The CLCxLGSx Registers, contained in the Configurable Logic Cell (CLC), control the polarity of the selected CLC inputs.
CLC Data Gating
Outputs from the input multiplexers are directed to the desired logic function input through the data gating stage. Each data gate can direct any combination of four selected inputs. The gate can be configured to direct each input signal as inverted or non-inverted data. Directed signals are ORed together in each gate. The output of each gate can also be inverted before going on to the logic function stage but that is controlled by the CLCxPOL register.
The Data Gating section is controlled by one of four registers. Each gate has a separate register. Each input has an "N" bit and a "P" bit. Setting the "N" bit inverts the input and setting the "P" bit makes it non-inverted. If neither is set then the gate will be a constant logic level high or low depending on the output polarity setting in
CLCxGLS0 is shown below.
from PIC16F1507 Data Sheet.
Creating Various Gates
Each Data Gate is in essence a 1-to-4 input AND/NAND/OR/NOR gate depending on the invert/non-invert settings. When every input is inverted and the output is inverted, the gate is an NOR of all enabled data inputs. When the inputs and output are not inverted, the gate is an OR of all enabled inputs.
The table below summarizes the basic logic that can be obtained in a gate by using the gate logic select bits.
The table shows the logic of four input variables, but each gate can be configured to use less than four. If no inputs are selected, the output will be zero or one, depending on the gate output polarity bit. The output polarity is controlled by the CLCxPOL register.