A good first step in understanding how to implement a Bayesian network in analog subthreshold CMOS is to implement some simple soft boolean logic gates. Boolean logic gates can be represented by trellis modules, which are a type of bipartite graph with labeled edges. From these modules, we can build analog CMOS gates using the building blocks described in the previous section.
An example of a trellis module for a boolean EXOR gate is shown in figure
8. This trellis module describes the boolean function
iff
. One edge is drawn for each case
where
, so in this module there are four edges. No edge
is drawn for the case where
,
, and
, because it
does not satisfy the requirement that
, which means
.
A second trellis module example is shown in figure 9.
This module implements the boolean function
iff
. This type of calculation can be seen as a backwards reasoning
wherein the result,
, is needed to perform the calculation
[10]. This type of backward function expresses the idea that we
have some apriori knowledge regarding the relationship between
,
,
and
, and that knowledge is expressed in the edges of the trellis
module.
If we are given that
and
, from the trellis module we see
that
. On the other hand, there is no edge representing the
relationship between
,
, and
if
and
. This
indicates that we have no apriori knowledge about this case and the value
of
is unknown.
Building a circuit that implements a soft boolean logic gate is similar
to constructing a trellis module for it. We enumerate the various
possible inputs and observe if the function
evaluates to true.
In a trellis module, for the cases where the function is true, we need
only draw an edge. In a circuit, we need to do a calculation:
which is simply equation 2 applied to a problem
with two inputs,
, and
, and one output,
. In cases where
, the term
evaluates to zero and we
throw it out. For an EXOR gate, this enumeration is as follows:
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
From this chart, we see that the EXOR gate must implement the following functions:
Now we know exactly what the EXOR circuit must do, and we have the parts from which to build it. The first thing to notice is that the calculation will involve four multiplications and two additions. The additions are shorts between wires and the multiplications can be implemented by the Gilbert multiplication circuits covered in section 5.5.
To use the multipliers, we take advantage of the fact that
and
. Simply stated, the inputs
to the multiplier cells,
and
, must be either
and
or
and
and this will ensure that
the multipliers multiply properly. If we choose to use
and
, then the inputs to the base of the multipliers,
,
must be
and
. The cells then give us all 4 possible
multiples of the
and
variables. With these in hand we need only
sum them according to equations 27 and 28, by
shorting the outputs
and
from each of the cells in the
appropriate way. The final addition to the circuit is a pair of current
mirrors that reflect the output so that it can be used as the input to
another circuit. The schematic is shown in figure 10.
The CMOS OR gate is similar to the EXOR gate in structure but is a useful
example in that it shows what to do if more than one copy of a particular
signal is needed and what to do if no copies are needed. It also shows
that implementation of backwards reasoning is no more difficult than
forwards reasoning. The truth table for the function
iff
is:
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Equations 29 and 30 show that we will need two copies
of the term
and no copies of the term
. The schematic in figure 11 shows how to deal with
this situation. The unused term is tied to
and term that we
need two copies of is duplicated with a current mirror that has two
transistors in its train. Otherwise the structure of the circuit is
analogous to the EXOR gate.