y ≈ e N
N , (3.8)
2 x + e− 2 x
where y = 2PY − 1, x = 2PX − 1 are the bipolar representation of the input sequence X and the output sequence Y , respectively.

Stochastic Exponentiation Function

\label{stochastic-exponentiation-function}
… …
… …
… …
Figure 3.5: State transition diagram of Stochastic Exponential function This function that is illustrated in Fig.3.5 is configured as [4]:
. 0, 0 ≤ i ≤ N − tt − 1
Y = , where 0 i N 1 (3.9) 1, N − tt ≤ i ≤ N − 1
By defining x = 2PX − 1 to be the bipolar representation of the input sequence, and y = PY to be the unipolar format of the output sequence, we have an approximation as follows
. e−2Gx, 0 < x ≤ 1
y , where 0 < tt << N. (3.10) 1, −1 ≤ x ≤ 0
𝑋 X
\label{ux1d44b-x}
\label{section-13}
\label{section-14}
\label{section-15}
Figure 3.6: State transition diagram of Stochastic Absolute function

Stochastic Absolute Value Function

\label{stochastic-absolute-value-function}
Stochastic Absolute Function was propose in [14] with the state transition diagram is as Fig.3.6. The output Y is determined by current state Si as
 0, i is odd when 0 ≤ i ≤ N/2 − 1 OR
Y = 

i is even when N/2 ≤ i ≤ N − 1
1, i is even when 0 ≤ i ≤ N/2 − 1 OR i is odd when N/2 ≤ i ≤ N − 1
, where 0 ≤ i ≤ N − 1; 0 < tt << N. (3.11)
And this configuration approximate an absolute function in which the input x = 2PX − 1 and the output y = 2PY − 1 are the bipolar formats, and
y = |x| (3.12)

Stochastic Exponentiation Function on an Absolute Value

\label{stochastic-exponentiation-function-on-an-absolute-value}
𝑋
𝑆0
𝑌0 = 0
X …
𝑋
X
𝑋
𝑆𝐺−1
𝑌𝐺−1 = 0
X
𝑋
𝑆𝐺
𝑌𝐺 = 1
X
X
… …
… …
… …
𝑋
Figure 3.7: State transition diagram of Stochastic Absolute Exponential function
This mixed function whose state transition diagram is shown in Fig.3.7. This kind of FSM based stochastic function can be implemented by setting as follows,
. 1, tt ≤ i ≤ N − tt − 1
Y = , where 0 i N 1; 0 < tt << N (3.13) 0, i < tt OR i > N − tt − 1
The approximate function in this configuration [17], [15] is
y = e−2G|x|, (3.14)
where x = 2PX −1 and y = PY are the bipolar representation of the input sequence X and the unipolar format of the output stream Y , respectively.

Simulation and analysis

\label{simulation-and-analysis}
As all FSM–based Stochastic elements are build using the approximation [15], there are certainly the variation of these linear functions in comparison with the theoretical ones. According to the configuration that we introduced, the number of states will be considered as a principal that affects on the output. Here the tanh and absolute functions will be considered as our case study.
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1
x
bipolar
Figure 3.8: Simulation results of the Stochastic absolute function when consider different number of states
It can be seen in Fig.3.8 that the approximation results are closer to the desired one, i.e., approximation error decreases, when the number of states increases from 8 to 64. And this increasing equally affects on the malformation at x = 0: the distortion can be minimized by using more states of FSM. However, one thing must be remarked on is the incresing of states corresponds to the increasing of complexity of implementation.
In order to evaluate the Stochastic tanh function, it can be illustrated in Fig.3.9 when the numbers of state are 4 and 16. Fig.3.9a represents a poor result for the design using FSM with only 4 states, while Fig.3.9b with 16 states provides a better result where the approximation function is closer to the theoretical one. This difference between two state selections are considerable. In other word, we obtain a good result of this approximation function for large values of states. Nervertheless, as the first simulation, an issue is how to choose an amenable number of states for our design. Fortunately, relying on the approximation error, the authors in [15] also recommended this such value corresponding to each FSM–based stochastic function: 8–state FSM for the Stochastic tanh function, 16–state FSM for the Stochastic Exponentiation function, 32–FSM for the Stochastic Exponentiation function on an Absolute values, and 8–FSM for the Stochastic absolute function.
1 1
0.8 0.8
0.6
0.4
0.6
0.4
0.2 0.2
0 0
−0.2 −0.2
−0.4 −0.4
−0.6 −0.6
−0.8 −0.8
−1
−1 −0.8 −0.6 −0.4 −0.2
x 0 0.2 0.4 0.6 0.8 1
bipolar
−1
−1 −0.8 −0.6 −0.4 −0.2
x 0 0.2 0.4 0.6 0.8 1
bipolar
  1. (b)
Figure 3.9: Simulation results of the Stochastic tanh function: (a) using 4–state FSM and (b) using 16–state FSM
Chapter 4
Digital Filter and Image Processing Using Stochastic Computing
This chapter is to address the architecture of digital filter and image processing circuits using SC. The basic operators relied on combinational logic circuitry will be employed for the stochastic FIR filter. Meanwhile, the FSM–based stochastic elements will be effectively investigated in two important applications: edge detection and median filter based noise reduction. The soft–error is equally injected into the internal circuit with different levels to evaluate the fault–tolerace of stochasic approach. Our work will demonstrate that stochastic implementations can be considerably more noise–tolerant and consume less hardware than conventional ones.