Stochastic Logic Computation
From The Circuits and Biology Lab at UMN
Contents |
Stochastic Logic Computation
Basic Concept
A stochastic logic system is built on a logic circuit, but each input of the circuit is a
Bernoulli sequence. Then, the output of the circuit will also be a binary stochastic bit
stream (In certain cases, it is also Bernoulli sequence). The value in the stochastic
system is represented by the probability of the occurrence of a logical 1 in the
sequence. We usually represent stochastic bit stream in two formats, bipolar and
unipolar formats. In the unipolar case, the value y of a stochastic bit
stream X is
whereas, in the bipolar case
Advantages of stochastic logic system include:
- Simple hardware implementation of some basic arithmetic operations. For example,
we can use a single AND gate to do multiplication. (For details, please see the next
section.)
- Fault tolerance. In stochastic bit stream, all of the bits have the same significance
and the significance of a single bit error is small and decreases with logner bit
stream.
- Parallelism. It seems that using a bit stream to represent a single value will
increased the number of clock cycles to accomplish a given computation. However,
we can duplicate the original circuit many times and do parallel computation. Figure
1 shows an example. The original serial computation will require 4 clock cycles to
finish, but using 4x Parellel, the computation cycles reduce to one. Parallelism
allows the tradeoff between time and area.
There are some disadvantages of stochastic logic system. The main disadvantage
is the variance inherent in estimating the value of a stochastic bit stream. Assume
the bit stream X has totally N bits with each one of
probability p to be logical 1. If a stream has k bits to
be 1, then the value we estimated will be
The probability to get k bits is

The expected value of
is

and the variance of
is

However, the variance will decrease if we use a longer bit stream at the cost of
longer computation time or larger circuit area.
Implementation of Basic Arithmetic Operations with Stochastic Logic
A. Multiplication
In the unipolar format, an AND gate performs the multiplication. Let the input of an
AND gate be two uncorrelated Bernoulli sequence A and
B. The output is also a Bernoulli sequence C. The
value represented by sequence C will be

In the bipolar format, an XNOR gate performs the multiplication. Since
, the value represented by
sequence C will be
![c=2P(C)-1=2[P(A)P(B)+\bar{P}(A)\bar{P}(B)]-1=2\frac{(a+1)(b+1)+(1-a)(1
-b)}{4}-1=ab](/math/a/8/8/a885ed802d3cb91b748c811b3f01f113.png)
B. Addition
Addition and subtraction are not closed operations on the interval [0,1] for unipolar format or [ − 1,1] for bipolar format. Therefore, it is
not possible to perform them, without a scaling operation. To perform addition with
scaling
, where Si are scaling
value such that
, A multiplexer is used. It randomly
selects a given input i with the probability Siso that the output
probability will be a scaled sum of the input probabilities. Assume the output
sequence is Y, and input sequences are Xi s. We
have that

For either unipolar or bipolar format, we will get

Analyzing Stochastic Logic System Built with Combinational Logic Circuits
Generally, the output value (represented by the output stochastic bit stream) of a
stochastic logic system is a function of its input values. The problem interested us is
that given an arbitrary combinational logic circuit building a stochastic logic system,
what is the function it performs and how can we get the function?
Problem Definition
Given a combinational logic circuit with n inputs
and output Boolean function
, if its input bit streams represent values
, respectively and output bit stream represents
value po, what is the function
and how can we get it?
The Form of Function F
Here we only consider unipolar format representation of value. We can get the
function in bipolar format representation by simply changing F as
2F − 1 and substituting each variable pi with
. The result for unipolar format is:
F is an integral-coefficient multivariate polynomial in the form of

and satisfies

Here the form of F means that each variable in each product term of
F has its power no more than 1.
====The method to get F from the Boolean function
f==== We assume here that the Boolean function f is only composed with
AND(
), OR(
) and NOT(
)
operations. (We can always change f into this form.)
First we construct a multivariate polynomial G which satisfies that
. We say that polynomial G
realizes Boolean function f
The construction of G is recursively defined:
- Basic case: f = x, then G = x
- NOT case:
and we know G1 realizing
f1. Then, G = 1 − G1
- AND case:
and we know G1 and G2 realizing f1 and f2, respectively. Then,
- OR case:
and we know G1 and G2 realizing f1 and f2, respectively. Then,
After we get G, we get F by setting to 1 the power of
each variable in a product term of G, if they have power more than 1
in that product term. For example, the product term
in
G will be changed to x1x2 in F. We
call this step as normalization.
Example: Given Boolean function
, get
F
Solution: f can be composed as:
|
|
|
|
|
|
we have
|
|
|
|
|
|
Finally, we do normalization and get

