On the Application of a Diffusive Memristor Compact Model to Neuromorphic Circuits

Memristive devices have found application in both random access memory and neuromorphic circuits. In particular, it is known that their behavior resembles that of neuronal synapses. However, it is not simple to come by samples of memristors and adjusting their parameters to change their response requires a laborious fabrication process. Moreover, sample to sample variability makes experimentation with memristor-based synapses even harder. The usual alternatives are to either simulate or emulate the memristive systems under study. Both methodologies require the use of accurate modeling equations. In this paper, we present a diffusive compact model of memristive behavior that has already been experimentally validated. Furthermore, we implement an emulation architecture that enables us to freely explore the synapse-like characteristics of memristors. The main advantage of emulation over simulation is that the former allows us to work with real-world circuits. Our results can give some insight into the desirable characteristics of the memristors for neuromorphic applications.


Introduction
Memristive elements or resistive switches are two-terminal components that exhibit a hysteretic relation between voltage and current [1][2][3]. Because they are highly nonlinear and have the property of non-volatility, there is a great interest in their use in the design of new applications in neuromorphic circuits [4][5][6][7][8][9][10][11][12][13][14][15], programmable logic [16][17][18] and chaotic circuits [19][20][21], as well as in the development of new memory technologies [22][23][24][25]. Unfortunately, it is not simple to come by samples of memristors. Moreover, each time a researcher desires to adjust a parameter to change their response, she needs to go through a laborious fabrication and testing process. The usual alternatives are to either simulate [26][27][28][29][30] or emulate [31][32][33][34][35][36][37] the memristive systems under study. Emulation has the additional advantage that it allows to test the interaction of memristors with real circuit components [38]. For this reason, we present a simple emulator, based on widely-available and low-cost hardware that can work with various numerical models of memristors.
Since synapses can be understood as two-terminal elements with variable conductance, there has been an increasing interest on the application of memristors as synaptic junctions [4][5][6][7][8]13]. In particular, it has been proposed to modulate memristors conductance by applying specific signals, namely action potentials, with shapes and time characteristics that define the response of the neuromorphic circuit such as in the case of the Spike-Timing-Dependent Plasticity (STDP) process [6,8]. STDP relates the change in connection strength between two neurons as a function of the temporal distance between pre and postsynaptic stimuli [39][40][41]. It has been observed that the synaptic strength increases (decreases) when the presynaptic cell fires before (after) the postsynaptic neuron.
In the literature, we find some sophisticated protocols and complex circuits that allow for qualitatively mimicking the behavior of synapses [4]. However, it has been recently shown that the response of memristors with diffusive dynamics is already very similar to that of a synaptic junction [29,42]. Thus, it is interesting to study the application of this type of memristors in neuromorphic computing systems.
Memristors have also been used as part of more complex neuromorphic circuits. Particularly, in those that mimic the classical learning rule known as Pavlovian conditioning [43][44][45]. In this learning procedure, a specific stimulus that provokes a given response is paired with a neutral stimulus and, as a result of this pairing, the neutral stimulus can later evoke a response in the absence of the specific stimulus [46].
Since memristors with diffusive dynamics are well-suited to mimic the behavior of a synapse, in this work, we focus on the study of such type of memristors in simple neuromorphic circuits that present STDP behavior and Pavlovian conditioning, and study their performance as a function of the memristive device response time. To this aim, we consider a compact model of memristor that accurately describes the behavior of actual memristive systems [47][48][49]. This memristor model was implemented in an emulation architecture based on a microcontroller and a digital potentiometer. An exhaustive characterization of the emulator device and preliminary results of the STDP process were presented in Ref. [50].

Compact Model of Memristive Behavior
In this section, we review a compact model for memristors with diffusive dynamics that we have already introduced and have shown to represent accurately the experimentally measured behavior of actual devices [47][48][49].
Memristive devices are usually modeled by two equations. While one of the equations describes the I-V characteristic, the other governs the evolution of a state variable on which the I-V characteristic depends on. Many experimental reports show that, as multiple conductive channels in the insulator are created or destructed, metal-insulator-metal devices exhibit more than two conductive states. For this reason, we developed a model whose state variable tracks the fraction of active conductive channels [47][48][49]. Assuming that the channel creation probability follows a threshold distribution f + (v), the dependence of the creation of conductive channels Γ + on the applied voltage v can be calculated as where H(x) is the Heaviside function. On the other hand, the destruction of conductive channels Γ − can be obtained by considering the destruction threshold distribution f − (v). Both Γ + and Γ − are used to define a recursive formula for the discretized-time evolution of active conductive channels as where h is the integration time step. The evolution of λ is highly sensitive to the creation and destruction distributions f ± (v). For instance, skewed distributions may be suitable to describe devices where transitions take place abruptly upon reaching a given threshold potential while bell-shaped distributions may be used to describe those devices with gentle transitions [51]. For the sake of simplicity, we consider the latter approach with f ± (v) following logistic distributions. Thus, the Γ ± functions are given by sigmoid functions Parameters δ ± and α ± are positive constants that account for the positive and negative threshold potentials and transition rates, respectively. Figure 1 depicts voltage distributions f ± and the corresponding Γ ± functions. Equation (2) fixes the evolution of active channels λ between the region delimited by Γ ± . Conductive channels are neither aggregated nor dissolved instantaneously. Moreover, the response time depends on the magnitude of the driving signal. Experiments have shown that switching time and voltage are related by an exponential function. In order to account this phenomenon, the time evolution of active channels w(t) is described by the differential equation where τ 0 is a characteristic response time, associated with a diffusive process, and v 0 a positive constant that weights the input stimuli. Figure 1. Threshold distributions f ± are bell-shaped. The number of active channels λ is a function of the applied potential v and evolves within the region delimited by Γ + and Γ − . The model is completed by specifying a relationship between w(t) and the I-V characteristics of the device. In previous works, the I-V characteristic equation was a nonlinear relationship that resembled that of two identical opposite-biased diodes [52,53]. As the main goal is to study the dynamics of switching effect, we simplified the I-V relation to that of a linear variable resistance described by where R on and R off are the low and high-resistance levels of the memristor, respectively. This simplified relation alleviates the computation burden of simulation and emulation processes, without changing the essence of the model.

Emulation Architecture
Many emulation architectures have been proposed [31][32][33][34][35][36][37]. Following the work of Olumodeji and Gottardi [36], we base our design on an Arduino board and a digital potentiometer. A schematic of the emulator design is shown in Figure 2. The analog-to-digital converters (ADCs) in the Arduino are used to measure the current that flows through the potentiometer. The microcontroller integrates the differential equations that model the behavior of the memristor and changes the resistance of the potentiometer. A description of the emulator architecture is given in Section 3.1. In Section 2.1, we present results that validate the correctness of the implemented emulator.  Figure 2. Schematic of the proposed emulator. An analog-to-digital converter (ADC) in the microcontroller measures the voltage on the digital potentiometer. The differential equations describing the memristor behavior are numerically integrated based on those measurements; then, the potentiometer resistance is changed accordingly. Signal conditioning is required to adapt the voltage to the microcontroller ADC input range.

Memristors for Neuromorphic Applications
There is a vast literature on the application of memristors for machine learning and computation (see, e.g., [54][55][56][57][58] and references therein). In particular, a review of the pertinent bibliography reveals a special interest on the use of memristors in neuromorphic circuits [4][5][6][7][8][9][10][11][12][13][14][15]. The focus of this paper is to study the possibility of using memristors as neuronal synapses and to characterize the role of the parameters that influence the dynamics of the memristive behavior.
A synapse is a biological structure that allows the communication of two neurons which is located, for example, in the junction of an axon with a dendrite of a different cell. The modulation of the synaptic strength plays a crucial role in learning and memory formation. By adjusting the weight of cells' connections, the neural network can be reconfigurated. The connection strength between network elements is adapted through processes known as learning rules. One type of these processes is the one described by the Hebbian theory where it is postulated that the synaptic modulation is driven by correlations between pre and postsynaptic neuronal activity. Spike-Timing-Dependent Plasticity (STDP) process [39][40][41]59] is one common protocol to analyze the adaptation of synaptic strength. The initial strength of connection is quantified by measuring the response of the postsynaptic neuron to the application of a measurement pulse to the presynaptic cell. Then, a periodic sequence of presynaptic and postynaptic stimuli, separated by a time ∆t, is applied. The effect of such stimuli signals is evaluated by measuring the postsynaptic response to a new test pulse in the presynaptic neuron. STDP describes the dependence of the change of synaptic strength, before and after the treatment, on ∆t. In Section 2.2, we review results of a series of experiments [50] with emulated memristors that mimic the STDP process of real biological synaptic junctions.
Classical conditioning is another type of learning theory that relates preceding stimuli and behavioral reactions in animals. Let us assume that there is an unconditioned stimulus (US) that provokes an unconditioned response (UR). There is also a neutral stimulus (NS) that initially does not provoke any response. If the neutral stimulus is presented to the subject simultaneously with the unconditioned stimulus in one or more opportunities, then an association is created and the NS becomes a conditioned stimulus (CS) that, even in the absence of the US, provokes a conditioned response (CR) like the unconditioned one. The typical example from Pavlov's original research is the physiological reaction of dogs in the presence of food [46]. A dog naturally salivates (UR) in the presence of food (US). If, for example, a dog is stimulated by the sound of a bell (NS), no reaction in the digestive system is found. However, if the food is accompanied by a bell sound in several opportunities, the dog learns to associate the bell to food. Then, the sound of the bell becomes a CS that provokes salivation in the absence of food (CR).
There are many examples of neuromorphic circuits involving memristors that appear to mimic Pavlovian learning [31,[43][44][45]60,61]. Tan et al. [45] note that Pavlovian conditioning comprises three different behaviors: (1) acquisition of the association by training trials where NS and US are either simultaneous or close in time, (2) extinction of the association (forgetting) when CS is applied alone, and (3) recovery by a training process after the last extinction. According to Tan and colleagues, no previous works addressed all three features of classical learning. Figure 3 shows a block diagram of the experimental setup identical to that in Hu et al. [43]. The unconditioned stimulus is fed into neuron 3 through synapse 1. Since the response to the US is innate and assumed to be unchangeable, synapse 1 is simply implemented as a constant resistor. The conditioned stimulus is fed into neuron 3 through synapse 2. Given that actual conditioning occurs in this synapse, its implementation is slightly more complex and it involves a memristor. Moreover, this synapse receives feedback from neuron 3. The output of the experimental setup is a simple comparator that gives a binary signal (salivation/no-salivation) based on the output of neuron 3. In Section 2.3, we show that the simplified model in Equations (2)-(5) is useful to reproduce the essence of classical conditioning when used to emulate the memristor in Figure 3. A detailed description of the experimental setup, including circuits schematics, is given in Section 3.2.

Validation of the Emulation Architecture
We verified the correctness of the emulator design by implementing the memristor model introduced in Section 1.1 and comparing the resulting measurements with numerical simulations. The circuit schematic of the experimental setup and typical measurements are shown in Figure 4. The circuit under test, shown in Figure 4a, is comprised of an arbitrary wave generator that feeds the emulator device with a sinusoidal signal and an in-series measuring resistance that tracks the flowing current. Figure 4b shows experimental results for two driving frequencies. It can be seen that the rate at which the driving signal changes influences the apparent switching threshold [62]. In order to validate the memristor emulator, we solved Equations (2)-(5) numerically. These results are presented in Figure 4b showing a good agreement with the emulator results.

Synapse Mimicking
Part of the material in this section was already presented in Ref. [50]. The main goal is to reproduce the STDP process by an appropriate pulsing experiment with the memristor playing the role of the synapse. We used a simple circuit comprising an arbitrary waveform generator, a resistor, and the memristor emulator as it is schematized in Figure 4a. We applied a 500 ms-period signal consisting of two stimulus pulses, one positive (the presynaptic stimulus) and one negative (the postsynaptic stimulus). The signal also included two measurement pulses, one of them 50 ms before the presynaptic pulse and the other 50 ms after the postsynaptic stimulus. While the stimuli were 50 ms-wide and had an absolute amplitude of 1.5 V, the measurement pulse was only 25 ms-wide and 200 mV high. Pulse duration was partly determined by the frequency limitations of the emulator circuit (see Section 3.1). The measurement pulse amplitude was chosen in order to avoid a significant resistance change. Figure 5 shows a particular example where two stimuli overlap for ∆t = 25 ms. Figure 5 also shows results tracking the current flowing through the emulator. As expected, the transient response of the current corresponds to the resistance change of the emulator. Let us remark that the results in Figure 5, as well as the results in all the remaining figures of this work, were experimentally obtained on the basis of emulated memristors.
Having fixed the pulsing protocol, model parameters were chosen on a trial and error basis, aiming to obtain the desired synapse-like behavior: α ± = 30 V −1 , δ ± = 0.75 V, R on = 1 kΩ, R off = 5 kΩ, and v 0 = 0.2 V. Since we are interested on the influence of the device's response time, τ 0 was varied. In order to understand the behavior of the memristor with the selected parameters, Figure 6 shows experimental results, measured on the emulator, for different values of τ 0 . The experimental setup is the same as in Figure 4a, where a sinusoidal signal is applied. The frequency (1 Hz) and amplitude (1.5 V) were set to be commensurate to those in the pulsing experiment. It is interesting to compare the resulting curves in Figure 6 with those in Figure 4b. Whereas in the latter case R on and R off are attained in each cycle (as evidenced by the same extreme slopes for both driving frequencies), in the former case, the memristance changes between two intermediate values. Moreover, the two extreme resistance values depend on the response time τ 0 . Let us now return to the pulsing protocol in Figure 5. For a fixed ∆t, we applied a driving signal that was composed of several periods of the stimulus signal. In this way, we studied the relation between ∆t and the resistive change of the device. Figure 7 shows the resistance behavior during the first eight periods for two ∆t and a pair of different initial conditions. The figure shows that the final value of the resistance is sensitive to the delay ∆t but not to the initial setting. We thoroughly characterized this behavior by exciting the memristor with 20 consecutive periods of the stimulus signal and changing the value of ∆t. Figure 8 shows the relation between the final resistance and ∆t. In particular, we show results for τ 0 = 5, 10, and 20 s (see Equations (2)-(5)). As it can be seen, the behavior depends on whether ∆t is smaller or greater than the pulsewidth (50 ms). Whenever there is destructive interference between the pre and postsynaptic stimuli (|∆t| < 50 ms), the final state exhibits a strong dependence on |∆t|. However, no such dependence is observed when |∆t| > 50 ms and only τ 0 influences the final resistance. The initial setting was 5 kΩ and the remaining experimental parameters were as in Figure 5. Figure 9 shows the influence of ∆t and τ 0 on the ratio of change of the resistance in relation to its final state. Since the measured behavior of the resistance as a function of ∆t is qualitatively similar to that observed in real neurons, we believe that memristive devices that are modeled by this type of dynamic behavior are suitably to be used in neuromorphic circuits inspired by the STDP process. As the final state of resistance is affected by the parameter τ 0 , it will affect the resistance change ratio. The change of resistance decreases as τ 0 increases.

Classical Conditioning
In this section, we show that the simplified model in Equations (2)-(5) is useful to reproduce the essence of classical conditioning. Figure 3 shows a block diagram of the experimental setup identical to that in Ref. [43]. Details of the experimental setup are given in Section 3.2. Figure 10 shows typical results of our experimental setup for Pavlovian conditioning. Results are grouped into four blocks. In the first block, in the absence of association, the bell (signal V b ) is a neutral stimulus that does not provoke any response (no salivation in the last row). In the second block, the unconditioned stimulus (food, V f ) is accompanied by the unconditioned response. Although the bell follows immediately after the US has disappeared, no association is produced and there is no response to the neutral stimulus. In the third block, food and bell are simultaneous and the association is acquired: there is a conditioned response to the conditioned stimulus even after the unconditioned stimulus has disappeared. Moreover, after a lapse in which CS is applied alone, the association is forgotten. Finally, in the fourth block, the association is recovered. Note that the forgetting process takes longer than in the third block, which corresponds intuitively to the reinforcement of the association. In summary, all three features described by Tan et al. [45] as necessary for classical conditioning are present, viz. acquisition, extinction and recovery of the association.
One of the advantages of using an emulator instead of an actual memristor is the possibility of changing model parameters easily. It is this advantage that allows us to study the influence of the characteristic response time of the memristor τ 0 on learning time and memory persistence. Figure 11 shows results for the same experimental setup as in Figure 10. Memory persistence is measured as the number of input bell pulses, after the food stimulus has disappeared that produces a conditioned response. Since small random variations may produce changes in the measurements, Figure 11 presents results of ten experiments. Although it can be expected that, as τ 0 increases, the memory lasts longer, Figure 11 seems to exhibit a different picture. However, the fact is that, as τ 0 increases, it takes longer to produce a strong association between the conditioned stimulus (bell) and the conditioned response (salivation). Weaker association for larger memristor response time is reflected in shorter memory persistence. Even in Block 3, no association is learned when τ 0 = 20 s. Longer memory persistence in Block 4 is due to the strengthening of association after a second round of training.
In order to evaluate memory persistence without the confounding element of learning time, we conducted a different set of experiments where the system departs from a strong association (low memristor resistance, ∼1 kΩ). At the beginning of each experiment, both the unconditioned and conditioned stimuli are present for five pulses. After this association-strengthening period, both stimuli are interrupted for a variable lapse (measured as number of absent stimulus pulses or blank spaces). Finally, only the conditioned stimulus is enabled again after the no-stimuli lapse. Memory persistence is measured as the number of CS pulses that produce a response in this final period of the experiment. Figure 12 shows a typical experiment and Figure 13 shows the results of five experiments. As it can be observed, the learned association persists longer as the characteristic time τ 0 increases, as it intuitively expected. Moreover, there is no significant evidence of a stronger forgetting process as the period without stimuli gets longer.   Figure 10. As the characteristic response time of the memristor, τ 0 , increases, it takes longer to produce a strong association between the conditioned stimulus (bell) and the conditioned response (salivation).
The characteristic response time τ 0 varies between the different memristive systems. Amorphous silicon devices present τ 0 values of the order of 10 3 to 10 4 s [63,64], HfO x /AlO x structures of the order of 10 2 s [65], and Ti/HfO/Pt of the order of 1 s [66]. Moreover, many devices present a highly asymmetric behavior between ON/OFF switching times [67]. For these reasons, it is important to perform preliminary characterizations of the neuromorphic circuit to be implemented. Our results suggest that applications, where the information is to be retained for the longest time, should be based on devices with high τ 0 value. However, this has the disadvantage that the resulting learning rules are going to be weaker. On the other hand, in applications where the reconfiguration of the connections is dynamic and it is expected to obtain appreciable changes in short times, the design should be based on devices with low τ 0 where the learning rules are stronger.    Figure 2 shows the schematic of the emulator design. A detailed description and analysis of the architecture of the emulator can be found in Ref. [50]. Time steps of the numerical integration algorithm are limited by the computation speed of the microprocessor. For this reason, we resorted to one of the fastest Arduino boards, the Arduino Due with an Atmel SAM3X8E processor running at 84 MHz [68]. The resulting integration time step was ∼400 µs and, hence, frequency of input signals are required to be 2.5 kHz. We used a Renesas X9C103P [69] potentiometer that accepts bipolar voltage signals and has 100 possible resistance values between ∼35.0 Ω and ∼9.5 kΩ. Although we found this potentiometer adequate for our current implementation, it would be convenient to upgrade future designs with a higher resolution potentiometer.

Details of the Emulator Architecture
The code used to interact with the digital potentiometer was developed by Timo Fager [70]. The X9C103P potentiometer is controlled by an external clock that sequentially changes the resistance by increment or decrement steps. The larger the change in resistance, the longer it takes to realize it due to this sequential programming feature, leading to larger integration time steps. Larger time steps, in turn, limit the highest admissible frequency of the input signals.
Analog-to-digital converters (ADCs) of the Arduino Due admit inputs only between 0.0 and 3.3 V. To prevent damage and malfunction of the microprocessor, there is a signal conditioner circuit to adapt the sensed voltage to adequate signal levels (see Figure 2). Essentially, the signal is buffered, attenuated and biased to comply with the ADC input range.
Measurement errors also limit the emulation accuracy. We found measurement errors much higher than the ADC resolution of the Atmel SAM3X8E microcontroller (12 bits, LSB < 1 mV) due to several noise sources, suggesting that a better noise-resistant circuit design is needed, especially in signal adaptation stage in Figure 2. One of the possible noise sources is due to digital clock feedthrough. Noise problems were somewhat alleviated with low pass filters.
The model described in Section 1.1 is implemented in Arduino Due using a semi-implicit Euler integration algorithm. Algorithm 1 shows the pseudocode of the main loop. Function SETRESISTANCE() uses the utilities in Ref. [70]. Function READVOLTAGES() reads the results from the microcontroller's ADCs and computes the voltage drop on the potentiometer on the basis of the signal adaptation circuit (see Figure 2). The remaining functions are explained in Algorithms 2 and 3.  Figure 3 shows a block diagram of the experimental setup identical to that in Ref. [43] and Figure 14 shows a schematic of our implementation. We must note that Figure 14 shows only the outputs of neurons 1 and 2 in Figure 3: V f is the response of neuron 1 to the unconditioned stimulus (i.e., food) and V b is the response of neuron 2 to the conditioned stimulus (i.e., bell sound).

Details of the Conditioned Learning Experiment
The unconditioned stimulus V f is fed into neuron 3 through synapse 1. Since the response to the US is innate and assumed to be unchangeable, synapse 1 is simply implemented as a constant resistor R syn . The conditioned stimulus V b is fed into neuron 3 through synapse 2. Since actual conditioning occurs in this synapse, its implementation is slightly more complex and it involves an emulated memristor R m instead of a constant resistor. Since the strength of the input to neuron 3 depends on the voltage divider formed by R c and R m , the input becomes stronger as R m decreases. The constant voltage source V forget tries to force the memristor in high resistance values. In this sense, V forget acts as a forgetting drive that is always present. The state of R m can also be altered by the feedback from the output of neuron 3, which is the actual source of association between salivation and the CS.
Simple calculations show that the voltage drop on the memristor is Observe that V m is independent of R m and it depends only on the stimuli. This fact implies that the learning (or forgetting) process is independent of the state of the association between NS/CS and the response.
The output of neuron 3 is fed into a comparator in order to obtain a binary output (V out ) such that a high level corresponds to a (conditioned or unconditioned) response to stimuli. Figure 14. Circuit schematic of the system used to mimic Pavlovian learning. Only the output of the input neurons is represented: V f is the response of neuron 1 to the unconditioned stimulus (i.e., food) and V b is the response of neuron 2 to the conditioned stimulus (i.e., bell's sound)-cf.

Conclusions
It has been argued in the literature that diffusive memristor devices may mimic the behavior of synapses. In this work, we presented a computationally-efficient simplification of an accurate and compact model of such devices. We believe that this model can be very useful in the study of complex neuromorphic circuits and we present its application to two simple examples.
The proposed model was used in a memristor emulator composed of a digital potentiometer and a microprocessor. The main advantage of emulation over simulation is its ability to interact with real-world circuits. In order to validate the correct operation of the emulator, several numerical simulations of a very simple circuit were made under different conditions, finding a good agreement with the experimental results. Although the implemented emulation architecture is simple, it has some limitations. In particular, it is based on a microprocessor with relatively low computing capacity. Future work with more complex circuits or a larger number of emulated memristors will require a faster microprocessor.
The emulated memristor was shown to mimic the Spike-Timing-Dependent Plasticity behavior of synapses. Moreover, it was found that the response time parameter of the memristor, τ 0 , affects the resistance change ratio in the STDP process. The larger τ 0 , the lower the change of resistance.
Finally, we introduced a memristor-based neuromorphic circuit that exhibited the main characteristics of Pavlovian conditioned learning. We also explored the influence of the response time τ 0 in learning and memory persistence. In general, the larger τ 0 , the longer it takes the system to learn. However, once the conditioned response has been learned, a larger τ 0 leads to a longer memory persistence.