• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
        • Symbolic-test-vectors
          • Defstv
          • Stv-compile
            • Stv-expand-input-entry
            • Stv-expand-output-entry
              • Stv-restrict-alist
              • Stv-extraction-alists
              • Stv-expand-input-lines
              • Stv-expand-input-entries
              • Stv-expand-output-entries
              • Stv-expand-internal-lines
              • Stv-expand-output-lines
              • Stv-expand-internal-line
              • Stv-gensyms
              • Stv-forge-state-bit
              • Safe-pairlis-onto-acc
            • Symbolic-test-vector-format
            • Stv-implementation-details
            • Compiled-stv-p
            • Stv-run-for-all-dontcares
            • Stv-run
            • Stv-process
            • Stv-run-check-dontcares
            • Symbolic-test-vector-composition
            • Stv-expand
            • Stv-easy-bindings
            • Stv-debug
            • Stv-run-squash-dontcares
            • Stvdata-p
            • Stv-doc
            • Stv2c
            • Stv-widen
            • Stv-out->width
            • Stv-in->width
            • Stv->outs
            • Stv-number-of-phases
            • Stv->ins
            • Stv-suffix-signals
            • Stv->vars
          • Esim-primitives
          • E-conversion
          • Esim-steps
          • Patterns
          • Mod-internal-paths
          • Defmodules
          • Esim-simplify-update-fns
          • Esim-tutorial
          • Esim-vl
        • Vl2014
        • Sv
        • Vwsim
        • Fgl
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Stv-compile

    Stv-expand-output-entry

    Convert a single user-level output/internal value (e.g., _, result) into a list of 4v-sexprs.

    Signature
    (stv-expand-output-entry name width pnum entry usersyms) 
      → 
    (mv new-val usersyms)
    Arguments
    name — The name of this output. It should be a list of E input bits in lsb-first order. That is, Verilog-style names should have already been expanded away using stv-expand.
        Guard (and (true-listp name) (consp name)).
    width — Just the pre-computed width of this output. It must be exactly equal to (len name). This lets us know how many variables to generate when we hit a simulation variable.
        Guard (equal width (len name)).
    pnum — The current phase number (and starts at 0). This is semantically irrelevant; we use it only to generate better error messages.
        Guard (natp pnum).
    entry — The actual entry we are trying to expand, i.e., it's what the user wrote down for this output at this phase. To be well-formed, the entry needs to be _ or a simulation variable, but the user can write down anything so we have to check that it is valid.
    usersyms — A fast alist binding simulation variables to the lists of bits that we've generated to represent them. We assume this only contains the output simulation variables. This lets us make sure that output variables aren't being reused.

    The only valid entries for output lines are _ (for signals we don't care about) and simulation variables. Here, we just leave any _ values alone, but we replace simulation variables with lists of new variables that we generate from their names. That is, a simulation variable like result will be converted into a list of bits like (result[0] ... result[4]).

    Definitions and Theorems

    Function: stv-expand-output-entry

    (defun
     stv-expand-output-entry
     (name width pnum entry usersyms)
     (declare (xargs :guard (and (and (true-listp name) (consp name))
                                 (natp pnum)
                                 (equal width (len name)))))
     (let
      ((__function__ 'stv-expand-output-entry))
      (declare (ignorable __function__))
      (b*
       (((when (or (natp entry)
                   (eq entry 'x)
                   (eq entry '~)
                   (keywordp entry)
                   (not (symbolp entry))))
         (raise
          "Phase ~x0 for ~x1: value ~x2 is not legal for :output lines."
          pnum name entry)
         (mv nil usersyms))
        ((when (eq entry '_))
         (mv entry usersyms))
        (look (hons-get entry usersyms))
        ((when look)
         (raise
          "Phase ~x0 for ~x1: variable ~x2 is already in use, so it ~
                    cannot be used again."
          pnum name entry)
         (mv nil usersyms))
        (my-syms (stv-gensyms (symbol-name entry) width))
        (usersyms (hons-acons entry my-syms usersyms)))
       (mv my-syms usersyms))))