I. Introduction
OPTICAL brain stimulation synchronized with neural recording, known as closed-loop (CL) optogenetics, makes it possible to control the activity of a given neuronal network based on the neuronal activity of this specific or another network. This technology holds potential for advancing our understanding normal or pathological brain activity using rodent models, such as mice. Several custom integrated circuits (IC) have been developed and used to build lightweight CL electro-optic implants, but they have practical limitations: 1) they cannot detect and trigger stimulation on complex firing patterns [1], [2], [3], [4], and 2) they have processing latencies larger than biological neural circuits delays (which are typically smaller than 5 ms), which does not allow CL scenarios replicating the physiological conditions [1]. Complex FPGA-based alternatives have been developed [5], [6], but such systems cannot be easily implemented in wireless device because of size and power constrains, especially for rodent-based research. In this paper, we describe a system-on-a-chip designed for autonomous operation which can trigger stimulation with low μs-latency upon detection of complex neural firing patterns. Our adaptive autonomous neural IC (AANIC) includes circuits for multichannel recording & optogenetics stimulation, specialized digital cores to detect, compress, and classify the action potentials (AP), and a programmable 16-bit processor that runs a CL algorithm based on the on-chip AP-to-neuron sorting results. We show that AANIC can detect and silence seizures in vivo in a mouse model of temporal lobe epilepsy by CL activation of ChR2expressing inhibitory neurons.