# 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 \(n\)-addition
\(t=1\) to \(k+1\), \(\sigma_{addend}\) does not generate spiking output. 2. \(t=(i-1)\)\(k+1\) to \(ik\) (\(2\leq i\leq n\)), the spiking corresponding to the \(i\)-th binary addend is received by \(\sigma_{in}\) in order from low to high. At each time slice, these spikings are transmitted to \(\sigma_{Add}\) through \(\sigma_{addend}\). 3. \(t=(i-1)\)\(k+2\) to \(ik+1\) (\(2\leq i\leq n\)), the spiking corresponding to the \(i\)-th binary addend is sequentially received by \(\sigma_{addend}\). At the same time, \(\sigma_{addend}\) will also receive 1 spiking sent by \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\) at each time slice. \(\sigma_{aux_{2,0}}\) and \(\sigma_{aux_{2,1}}\), \(\sigma_{addend}\) is fired and send spiking to \(\sigma_{Add}\). If there are 2 spikings in \(\sigma_{addend}\), \(\sigma_{addend}\) firing rule \(a^{2}\to c\)\(ralambda\) sends 0 spiking to \(\sigma_{Add}\). If there are 3 spikings in \(\sigma_{addend}\), \(\sigma_{addend}\) firing rule \(a^{3}\to a\) to send 1 spiking to \(\sigma_{Add}\). 4. \(t=(i-1)\)\(k+3\) to \(ik+2\) (\(2\leq i\leq n\)), the spiking corresponding to the nth binary addend is sequentially received by \(\sigma_{Add}\). At \(t=ik+2\) (\(2\leq i\leq n\)) time slice, the highest bit of the 2 nd to nth addend is received by \(\sigma_{Add}\). 5. N-addition For each time slice starting from \(k+3\), \(\sigma_{Add}\) receive the spiking corresponding to two binary addends in sequence from low to high. And outputs the operation results to \(\sigma_{sum_{k-2}}\), the environment, \(\sigma_{OF}\), and summand cache module. The spiking output to the environment represents the current calculation result. If there is no overflow in the calculation result, the effective output time of \(\Pi_{Add3}\) is \((n-1)\)\(k+4\) to \(nk+3\). \(\sigma_{Add}\) sends the operation results to \(\sigma_{sum_{k-2}}\) and waits for the next addend to complete the accumulated subtraction in \(\sigma_{Add}\). That is, the operation results of the two addends in this operation with the next addend accumulate subtraction in \(\sigma_{Add}\). \(\sigma_{OF}\) monitors whether the highest bit calculation result in \(\sigma_{Add}\) overflows. The process of implementing the accumulation of \(n\)\(k\)-bit binary numbers is as follows: 1. \(t=1\) to \(k+2\), there is no spiking input in \(\sigma_{Add}\). 2. \(t=k+3\) to \(2k+2\), the spiking corresponding to the first and the second addends are sequentially received by \(\sigma_{Add}\). At \(t=k+4\) to \(2k+3\) time slice, \(\sigma_{Add}\) simultaneously sends the calculation results to the environment, \(\sigma_{sum_{k-2}}\) and \(\sigma_{OF}\) at each time slice. At \(t=k+4\) time slice, the lowest order of the results of two addend operations is output to the environment, \(\sigma_{OF}\), and \(\sigma_{sum_{k-2}}\). At \(t=(i-1)\)\(k+4\) to \(ik+3\) (\(2\leq i\leq n\)) time slice, \(\sigma_{Add}\) sends the calculation results to the environment, \(\sigma_{sum_{k-2}}\) and \(\sigma_{OF}\) at each time slice. 3. At \(t=k+4\) until the system stops, the summand cache module receives spiking sent by \(\sigma_{Add}\) at each time slice. These spikings are transmitted along \(\sigma_{sum_{k-3}}\), \(\sigma_{sum_{k-4}}\), \(\ldots\), \(\sigma_{sum_{0}}\). At \(t=2k+2\) time slice, the results of the first and the second addends are stored in \(\sigma_{sum_{0}}\), \(\sigma_{sum_{1}}\), \(\ldots\), \(\sigma_{sum_{k-1}}\) in order from low to high. At \(t=ik+2\) (\(2\leq i\leq n\)) time slice, the operation results of \(n\) addends are stored in \(\sigma_{sum_{0}}\), \(\sigma_{sum_{1}}\), \(\ldots\), \(\sigma_{sum_{k-1}}\) in order from low to high. 4. From \(t=2k+3\) to \(3k+2\), complete accumulate plus in \(\sigma_{Add}\). At \(t=(i-1)\)\(k+3\) to \(ik+2\) (\(2\leq i\leq n\)), complete the accumulation with the \(i\)-th addend. 5. In the absence of overflow in the calculation results, \((n-1)\)\(k+4\) to \(nk+3\) time slice is the effective output time of \(\Pi_{Add}\).