An hons-based, s-expression representation of monotonic, four-valued functions.
This library defines the logic of the esim symbolic
simulator. By "four-valued", we mean that each wire can take one of the four
values recognized by 4vp:
- X represents "unknown" values
- Z represents an "undriven" or "floating" value
- T represents logical truth
- F represents logical falsity
The non-Boolean values X and Z are often
useful when modeling hardware, and are intended to correspond to
Verilog's notions of X and Z.
Our logic has a fixed set of primitive 4v-operations that model, for
instance, how an AND gate behaves when given a pair of four-valued inputs. On
top of these primitives, we use a simplified s-expression syntax to represent expressions in the logic.
The semantics of these s-expressions are defined by 4v-sexpr-eval, a
simple evaluator that can look up variables and apply the primitive
A feature of our logic is that all the primitives are intrinsically monotonic, which loosely means that they
properly treat X inputs as unknowns. The monotonicity of the primitives
carries over to the s-expressions.
- S-Expression representation of four-valued expressions.
- The monotonicity property satisfied by all 4v-operations.
- Primitive operations in our four-valued logic.
- Motivation for using a four-valued logic.
- Four-valued lattice-ordering comparison.
- Recognizer for four-valued logic constants.
- Macro for cases on the 4-valued logic constants.
- Fixing function for four-valued constants.
- Alist lookup that automatically 4v-fixes its result.