# Performing Arithmetic Operations with Locally Homogeneous Spiking Neural P Systems
## 3 An Locally Homogeneous Spiking Neural P System for Addition
### An LHSNP System with 1 Input Neuron for 2 Numbers Addition
Until \(2k+3\) time slice, these spikings are piled up in \(\sigma_{aux_{3}}\). (3) \(t=k+3\) to \(2k+2\), the summand cache module continuously generates spiking outputs. At each time slice, \(\sigma_{sum_{0}}\) sends the corresponding spiking of each summand to \(\sigma_{Add}\) in sequence. At the same time, the spiking in \(\sigma_{sum_{k-1}}\), \(\sigma_{sum_{k-2}}\), \(\ldots\), \(\sigma_{sum_{0}}\) are sequentially cleared. Starting from \(2k+2\) time slice, there are no rules that can use in the transmit addend neurons. (3)Add Input The spiking corresponding to each addend sent by \(\sigma_{in}\) is sent to \(\sigma_{Add}\) through \(\sigma_{add}\). At \(t=1\) to \(k+2\) time slice, \(\sigma_{Add}\) does not generate spiking output. At \(t=k+3\) to \(2k+3\) time slice, \(\sigma_{add}\) sends the corresponding spiking of each addend bit to \(\sigma_{Add}\) at each time slice. The transmission process of \(\sigma_{add}\) is as follows: (1) \(t=1\) to \(k+2\), \(\sigma_{add}\) does not generate spiking output. During this time, \(\sigma_{add}\) received spiking sent by \(\sigma_{in}\) is consume by forgetting rule \(a\to c\it{rlambda}\). (2) \(t=k+1\) to \(2k\), the spiking corresponding to each binary addend is transmitted in order from low to high send to \(\sigma_{in}\). At \(t=2k\) time slice, the addend input is completed. These spikings through \(\sigma_{add}\) transferred to \(\sigma_{Add}\). (3) \(t=k+2\) to \(2k+1\), \(\sigma_{add}\) receives spikings sent by \(\sigma_{in}\). At each time slice, \(\sigma_{Add}\) also receives 2 spikings sent by \(\sigma_{aux_{2},0}\) and \(\sigma_{aux_{2},1}\). With the assistance of \(\sigma_{aux_{2},0}\) and \(\sigma_{aux_{2},1}\),\(\sigma_{add}\) send spiking to \(\sigma_{Add}\) transmission addend. During this time slice, if there are 2 spikings in \(\sigma_{add}\), \(\sigma_{add}\) use the forgetting rule \(a^{2}\to c\it{rlambda}\) consuming 2 spikings and sending 0 spikings out. Indicates that the binary addend passed is \(0_{2}\). If there are 3 spikings in \(\sigma_{add}\), firing rule \(a^{3}\to a\), consume 3 spikings and send 1 spiking out, indicating that the binary addend passed is \(1_{2}\). At \(t=k+3\) time slice, the spiking corresponding to the lowest bit of the addend is sent to \(\sigma_{Add}\). At \(t=2k+2\) time slice, the spiking corresponding to the highest bit of the addend is sent to \(\sigma_{Add}\). (4)Data Overflow Detection The way to detect data overflow in \(\sigma_{Add}\) is to use 4 spikings sent by \(\sigma_{aux4}\) to detect whether the highest bit of the 2 addends have carry after calculation in \(\sigma_{Add}\). If there is a carry, then \(\sigma_{Add}\) firing rule \(a^{5}\to a^{4}\) and send 4 spikings to the environment to indicate data overflow. The input process for data overflow monitoring is as follows: (1) \(t=1\) to \(k+1\), \(\sigma_{aux_{4}}\) has no spiking input. (2) \(t=k+2\) to \(2k+2\), \(\sigma_{aux4}\) received 1 spiking sent by \(\sigma_{aux_{2},1}\) at each time slice. These spikings are stacked in \(\sigma_{aux_{4}}\). At \(t=2k+2\) time slice, \(\sigma_{aux4}\) accumulated \(k+1\) spikings. (3) \(t=2k+3\), \(\sigma_{Add}\) received four spikings sent by \(\sigma_{aux4}\) firing rule \(a^{k}+1\to a^{4}\). At the same time, \(\sigma_{aux4}\) received 1 spiking sent by \(\sigma_{aux_{2},1}\), which accumulates in \(\sigma_{aux_{4}}\) until the system stops. If there are 4 spikings in \(\sigma_{Add}\), it means that the calculation result does not overflow. If there are 5 spikings in \(\sigma_{Add}\), it indicates that the calculation result overflows. \(\sigma_{Add}\) use the rule \(a^{5}\to a^{4}\) to send 4 spikings to the environment. (5)Addition Operation Two addends are sent to \(\sigma_{Add}\) in order of binary bits from low to high. At \(t=k+3\) to \(2k+2\) time slice, the spiking corresponding to each of the two addends is sent to \(\sigma_{Add}\). At\(t=k+4\) to \(2k+3\) time slice, \(\sigma_{Add}\) send the calculation results to the environment.