Spectrum Software has released Micro-Cap 11, the eleventh generation of our
SPICE circuit simulator.
For users of previous Micro-Cap versions, check out the
new features available in the latest version. For those of you who are
new to Micro-Cap, take our
features tour to see what Micro-Cap has to offer.
SPICE3 Boolean Operators Versus Standard Boolean Operators
Micro-Cap contains a group of boolean operators available for use in analog expressions that provides a means to
simulate basic digital functions. There are two sets of these boolean operators: the SPICE3 set and the
standard set. The difference between the two sets is in their output and threshold values. The two sets appear
in the table below:
As can be seen in the table, the &, |, and ~ operators are present in both sets. Since Micro-Cap supports
SPICE2G, SPICE3, PSPICE, and even some HSPICE syntax along with its own extensions, occasional conflicts do
arise between the different types of SPICE. Due to these conflicts, there is a Spice Type option available
in the Schematic Properties dialog box. Multiple types of SPICE can be simulated within the same circuit
without a problem no matter what the Spice Type option is set to. However, this option determines which syntax
type will have priority when a conflict does arise. The syntaxes available in the Spice Type page are
SPICE2G, PSPICE, SPICE3, HSPICE, Ambiguous, and Not Spice. The default setting is Ambiguous in which Micro-Cap
will try to determine the best syntax to prioritize based on the syntax present in the circuit.
An example circuit that demonstrates how the different sets of boolean operators work in conjunction with the
Spice Type option is displayed below. The V1 and V2 pulse sources create two five volt pulses that
represent basic digital waveforms. These two pulse sources are then referenced by the six nonlinear function
(NFV) sources. The NFV sources use both available operators to simulate the And, Or, and Not digital functions
using the following expressions:
V(IN1) & V(IN2)
V(IN1) AND V(IN2)
V(IN1) | V(IN2)
V(IN1) OR V(IN2)
Each of the NFV sources then has an RC combination connected to its output to provide a slight time delay in the
For the first simulation, the Spice Type option in the Properties dialog box will be set to Ambiguous. For this
circuit, Micro-Cap will give priority to the standard method of operation for the boolean operators. This means
that the output of all six boolean expressions will be either one if true or zero if false. The transient
analysis result of this simulation is displayed below. For the expressions referenced with the boolean
operators, any nonzero value is considered true and only an exact zero value is considered false. Even a very
small input value such as 1e-15 would be considered true. This example works well because it is referencing
independent voltage sources, but when referencing nodes elsewhere in a circuit, exact zero values may be rare.
Due to this, in many cases the boolean operators should be combined with the relational operators to provide a
threshold such as in the following expression:
(V(In1) > 1) And (V(In2) > 1)
where both of the voltages at nodes In1 and In2 must be greater than one volt before the expression will return
a true value.
For the second simulation of the example circuit, the Spice Type option in the Properties dialog box is set to
SPICE3. This gives priority to the SPICE3 method of operation for the &, !, and ~ operators. This method uses the
LONE, LZERO, and LTHRESH variables available in the Global Settings. LONE determines the output level when the
boolean expression is true. LZERO sets the output level when the boolean expression is false, and LTHRESH sets the
threshold value for the boolean logic. In the Text page of the schematic, the following options statement has been
.options lone=3.5 lzero=.4 lthresh=1.5
This statement sets the true output level to 3.5, the false output level to .4, and the transition point to
1.5. The resultant transient analysis is shown below. For the SPICE3 operators, the output levels have
now shifted to the values set by the Global Settings variables, and the transition point has slightly shifted
over in time when compared to the first simulation.
Note that the expressions using the And, Or, and Not operators continue to work as they did in the first
simulation with outputs of zero and one. Since there is no conflict with these operators, the Spice Type
option has no effect on how they work.