Evaluate a symbolic test vector at particular, concrete inputs.
(stv-run pstv input-alist &key skip quiet) → out-alist
- pstv — The symbolic test vector to run.
Guard (processed-stv-p pstv).
- input-alist — An alist that should typically bind at least some of the input
simulation variables to natural numbers, or to the symbol X.
Any inputs that aren't mentioned are implicitly bound to X.
- skip — Advanced option to avoid computing certain outputs; see below.
- quiet — Suppress debugging output. By default, stv-run will print
certain debugging information. This is generally convenient in
def-gl-thm forms involving an stv-run, and will allow
you to see nicely-formatted debugging info when counter-examples
are found. But you can use :quiet t to suppress it.
- out-alist — Alist binding user-level STV outputs to either natural
numbers or X.
Evaluating an stv basically involves three steps:
- We translate the input-alist into bit-level bindings; see stv-simvar-inputs-to-bits.
- Using these bit-level bindings, we evaluate the relevant output bits from
the processed STV, basically by calling 4v-sexpr-eval on each output
- We take the evaluated output bits and merge them back into a user-level
alist that binds the output simulation variables to natural numbers or Xes; see
The optional skip argument may allow you to optimize this process,
especially in the context of gl proofs, when you don't care about the
values of certain output simulation variables. For instance, suppose you have
a module that emits several flags in addition to its result, but you don't care
about the flags for some instructions. Then, you can tell stv-run to skip
computing the flags as you verify these instructions, which may lead to a big
savings when BDDs are involved.
Definitions and Theorems
stv-run-fn (pstv input-alist skip quiet)
(declare (xargs :guard (processed-stv-p pstv)))
(declare (ignorable __function__))
(((mv sigs out-usersyms)
(stv-run-collect-eval-signals pstv skip))
(- (or quiet
(cw "STV Raw Inputs: ~x0.~%" input-alist)))
(ev-alist (stv-run-make-eval-env pstv input-alist))
(4v-sexpr-simp-and-eval-alist sigs ev-alist))
:msg "; stv-run out-bits: ~st sec, ~sa bytes.~%"))
(- (fast-alist-free ev-alist))
(stv-assemble-output-alist evaled-out-bits out-usersyms)
:msg "; stv-run outs: ~st sec, ~sa bytes.~%"))
(- (fast-alist-free evaled-out-bits))
(- (or quiet
(progn$ (cw "~%STV Inputs:~%")
(cw "~%STV Outputs:~%")
:msg "; stv-run: ~st sec, ~sa bytes.~%"
- Convert the user-level input alist (which binds simulation variables
to naturals) into a bit-level alist for 4v-sexpr-eval.
- Convert the bit-level bindings from after 4v-sexpr-eval into
user-level bindings of the output simulation variables to naturals or X.
- Dumb printing utility. X is expected to be an alist binding symbols
to values. We print them out hexified and indented in a nice way.