5.5 Logic

Configurable Logic Elements

The PIC16F/PIC18F Configurable Logic Cell/Block (CLC/CLB) and the PIC32CM Configurable Custom Logic (CCL) peripherals function as programmable glue logic within the device. CCL and CLC enable real-time, core-independent logic operations with custom combinatorial and sequential logic functions. Developers can add connections between internal peripherals, device pins, and events, reducing or eliminating the need for external logic components. CLB offers larger and more complex logic functions, similar to a small FPGA. The following table provides a comparison of features of the PIC16F, PIC18F, and PIC32CM.

Table 5-19. PIC16F, PIC18F, and PIC32CM CCL Features
FeaturePIC16F CLC/CLB PIC18F CLCPIC32CM CCL
Inputs4 inputs per module4 inputs per module3 inputs per LUT
Logic Functions SupportedAND, NAND, OR, NOR, XOR, XNOR, AND-OR, AND-OR-INVERT, Latches

Look-up tables (CLB)

AND, NAND, AND-OR, AND-OR-INVERT, OR-XOR, OR-XNOR, LatchesAny logic expression up to three inputs:

AND, NAND, OR, NOR, XOR, XNOR, NOT, flip-flops, latches

Truth table-based

Sequential LogicGated D flip-flop

JK flip-flop

D latch

RS latch

Gated D flip-flop

JK flip-flop

D latch

RS latch

Gated D flip-flop

JK flip-flop

D latch

RS latch

Input SourcesI/O pins, internal clocks, register bits, timers, comparators, PWM, other peripherals

NVM Scanner (CLB)

I/O pins, internal clocks, register bits, timers, comparators, PWM, other peripheralsI/Os, events

Internal peripherals

Subsequent LUTs

Output Routing I/O pins, PWM, interrupt, other peripheralsI/O pins, interrupt, other peripherals, other CLCsI/O pins, Event System
Other FeaturesOutput mirror registers

Hardware counter (CLB)

Output mirror registersSynchronizer, filter, edge detector
Interrupt GenerationSupportedSupportedSupported
State Machine SupportSupported (CLB)Supported (through flip-flops, latches)Supported (through flip-flops, latches)
Event System IntegrationN/AN/ASupported
Low Power OperationSupportedSupportedSupported (sleepwalking, event-driven)